In this post I’ll share the most critical plugins I use in Vim in my day to day as a web developer. The plugins I just can’t live without, as well as some bonus nice-to-have plugins.
I use regular Vim, not Neovim, but I think all of my plugins will also work in Neovim.
My take on plugins
The Vim community (in particular Vim users, not so much Neovim users) are famous for disliking plugins and IDEs, preferring instead to do things “the Vim way”.
I also share this preference, I think it’s the best to actually learn how to use this crazy powerful editor. As such, I think the best plugins are the ones that actually extend Vim’s native functionality, instead of creating new non-standard functionality.
That being said, Vim doesn’t provide everything out of the box, and some things could surely use some help. Below are the plugins I find absolutely necessary for a modern and efficient dev environment.
Vim-lsp
Let’s start with one of the most popular plugins, vim-lsp. I like this plugin because once you set it up, you can install new servers by just running :LspInstall. Making it super easy to install new servers, and share the same vim configuration across different computers.
If you use TypeScript or any language with good LSP support, there’s really no reason not to use this or a similar plugin.
CtrlP.vim
Probably this could be replaced by vim-fzf, but I like CtrlP because a) It doesn’t have any external dependencies, b) It also has a regex mode, and c) It just works!
I’ll have to admit though, I use ripgrep together with CtrlP. I also use rg for my custom :Grep so I’d rather have one single dependency instead of two.
As with the LSP integration, the actual plugin itself doesn’t matter as much as having the ability to quickly jump between files by fuzzy finding them. I find this to be an absolute must in any modern text editor.
ALE
ALE is one of the most popular and well maintained plugins in the Vim ecosystem. It’s basically a Linter that “just works”. It will pick up whatever linter you use (such as ESLint) and lint the files as you type, no configuration needed.
To really get the most out of ALE though, you’ll need some configurations. For example, I don’t like using ALE for my LSP, so I disabled that feature. Also, I configured a few ale_fixers so I can run Prettier on file save as well.
I like this plugin because it gets out of your way and for the most part it “just works”. It supports virtually every existing linter out there, it’s all VimScript, and has no dependencies.
Text Objects
This is a perfect example of a plugin that extends Vim’s way of doing things. I have some custom text objects that I use quite often, namely “entire file” and “indentation”. So I can do things like vai to “visually select around indentation level” or yae to “yank around the entire file”.
- vim-textobj-user – The base dependency to create custom text objects
- vim-textobj-entire – Entire file text object
- vim-textobj-indent – Indentation text object
If you like this idea, check out the repo’s Wiki where it lists lots of other custom text objects.
Tim Pope’s plugins
I use many of Tim Pope’s plugins. I’ll just list them together, as they are all equally awesome:
- vim-commentary – Easily toggle comments in your code
- vim-eunuch – Cross-platform commands for managing files (rename, delete, move, etc)
- vim-repeat – Repeat plugin commands just like regular commands
- vim-surround – Wrap stuff with things like parentheses, brackets or quotes
- vim-vinegar – A bunch of configuration to make Vim’s default netrw more usable
Status Bar + Git
I like to keep things simple and most status bar plugins out there are quite bloated and slow. That’s why I use my own status bar together with vim-gitbranch to read the current git branch when I’m inside a git repository. It’s surprisingly complex to do this yourself, because polling for the branch can be very slow and not cross-platform.
I also use vim-signify to add git changes to the gutter bar, so I know which lines were changed against the last commit in the current branch. The same plugin also exposes a function you can use in your status line!
This is what my status bar looks like:
function! StatusLinePasteMode() abort
return &paste ? ' PASTE ' : ''
endfunction
" ALE status
function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0
\ ? ''
\ : printf('[%dW %dE]', all_non_errors, all_errors)
endfunction
function! StatusLineGitBranch() abort
let branch = gitbranch#name()
if branch == ''
return '[No Repo]'
else
return branch
endif
endfunction
set laststatus=2
set statusline=
set statusline+=%#Search#
set statusline+=\ %{StatusLineGitBranch()}\
set statusline+=%#PmenuSbar#
set statusline+=%{StatusLinePasteMode()}
set statusline+=%#LineNr#
set statusline+=\ %f
set statusline+=%m
set statusline+=%=
set statusline+=%#CursorColumn#
set statusline+=\ %y
set statusline+=%{LinterStatus()}
set statusline+=\[%{&fileencoding?&fileencoding:&encoding}]
set statusline+=\[%{&fileformat}\]
set statusline+=%{sy#repo#get_stats_decorated()}
set statusline+=\ %l:%c
set statusline+=\ %p%%
set statusline+=\
VimCompletesMe
This one is rather simple. VimCompletesMe allows you to use the TAB key to autocomplete stuff. It works out of the box and is smart enough to try all different potential autocomplete sources.
You can use it with spellcheck to write documents, with an LSP, a tagfile, buffer autocompletion, file path autocompletion, and just any Vim autocompletion.
My own plugins
Being an avid Vim user, I’ve authored a few plugins myself 🙂 They are overall pretty minimalistic, and as you might have guessed by now, I like plugins that are simple, have no dependencies and just get out of your way.
- vim-smartpairs – Automatically auto-close “pairs” as you type, such as quotes, brackets, parentheses, etc
- vim-zencoding – This is a more restrictive implementation of “Zencoding”, also known as “Emmet”. It expands HTML tags with classes and IDs, it also works with React
- vim-zensnippets – This one I don’t use as much, but I find it very helpful to have expandable snippets for things such as HTML documents and tables
All of my plugins have no dependencies and are 100% VimScript.
Special Mentions
These are plugins that I don’t find absolutely necessary but are still nice to have:
- copilot.vim – Enable using GitHub Copilot
- vim-highlightedyank – Highlights yanks so it’s very easy to see if you yanked the right thing
-
vim-shot-f – Highlights unique characters when using
fand family (f,F,t,T) - vim-cool – Automatically un-highlight after searching
- vim-better-whitespace – Highlights dangling white space
- vim-one – Nice color theme
- easyjump.vim – A modern and minimalistic implementation of EasyMotion
- vim-table-mode – If you need to make tables in Markdown or a similar format, this is pretty cool!
That’s it!
Those are the plugins I use the most, hope you found something cool to try out 🙂 Let me know what you think or what plugins you recommend!
— Fede