Barbarian Meets Coding Titlebarbarianmeetscoding

WebDev, UX & a Pinch of Fantasy

vim

Wiki: Neovim - Using modern vim

Neovim is a fork of vim which aims at doing a major refactoring of the codebase with a focus on modern development workflow and making vim more extensible. (Check the Neovim documentation which describes Neovim’s vision.)

Migrating to Neovim

Installing Neovim

Note that all config instructions assume that you’re running neovim on MacOS, if you aren’t take a look at neovim docs to find the correct paths and such.

//TODO

Setting up a vimrc

The first thing you need to know is that neovim is designed to run side by side with vim. That means that it has its own executable nvim and its own configuration file, by default, in ~/.config/nvim/init.vim. An easy way to get started with neovim is to just have it load your current vimrc file. In order to to that you create a init.vim file in the folder above and then write the following:

" load current vimrc file
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vim/vimrc

You can find more info about vimrc with neovim using vim’s help :help vimrc.

Using Vim and Neovim

// TODO

Plugins

  • Fuzzy search with fzf and ripgrep (that takes into account .gitignore)
  • Run external tools with Dispatch
  • in-editor errors and help with ALE
  • TypeScript support as detailed below
  • text search in any file with grepper

// TODO add more details

Setting TypeScript Support in Vim

  • Use vim-typescript plugin to get syntax highlighting
  • Use ale to get in-editor compiler and linting warnings. You can use it in combination with prettier for doing formatting on save
  • Use tsuquyomi plugin for omnicompletion and such: Navigate to the location where a symbol is defined. Show location(s) where a symbol is referenced. Display a list of syntax and semantics errors to Vim quickfix window, etc. Ale also provides autocompletion. How much overlap is there between the two? It doesn’t look like it’s playing very well with the other plugin. Works by adding yet another plugin to run async tasks.

// TODO: expand

Limitations

  • Neovim has no gui, it is only text based. Because of this it has some weird limitations like not being able to set the font size. It just uses the size of the font used in the terminal which hosts neovim. That being said, the idea with Neovim is to work as an engine for other projects who will focus on building GUIs on top of Neovim. These are some examples:

References


Jaime González García

Written by Jaime González García , Dad, Husband, Front-end software engineer, UX designer, amateur pixel artist, tinkerer and master of the arcane arts. You should follow him on Twitter where he shares useful stuff! (and is funny too).Jaime González García