Provider
Nvim:help
pages,generated fromsource using thetree-sitter-vimdoc parser.
Providers
Nvim delegates some features to dynamic "providers". This document describesthe providers and how to install them.
E319Use of a feature requiring a missing provider is an error:
E319: No "foo" provider found. Run ":checkhealth vim.provider"
Run the
:checkhealth command, and review the sections below.
Note: Only the Vim 7.3 legacy interface is supported, not later features suchas
python-bindeval (Vim 7.4); use the Nvim API instead. Python 2 is notsupported.
To use Python plugins, you need the "pynvim" module. Run
:checkhealth to seeif you already have it (some package managers install the module with Nvimitself).
For Python 3 plugins:1. Make sure Python 3.9+ is available in your $PATH.2. Install the module (try "python" if "python3" is missing):
python3 -m pip install --user --upgrade pynvim
The pip
--upgrade
flag ensures that you get the latest version even ifa previous version was already installed.
Note: The old "neovim" module was renamed to "pynvim".
https://github.com/neovim/neovim/wiki/Following-HEAD#20181118If you run into problems, uninstall _both_ then install "pynvim" again:
python -m pip uninstall neovim pynvimpython -m pip install --user --upgrade pynvim
PYTHON PROVIDER CONFIGURATION
g:python3_host_progCommand to start Python 3 (executable, not directory). Setting this makesstartup faster. Useful for working with virtualenvs. Must be set before anycheck for has("python3").
let g:python3_host_prog = '/path/to/python3'
g:loaded_python3_providerTo disable Python 3 support:
let g:loaded_python3_provider = 0
PYTHON VIRTUALENVS
python-virtualenvIf you plan to use per-project virtualenvs often, you should assign onevirtualenv for Nvim and hard-code the interpreter path via
g:python3_host_prog so that the "pynvim" package is not requiredfor each virtualenv.
Example using pyenv:
pyenv install 3.4.4pyenv virtualenv 3.4.4 py3nvimpyenv activate py3nvimpython3 -m pip install pynvimpyenv which python # Note the path
The last command reports the interpreter path, add it to your init.vim:
let g:python3_host_prog = '/path/to/py3nvim/bin/python'
See also:
https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-NeovimNvim supports Ruby
remote-plugins and the Vim legacy
ruby-vim interface(which is itself implemented as a Nvim remote-plugin).
To use Ruby plugins with Nvim, install the latest "neovim" RubyGem:
gem install neovim
Run
:checkhealth to see if your system is up-to-date.
g:ruby_host_progCommand to start the Ruby host. By default this is "neovim-ruby-host". Withproject-local Ruby versions (via tools like RVM or rbenv) setting this canavoid the need to install the "neovim" gem in every project.
To use an absolute path (e.g. to an rbenv installation):
let g:ruby_host_prog = '~/.rbenv/versions/2.4.1/bin/neovim-ruby-host'
To use the RVM "system" Ruby installation:
let g:ruby_host_prog = 'rvm system do neovim-ruby-host'
Note: Only perl versions from 5.22 onward are supported.
To use perl remote-plugins with Nvim, install the "Neovim::Ext" cpan package:
cpanm -n Neovim::Ext
Run
:checkhealth to see if your system is up-to-date.
g:perl_host_progCommand to start the Perl executable. Must be set before anycheck for has("perl").
let g:perl_host_prog = '/path/to/perl'
To use javascript remote-plugins with Nvim, install the "neovim" npm package:
npm install -g neovim
Run
:checkhealth to see if your system is up-to-date.
g:node_host_progCommand to start the Node.js host. Setting this makes startup faster.
By default, Nvim searches for "neovim-node-host" using "npm root -g", whichcan be slow. To avoid this, set g:node_host_prog to the host path:
let g:node_host_prog = '/usr/local/bin/neovim-node-host'
Nvim has no direct connection to the system clipboard. Instead it depends ona
provider which transparently uses shell commands to communicate with thesystem clipboard or any other clipboard "backend".
To ALWAYS use the clipboard for ALL operations (instead of interacting withthe "+" and/or "*" registers explicitly):
set clipboard+=unnamedplus
See
'clipboard' for details and options.
clipboard-toolThe presence of a working clipboard tool implicitly enables the "+" and "*"registers. Nvim supports these clipboard tools, in order of priority:
g:clipboard : User override (if set to a dict or any string "name" below; e.g.
g:clipboard="tmux"
forces tmux clipboard and skips auto-detection).
"pbcopy" : pbcopy, pbpaste (macOS)
"wl-copy" : wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
"wayclip" : waycopy, waypaste (if $WAYLAND_DISPLAY is set)
"xsel" : xsel (if $DISPLAY is set)
"xclip" : xclip (if $DISPLAY is set)
"termux" : termux (via termux-clipboard-set, termux-clipboard-set)
"tmux" : tmux (if $TMUX is set)
g:clipboardTo configure a custom clipboard tool, set
g:clipboard
to a string name (fromthe above
clipboard-tool list), or dict (to explicitly specify the shellcommands or
lambda functions).
If "cache_enabled" is
TRUE then when a selection is copied Nvim will cachethe selection until the copy command process dies. When pasting, if the copyprocess has not died the cached selection is applied.
The "copy" function stores a list of lines and the register type. The "paste"function returns the clipboard as a
[lines, regtype]
list, where
lines
isa list of lines and
regtype
is a register type conforming to
setreg().
Example: set to "osc52" to force OSC52, skipping auto-detection of terminalsupport:
let g:clipboard = 'osc52'
Example: set to "wayclip" to force waycopy/waypaste:
let g:clipboard = 'wayclip'
Example: set to a dict which integrates the tmux clipboard:
let g:clipboard = { \ 'name': 'myClipboard', \ 'copy': { \ '+': ['tmux', 'load-buffer', '-'], \ '*': ['tmux', 'load-buffer', '-'], \ }, \ 'paste': { \ '+': ['tmux', 'save-buffer', '-'], \ '*': ['tmux', 'save-buffer', '-'], \ }, \ 'cache_enabled': 1, \ }
Example: set to a dict which uses g:foo as a fake clipboard:
let g:clipboard = { \ 'name': 'myClipboard', \ 'copy': { \ '+': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) }, \ '*': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) }, \ }, \ 'paste': { \ '+': {-> get(g:, 'foo', [])}, \ '*': {-> get(g:, 'foo', [])}, \ }, \ }
clipboard-wslFor Windows WSL, try this g:clipboard definition:
let g:clipboard = { \ 'name': 'WslClipboard', \ 'copy': { \ '+': 'clip.exe', \ '*': 'clip.exe', \ }, \ 'paste': { \ '+': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', \ '*': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', \ }, \ 'cache_enabled': 0, \ }
clipboard-osc52Nvim bundles a clipboard provider that allows copying to the system clipboardusing OSC 52, an "Operating System Command" control-sequence that causes theterminal emulator to write to or read from the system clipboard.
When Nvim is running in the
TUI, it automatically detects host terminalsupport for OSC 52. If successful, then Nvim will use OSC 52 for copying andpasting if no other
clipboard-tool is found and when
'clipboard' is unset.
NOTE: Using a terminal multiplexer (e.g. tmux) may inhibit automatic OSC 52support detection.
g:termfeaturesTo disable the automatic detection, set the "osc52" key of
g:termfeatures tofalse early in your
config. Example:
local termfeatures = vim.g.termfeatures or {}termfeatures.osc52 = falsevim.g.termfeatures = termfeatures
To force Nvim to use the OSC 52 provider you can set
g:clipboard:
vim.g.clipboard = 'osc52'
Which is equivalent to:
vim.g.clipboard = { name = 'OSC 52', copy = { ['+'] = require('vim.ui.clipboard.osc52').copy('+'), ['*'] = require('vim.ui.clipboard.osc52').copy('*'), }, paste = { ['+'] = require('vim.ui.clipboard.osc52').paste('+'), ['*'] = require('vim.ui.clipboard.osc52').paste('*'), },}
Note: not all terminal emulators support reading from the system clipboard(and even for those that do, users should be aware of the securityimplications), so using OSC 52 for pasting may not be possible (and notnecessary, because you can
paste instead using your system paste function).Users may need to configure their terminal emulator to allow reading from theclipboard.
"Paste" is a separate concept from
clipboard: paste means "dump a bunch oftext to the editor", whereas clipboard provides features like
quote+ to getand set the OS clipboard directly. For example, middle-click or
CTRL-SHIFT-v
(macOS: CMD-v) in your terminal is "paste", not "clipboard": the terminalapplication (Nvim) just gets a stream of text, it does not interact with theclipboard directly.
Paste inserts text after the cursor. Lines break at<NL>
,<CR>
, and<CR>
<NL>
.When pasting a huge amount of text, screen-updates are throttled and themessage area shows a "..." pulse.
In cmdline-mode only the first line is pasted, to avoid accidentally executingmany commands. Use the
cmdline-window if you really want to paste multiplelines to the cmdline.
You can implement a custom paste handler by redefining
vim.paste().Example:
vim.paste = (function(lines, phase) vim.api.nvim_put(lines, 'c', true, true)end)
X11 clipboard providers store text in "selections". Selections are owned by anapplication, so when the application gets closed, the selection text is lost.The contents of selections are held by the originating application (e.g., upona copy), and only passed to another application when that other applicationrequests them (e.g., upon a paste).
There are three documented X11 selections: PRIMARY, SECONDARY, and CLIPBOARD.CLIPBOARD is typically used in X11 applications for copy/paste operations(CTRL-c/CTRL-v), while PRIMARY is used for the last selected text, which isgenerally inserted with the middle mouse button.
Nvim's X11 clipboard providers only use the PRIMARY and CLIPBOARD selections,for the "*" and "+" registers, respectively.