DEV Community

Cover image for A guide to setting up Vim for JavaScript development

A guide to setting up Vim for JavaScript development

Ayooluwa Isaiah on May 06, 2019

I’ve been using Vim for close to two years now, and do all my JavaScript development work in it. In the process, I’ve tweaked my configuration seve...
Collapse
 
ug02fast profile image
Arthur Zhuk

One of the better VIM setup guides I've come across 👍

Collapse
 
johncip profile image
jmc • Edited

My setup is similar to yours, and I second all of your suggestions. I wanted to add that ALE will use eslint_d if you have it installed, and it's noticeably faster than eslint.

Also I feel like vim-surround should just be merged into vim -- it's that useful.

Collapse
 
flrnd profile image
Florian Rand

Hey nice guide!

I want to add a few things with your permission. I found that for javascript syntax, yajs.vim pairs perfectly with vim-javascript. Also, for Jsx suppport and react I preffer vim-jsx-pretty. It's more updated and support typescript.

While I like vim-polyglot, I stopped using it because it's very bloated and I had few performance issues.

Another last important thing, the colorsheme is important for Syntax highlight aswell. I discovered that for example, Gruvbox (yes, being so popular) has very bad syntax hightlight in general. I'm not going to suggest a colorscheme because it's a matter of taste and preferences, but for people to know.

Anyway, great guide! Short and to the point! I'd love finding a guide like this when I started using neovim! I would save a lot of time and headaches haha!

Collapse
 
ayoisaiah profile image
Ayooluwa Isaiah

I didn't notice any performance degradation when I switched to vim-polyglot. As far as I know, it only loads the script for the language that you're working in. I've been working with more languages recently and it helps to not have to worry about syntax highlighting.

Thanks for mentioning vim-jsx-pretty. It looks pretty good and better maintained so I have opened an issue that it might be used in place of vim-jsx in a future release of vim-polyglot.

While I'm OK with Gruvbox, I'm open to suggestions if you think there's something better.

Cheers!

Collapse
 
flrnd profile image
Florian Rand • Edited

Hey if you really like gruvbox check Lifepillar's port. He explains what upgrades did compared to the official grubvox. He has some other colorschemes and interesting plugins!

About polyglot, to keep my answer short, I really think that it's a great plugin, if it works for you great! (EDIT: Forgot to mention I may give polyglot another try after reading your guide! thanks!)

Cheers!

Thread Thread
 
ayoisaiah profile image
Ayooluwa Isaiah

Thank you Florian, I will check it out!

Collapse
 
ronenlaufer profile image
Ronen Laufer

I was getting "redrawtime exceeded syntax highlighting disabled" error when opening TS files after setting Coc.nvim
in order to solve it add the following line to your .vimrc file:
set re=0