samhstn / my-config

16 stars 0 forks source link

Vim Elixir Syntax Highlighting? #45

Open nelsonic opened 5 years ago

nelsonic commented 5 years ago

Hi @samhstn! Hope your weekend is going well. ☀️ In your WHY_VIM.md#thoughts-on-vim-plugins you say that you aren't currently using any Plugins in your Vim setup. (and your .vimrc confirms it...)

My question is: how are you getting Elixir Syntax highlighting for .ex, .eex and .exs files?

samhstn commented 5 years ago

Hey Nelson, my weekend's going well thanks.

I'm actually not using Elixir syntax highlighting atm - I'm testing out having minimal plugins atm and seeing how it goes (currently only have vim-repeat and vim-surround in my ~/.vim/bundle directory - read about how ~/.vim/bundle works here: https://github.com/tpope/vim-pathogen)

If you would like to add syntax highlighting, then using my current .vimrc,

you could add the vim-elixir package (this is the one I've used in the past) by running:

git clone https://github.com/elixir-lang/vim-elixir.git ~/.vim/bundle/vim-elixir

And you can remove it again by simply running:

rm -rf ~/.vim/bundle/vim-elixir

I previously had the following in my ~/.vim/bundle:

$ ls ~/.vim/bundle
elm.vim        vim-elixir     vim-javascript vim-repeat     vim-surround
nelsonic commented 5 years ago

Minimal plugins is a really good plan. 💡 I expect to go in the same direction (plugin minimalism) as it's beginner friendly.🥇

I'm still reacquainting myself with Vim after a 6 year hiatus. ⏳ #TimeFlies Thankfully Vundle still works as I remember and the keyboard bindings haven't changed. 💭 I just want to be able to "scan" code faster and syntax highlighting helps me. 😉

If you have time next week, I'd love to do a 10 min remote pairing session 💻 <-- 🌍 --> 💻 where you walk through your Vim setup and general Elixir/Elm/Python dev Workflow. 🤔 LMK thoughts. 👍

samhstn commented 5 years ago

Sounds good 👍 I'd enjoy that. I'll message you on gitter and we can arrange a time

SimonLab commented 5 years ago

I'm actually not using Elixir syntax highlighting atm

@samhstn does this means that non of your code is using syntax highlight (elm elixir js...)? Only black and white text? So far I still find that syntax highlighting is quiet useful. Is it too distracting for you?

samhstn commented 5 years ago

@SimonLab I have syntax enable at the bottom of my .vimrc (for more info run: vim -c "help syntax|only").

syntax enable will use the basic syntax highlighting described in the /usr/share/vim/vim*/syntax/ directory and looks aesthetically pleasant for js files, ok for ex files, but plain for elm files.

I have used elm-vim and vim-elixir, but feel that they provide me with too much functionality when all I want from them is syntax highlighting, they are also ugly packages (relative to the beauty of vanilla vim) with bugs and other problems which I don't want to introduce to my minimalist setup - I only want to use the highest quality plugins.

elm-vim provides 7 features, two of which require elm-oracle (which I won't add). I have also experienced unexpected results with indenting - probably because it's trying to do too much.

vim-elixir is better, in that, they have not created an elixir Swiss Army Knife, but rather focus on a small set of features. This is far more aligned with my values, but there is still a lot more moving parts than I would like and does not exactly fit what I am looking for - I am not looking to put a square through a circle and (especially recently) prefer no tool, simplicity and to wait until the correct solution is implemented.

I think the ideal solution for me would be an elm.vim file which will be similar to /usr/share/vim/vim*/syntax/haskell.vim or elm-vim/elm.vim

It would be installed with:

curl -SLs "https://raw.githubusercontent.com/samhstn/my-config/master/.vim/syntax/elm.vim" > ~/.vim/syntax/elm.vim

This elm.vim file will be very minimal, easy to maintain and have no bugs.

(it may be good to consider adding a similar configuration for indent, taking inspiration from /usr/share/vim/vim*/indent/javascript.vim)