Neovim

From Gentoo Wiki
Jump to:navigation Jump to:search

Neovim is a hyperextensible Vim-based text editor.

Installation

USE flags

USE flags for app-editors/neovim Vim-fork focused on extensibility and agility

lto Build with Link Time Optimization (LTO)
nvimpager Install nvimpager symlink to less.sh macro
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
tui Build the neovim unix tui

Emerge

root #emerge --ask app-editors/neovim

Additional software

Plugin manager

A plugin manager allows installation of plugins to Neovim editor to make it function according to user preference.

Vim plug

This is a plugin manager made both for Vim and Neovim. Here is the GitHub page: vim-plug. Read the GitHub page for any issues encountered.

To install it for Neovim do the following:

user $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'

Or for flatpak:

user $curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Configuration

Environment variables

Important environment variables include:

  • VIMRUNTIME - Used to locate runtime files (documentation, syntax highlighting, etc.).
  • VIMINIT - Ex commands to be executed at startup. Run :help VIMINIT


A full list of environment variables can be found under the environment section of man 1 nvim.

Files

Neovim honors XDG base directories.[1] Therefore the configuration directories are defined by XDG_CONFIG_HOME (defaults to ~/.config) or XDG_CONFIG_DIRS (defaults to /etc/xdg) variables.

  • $XDG_CONFIG_HOME/nvim - User-local Neovim configuration directory
  • $XDG_CONFIG_HOME/nvim/init.vim - User-local Neovim configuration file
  • $XDG_CONFIG_DIRS/nvim/sysinit.vim - System-global Neovim configuration file


For example, customize Neovim for a specific user by editing the:

FILE $XDG_CONFIG_HOME/nvim/init.vim
set number

This particular example activates line numbers on the left hand side of the editor.

Usage

Invocation

user $nvim --help
Usage:
  nvim [options] [file ...]      Edit file(s)
  nvim [options] -t <tag>        Edit file where tag is defined
  nvim [options] -q [errorfile]  Edit file with first error

Options:
  --                    Only file names after this
  +                     Start at end of file
  --cmd <cmd>           Execute <cmd> before any config
  +<cmd>, -c <cmd>      Execute <cmd> after config and first file

  -b                    Binary mode
  -d                    Diff mode
  -e, -E                Ex mode
  -es, -Es              Silent (batch) mode
  -h, --help            Print this help message
  -i <shada>            Use this shada file
  -m                    Modifications (writing files) not allowed
  -M                    Modifications in text not allowed
  -n                    No swap file, use memory only
  -o[N]                 Open N windows (default: one per file)
  -O[N]                 Open N vertical windows (default: one per file)
  -p[N]                 Open N tab pages (default: one per file)
  -r, -L                List swap files
  -r <file>             Recover edit state for this file
  -R                    Read-only mode
  -S <session>          Source <session> after loading the first file
  -s <scriptin>         Read Normal mode commands from <scriptin>
  -u <config>           Use this config file
  -v, --version         Print version information
  -V[N][file]           Verbose [level][file]

  --api-info            Write msgpack-encoded API metadata to stdout
  --embed               Use stdin/stdout as a msgpack-rpc channel
  --headless            Don't start a user interface
  --listen <address>    Serve RPC API from this address
  --noplugin            Don't load plugins
  --startuptime <file>  Write startup timing messages to <file>

See ":help startup-options" for all options.

Removal

Unmerge

root #emerge --ask --depclean --verbose app-editors/neovim

Issues

Needs Python

This is an issue that occurs when a plugin (such as the vim-latex-live-preview) requires Python to execute its function. To resolve this issue, try to build Neovim with the correct USE flag, for example by adding a line to a package.use file:

FILE /etc/portage/package.use/editors
app-editors/neovim python

Then rebuild the package:

root #emerge --ask app-editors/neovim

Want to contribute

Neovim is a community fork of Vim. Contribute here: Github: Neovim

See also

References

  1. XDG base directory specification support #3470 , GitHub. Retrieved on December 31, 2021