How-To-install-vimwiki-in-neovim-on-Mac

· rivet's blog


These instructions are mostly specific to Macs with Homebrew but I guess the concept would work on general Linux/Unix systems as well with a few tweaks.

1) Install Neovim #

Use brew:

brew update
brew install neovim

You can now run neovim using the nvim command.

2) Install vim-plug #

The best way to deal with adding plugins on vim is with a package manager and vim-plug is a solid choice, mostly cause it's widely supported and fuzz free.

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

The above command should work for all Mac/Unix/Linux systems.

3) Create your Neovim configuration file #

This configuration file does a few things:

  1. it enables spelling
  2. it installs vim-plug
  3. it installs sonokai color scheme

Create the config file:

mkdir -p ~/.config/nvim/
nvim init.vim

Inside the config file add the following:

autocmd BufRead,BufNewFile *.txt,*.md setlocal spell spelllang=en_us

set nocompatible
filetype plugin on
syntax on
call plug#begin()
Plug 'vimwiki/vimwiki'
Plug 'sainnhe/sonokai'
call plug#end()
let g:vimwiki_list = [{'path': '~/Documents/Notes',
                      \ 'syntax': 'markdown', 'ext': '.md'}]

let g:sonokai_style = 'maia'
let g:sonokai_better_performance = 1

colorscheme sonokai

4) Install the plugins #

So at this point your configuration file has a declaration of the plugins you want to install, namely "sonokai" and "vimwiki". Next step is to actually install them. - From inside nvim run:

:PlugInstall

This should create a split window and install any (all in this case) missing plugins.

Cheat-sheet of useful Neovim commands #

Command What it does
\ww It will activate your vimwiki notes (i.e. open ~/Documents/Notes/index.md)
ctrl+space Do that on the same line as a checkbox (- [ ]) and it will mark that item as done (- [X])
enter (over text) Turn that text into a hyperlink. Press enter a second time and it will create a new wiki page
backspace Go back to the previous wiki page
:h vimwiki-syntax Tips about the vimwiki expected syntax (keep in mind we've activated markdown mode!)
:h vimwiki-mappings Tips about the vimwiki commands and key bindings

Support URLs: