Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/faq.txt`
5ee2370a54d84a1511f51a121b5aba45de117c9f7b453c690000000100000fa1
 style control codes. #2537
  https://github.com/neovim/neovim/issues/2537


HOW TO CHANGE CURSOR COLOR IN THE TERMINAL? ~

Cursor styling (shape, color, behavior) is controlled by 'guicursor', even in
the terminal. Cursor color (as opposed to shape) only works if
'termguicolors' is set.

'guicursor' gives an example, but here's a more complicated example
which sets different colors in insert-mode and normal-mode:
>vim
    :set termguicolors
    :hi Cursor guifg=green guibg=green
    :hi Cursor2 guifg=red guibg=red
    :set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor50
<

CURSOR STYLE ISN'T RESTORED AFTER EXITING OR SUSPENDING AND RESUMING NVIM ~

Terminals do not provide a way to query the cursor style. Use autocommands to
manage the cursor style:
>vim
    au VimEnter,VimResume * set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
      \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
      \,sm:block-blinkwait175-blinkoff150-blinkon175

    au VimLeave,VimSuspend * set guicursor=a:block-blinkon0
<

CURSOR SHAPE DOESN'T CHANGE IN TMUX ~

tmux decides that, not Nvim. See |tui-cursor-shape| for a fix.

See #3165 https://github.com/neovim/neovim/pull/3165 for discussion.


CURSOR FLICKER IN TMUX? ~

If cursor `_` appears and disappears very quickly when opening nvim without a
document under tmux, and you set |ctermbg| in `EndOfBuffer` and `Normal`, try
setting these to `NONE`:
>vim
    hi EndOfBuffer ctermbg=NONE ctermfg=200 cterm=NONE
    hi Normal ctermbg=NONE ctermfg=200 cterm=NONE
<

WHAT HAPPENED TO --remote AND FRIENDS? ~

|--remote| is partly supported. |clientserver|

If you require flags from Vim that are missing in Nvim, you can use
https://github.com/mhinz/neovim-remote instead.

==============================================================================
Runtime issues                                                *faq-runtime*


COPYING TO X11 PRIMARY SELECTION WITH THE MOUSE DOESN'T WORK ~

`clipboard=autoselect` is not implemented yet
https://github.com/neovim/neovim/issues/2325. You may find this workaround to
be useful:
>vim
    vnoremap <LeftRelease> "*ygv
    vnoremap <2-LeftRelease> "*ygv
<

MY CTRL-H MAPPING DOESN'T WORK ~

This was fixed in Nvim 0.2. If you are running Nvim 0.1.7 or older,
adjust your terminal's "kbs" (key_backspace) terminfo entry:
>vim
    infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
    tic $TERM.ti
<
(Feel free to delete the temporary `*.ti` file created after running the above
commands).


<HOME> OR SOME OTHER "SPECIAL" KEY DOESN'T WORK ~

Make sure |$TERM| is set correctly.

- For screen or tmux, `$TERM` should be `screen-256color` (not `xterm-256color`!)
- In other cases if "256" does not appear in the string it's probably wrong.
  Try `TERM=xterm-256color`.


:! AND SYSTEM() DO WEIRD THINGS WITH INTERACTIVE PROCESSES ~

Interactive commands are supported by |:terminal| in Nvim. But |:!| and
|system()| do not support interactive commands, primarily because Nvim UIs use
stdio for msgpack communication, but also for performance, reliability, and
consistency across platforms (see
https://vimhelp.org/gui_x11.txt.html#gui-pty).

See also #1496 https://github.com/neovim/neovim/issues/1496 and #8217
https://github.com/neovim/neovim/issues/8217#issuecomment-402152307.


PYTHON SUPPORT ISN'T WORKING ~

Run |:checkhealth| in Nvim for automatic diagnosis.

Other hints:

- The python `neovim` module was renamed to `pynvim` (long ago).
- If you're using pyenv or virtualenv for the `pynvim` module
    https://pypi.org/project/pynvim/, you must set `g:python3_host_prog` to
    the virtualenv's interpreter path.
- Read |provider-python|.
- Be sure you have the latest version of the `pynvim` Python module: >bash

    python -m pip install setuptools
    python -m pip install --upgrade pynvim
    python3 -m pip install --upgrade pynvim
<
- Try with `nvim -u NORC` to make sure your config (|init.vim|) isn't causing a
    problem. If you

Title: Neovim FAQ: Cursor Styling, Tmux, Remote, and Runtime Issues
Summary
This section of the Neovim FAQ covers several topics: Changing cursor color, restoring cursor style after exiting or suspending Neovim, cursor issues in tmux, the status of --remote and related commands, and runtime issues like clipboard integration, Ctrl-H mapping problems, special key issues, interactive processes with :! and system(), and troubleshooting Python support.