Difference between revisions of "Neovim"

From ArchWiki
Jump to navigation Jump to search
(Installing neovim to Python: fixed another package error)
(Remove python section. This was all really bad advice)
Line 21: Line 21:
  set rtp^=/usr/share/vim/vimfiles/
  set rtp^=/usr/share/vim/vimfiles/
== Python ==
Some plugins (e.g. [https://github.com/Valloric/YouCompleteMe ycm]) and additional features require python to have neovim installed.
=== Installing neovim to Python ===
First you need to make sure you have the {{Pkg|python-pip}} and {{Pkg|python2-pip}} packages installed. Then run
  $ sudo pip install neovim
  $ sudo pip2 install neovim
to install the the neovim python packages
=== Setting up your init.vim ===
As arch links {{ic|/usr/bin/python}} to {{ic|python3}}, neovim's default search path for python 2 will find python 3. To fix this add the line
  let g:python_host_prog='usr/bin/python2'
To the top of your {{ic|nvim/init.vim}} file. This can be put in an {{ic|if}} block to make your init file slightly more portable
  if system('uname -a | grep -c ARCH')
      let g:python_host_prog='usr/bin/python2'
== Tips and tricks ==
== Tips and tricks ==

Revision as of 00:01, 17 February 2017

Neovim is a fork of Vim aiming to improve user experience, plugins, and GUIs.


Install the neovim package.


Transition from vim

Neovim uses $XDG_CONFIG_HOME/nvim instead of ~/.vim as its main configuration directory and $XDG_CONFIG_HOME/nvim/init.vim instead of ~/.vimrc as its main configuration file.

See nvim-from-vim or the :help nvim-from-vim neovim command to use your vim configuration in neovim.

Loading vim addons

If you would like to use plugins, syntax definitions, or other addons that are installed for vim, you can add the default vim runtime path to neovim by adding it to the rtp. For example, you could run the following within nvim or add it to your neovim config:

set rtp^=/usr/share/vim/vimfiles/

Tips and tricks

Replacing vi and vim with neovim

Setting $VISUAL and $EDITOR environment variables should be sufficient in most cases.

Some applications may hardcode vi or vim as default editor, to use neovim in their place, install neovim-drop-inAUR.

Symlinking init.vim to .vimrc

As neovim is mostly compatible with standard vim, you can symlink your old .vimrc to nvim/init.vim to keep old configuration options:

 $ ln -s ~/.vimrc ~/.config/nvim/init.vim

If you want some lines to specific to each version, you can use an if block in your .vimrc file

 if has('nvim')
     " Neovim specific commands
     " Standard vim specific commands

See also