knowledge › Software

Neovim

sudo pacman -S neovim

This page documents some of my preferred setup for neovim.

Plugins

Like any other vim user, plugins are essential. Here are a few of my must-haves for the projects I work on.

Autocomplete

Conquer of Completion is an intellisense engine for Neovim that works like the VSCode one. Add the following to init.vim:

Plug 'neoclide/coc.nvim', {'branch': 'release'}

Additionally, set the following to use <tab> to cycle through autocomplete options.

" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

TypeScript & JavaScript

TS and JS require a few different plugins to work well together. Add the following to init.vim when using VimPlug:

Plug 'neoclide/coc.nvim', {'branch': 'release'} " Intellisense engine
Plug 'pangloss/vim-javascript'                  " JavaScript syntax
Plug 'mxw/vim-jsx'                              " JSX syntax
Plug 'HerringtonDarkholme/yats.vim'             " TypeScript syntax

Finally, the remaining dependencies:

  1. Run :CocInstall coc-tsserver (coc-tsserver)
  2. Run npm install -g typescript (typescript)
  3. Restart nvim!

Read more about CoCs language servers

Motion

These are a few quality of life plugins to improve motion within vim

  • vim-surround - for easy brackets, quotes, or other surrounding characters
  • auto-pairs - for automatically inserting matching pairs of brackets or similar characters
  • vim-commentary - for easy commenting

File management

  • nerdtree - for a sidebar file browser
  • ctrlp - fuzzy file finder
  • vim-auto-mkdir - automatically create directories when saving files
  • vim-grepper - search the entire codebase with your favourite grepping tool

    • works well with ripgrep (sudo pacman -S ripgrep)

Links