Vim/Nvim Setup
Sep 27, 2019
When I first started working my tutor insisted we use vi. His reasoning was that vi was the only editor we were guaranteed to find on all various versions of UNIX. After 6 weeks of fighting with it, the keystrokes started to leak into my muscle memory and since then vi or one of its derivatives has been my editor of choice. I moved to vim fairly early on, but didn’t really get into the whole plugin ecosystem. Over the years though I’ve slowly added plugins (and rejected a fair few as well) and so now I have a sort of “standard set”, which, although not final, is what I am currently using. Plugin Manager For vim I was using Plug, while for Nvim I was using NeoBundle. NeoBundle is no longer being developed and Dein (by the same author) is now recommended as the replacement so I’ve changed to using that in both vim and nvim. To update your plugins run:
:call dein#update()
Plugins #
Theme Plugins #
I tried SpaceVim but didn’t like it so went with the light airline status bar and theme. For the actual theme itself I choose the “luna” theme.
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
let g:airline_theme = "luna"
Language Plugins #
Language Server #
For the language server I went with vim-lsp
. This just provides the language server itself so you need to install the relevant language plugin for lsp. For me these were for Go, Javascript/Typescript and Python.
call dein#add('prabirshrestha/async.vim')
call dein#add('prabirshrestha/vim-lsp')
The best place to find the various plugins for the various languages is on the vim-lsp wiki page which can be found here.
Go #
For go I went with the vim-go
plugin. You need to do :GoInstallBinaries
(or :GoUpdateBinaries
to update them) to ensure the extra Go binaries are installed in the go/bin
directory.
call dein#add('fatih/vim-go', { 'do': ':GoUpdateBinaries' })
Javascript/Typescript #
For javascript/typescript I went with the vim-lsp-typescript
plugin.
call dein#add('ryanolsonx/vim-lsp-typescript')
Python #
For python I went with vim-lsp-python
plugin. I also installed the vim-isort
plugin so I could sort the imports in python.
call dein#add('ryanolsonx/vim-lsp-python')
call dein#add('fisadev/vim-isort')
Other Plugins #
One of the more general plugins I installed was vim-commentary
for commenting out code. Highlighting the code in visual mode and then hitting gc is much easier than repeating it x number of times.
call dein#add('tpope/vim-commentary')
One of the more newer ones I’ve added is vim-fzf
. The first command install fzf
itself and the second one installs the plugin.
call dein#add('junegunn/fzf, { 'dir': '~/.fzf', 'do': './install --all' })
fzf
is an interesting beast. You can use it in place of creating a tags file.