Neovim: Difference between revisions

From wikinotes
No edit summary
Line 33: Line 33:
|}
|}
</blockquote><!-- Notes -->
</blockquote><!-- Notes -->
= Install =
<blockquote>
release
<syntaxhighlight lang="bash">
# release
pacman -S neovim
pkg install neovim
brew install neovim
</syntaxhighlight>
nightly
<syntaxhighlight lang="bash">
# archlinux
pacaur -S neovim-nightly-bin
# macos
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz \
  && tar -xzf nvim-macos.tar.gz \
  && rsync -avz --delete nvim-osx64/* ~/opt/
</syntaxhighlight>
</blockquote><!-- Install -->


= Configuration =
= Configuration =

Revision as of 02:38, 26 December 2021

Neovim is a rewrite of vim with some new/alternative features.

Documentation

:help https://neovim.io/doc/user/

Locations

~/.config/nvim/init.vim nvim's vimrc
~/.config/nvim/ginit.vim GUI nvim's vimrc

Notes

neovim install
neovim configuration
neovim features
neovim guis

Configuration

" ~/.config/nvim/init.vim

" source vimrc from init.vim
set rtp^=HOME/.vim
so ~/.vimrc

Features

Terminal

Neovim has it's own embedded terminal!

:terminal        " open terminal in current tab
<c-leader><c-n>  " escape terminal mode into normal-mode
tnoremap  <c-a>  " keybind namespace for within terminal mode

<c-leader><c-n> (move cursor to filename) gf   "open file in nvim

" ex:  (perhaps bind this to a key)
cd /path/to/src
realpath file.py
<c-leader><c-n>
k
gf

GUI

neovim-qt

Essentially gvim for neovim, and it's beautiful.

:GuiFont DejaVu Sans Mono:h11    " change font/size

Extensions

neovim-remote

Start a neovim-server, neovim connects to this, adding files to the same session.

Common Issues

strange global variable behaviour

neovim saves global variables in ~/.local/share/nvim/shada/main.shada.
If you encountering wonky results when changing your vimrc, delete this file and try again.

neovim crashes terminal

Your terminal probably needs to be recompiled.

scrolling panes is broken in xterm

You may be using xterm, not xterm-256color.
Try export TERM= or export TERM=xterm.