Neovim: Difference between revisions

From miki
Jump to navigation Jump to search
Line 85: Line 85:
sudo mkdir -p /usr/local/icons
sudo mkdir -p /usr/local/icons
sudo cp neovim-qt//third-party/neovim.png /usr/local/icons
sudo cp neovim-qt//third-party/neovim.png /usr/local/icons
* Add to {{file|~/.vimrc}}:
* Add to {{file|~/.vimrc}} [http://superuser.com/questions/506520/using-xseticon-to-set-vim-icon/506521]:
<source lang=vim>
<source lang=vim>
if has('nvim')
if has('nvim')

Revision as of 12:45, 3 November 2016

References

Install

Follow the install guide Installing Neovim.


Default ini files are located at ~/.config/nvim/init.vim. To import Vim settings (FAQ :help nvim-from-vim)

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

Configure nvim as default vim alternative:

sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --config vi
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo update-alternatives --config vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60
sudo update-alternatives --config editor


Ruby support

Must install neovim rubygem:

sudo apt install ruby-dev
sudo gem install neovim

Python support

sudo pip install neovim

Plugin manager

We install vim-plug:

curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Plugins

Content of ~/.config/nvim/init.vim:

Reload the init script and install plugins:

:so $MYVIMRC
"... or ':so %' if it is current file
:PlugInstall

To update plugins:

:PlugUpdate
To test
  • vim-airline, vs powerline, vs vim-bufferline
  • Color theme solarized.

NeoVim GUI

There is no equivalent to gvim for neovim so far. The best I could do so far is to create a script gnvim that

  • uses gnome-terminal as window,
  • sets title to NeoVim, and
  • sets icon using xseticon.

To install gnvim:

  • Build and install xseticon.
  • Copy neovim icon to /usr/local/icons/neovim.png. For instance, there is an icon in neovim-qt.git:
git clone https://github.com/equalsraf/neovim-qt.git
sudo mkdir -p /usr/local/icons
sudo cp neovim-qt//third-party/neovim.png /usr/local/icons
  • Add to ~/.vimrc [1]:
if has('nvim')
  autocmd VimEnter * execute '!xseticon -name NeoVim /usr/local/icons/neovim.png'
endif
  • Create file gnvim, and make it executable:
#! /bin/bash
# Must use $* because $@ does not work here
gnome-terminal --geometry 132x50 -x bash -c "echo -ne '\033]0;NeoVim\007'; exec nvim $*"

Troubleshooting

True color and italic support

There are lot of discussion about true color and italic support in the terminal. Below the list of relevant posts.

All in all the solution for me involved to at least:

  • Upgrade to Ubuntu Xenial 16.04, to get newest Gnome Terminal and Terminator/gtk3 on recent VTE.
  • Upgrade to tmux 2.2 (only if using tmux).
  • Do a total reset of the account configuration.
  • Fiddle a bit with the terminfo (still not sure what was the exact recipe though).
  • Use gruvbox as theme (not solarized, which does not work in terminal).

To test, first verify that the color theme works correctly in gvim.

To Do

True color
Gui
Color scheme
  • Solarized
  • gruvbox
Linters
  • neomake
  • syntactics