Home Explore Blog CI



neovim

4th chunk of `runtime/doc/tui.txt`
64706b38bff920069a828a5cab255ec790937115c091b616000000010000094f
 add constructed "setrgbf" and "setrgbb"
capabilities as if they had been in the terminfo definition.

If terminfo does not (yet) have this flag, Nvim will fall back to $TERM and
other environment variables.  It will add constructed "setrgbf" and "setrgbb"
capabilities in the case of the "rxvt", "linux", "st", "tmux", and "iterm"
terminal types, or when Konsole, genuine Xterm, a libvte terminal emulator
version 0.36 or later, or a terminal emulator that sets the COLORTERM
environment variable to "truecolor" is detected.

							*xterm-resize*
Nvim can resize the terminal display on some terminals that implement an
extension pioneered by dtterm.  |terminfo| does not have a flag for this
extension.  So Nvim simply assumes that (all) "dtterm", "xterm", "teraterm",
"rxvt" terminal types, and Konsole, are capable of this.

							*tui-cursor-shape*
Nvim will adjust the shape of the cursor from a block to a line when in insert
mode (or as specified by the 'guicursor' option), on terminals that support
it.  It uses the same |terminfo| extensions that were pioneered by tmux for
this: "Ss" and "Se".
Similarly, if you set the cursor highlight group with blend=100, Nvim hides
the cursor through the "cvvis" and "civis" extensions.

If your terminfo definition is missing them, then Nvim will decide whether to
add them to your terminfo definition, by looking at $TERM and other
environment variables.  For the "rxvt", "putty", "linux", "screen",
"teraterm", and "iterm" terminal types, or when Konsole, a libvte-based
terminal emulator, or genuine Xterm are detected, it will add constructed
"Ss" and "Se" capabilities.

							*tui-cursor-tmux*
Within tmux it may appear that Nvim is not changing the cursor, but in fact it
is tmux receiving instructions from Nvim to change the cursor and not knowing
what to do in turn.  tmux must translate what it receives from Nvim into
whatever control sequence is appropriate for the host terminal.  It shares
a common mechanism with Nvim, of using the "Ss" and "Se" capabilities from
terminfo (for the output terminal) if they are present. Unlike Nvim, if they
are not in terminfo you must add them by setting "terminal-overrides" in
~/.tmux.conf .

See the tmux(1) manual page for the details of how and what to do in the tmux
configuration file.  It will look something like: >bash
        set -ga terminal-overrides '*:Ss=\E[%p1%d

Title: Nvim Terminal UI: Color Capabilities, Terminal Resizing, and Cursor Shape Handling
Summary
Nvim enhances terminal color support by constructing 'setrgbf' and 'setrgbb' capabilities when the terminfo lacks the 'Tc' flag. It resorts to environment variables like $TERM for terminals like 'rxvt', 'linux', 'st', 'tmux', and 'iterm', or when Konsole, Xterm, or libvte are detected. Nvim resizes the terminal display on emulators like 'dtterm', 'xterm', 'teraterm', 'rxvt', and Konsole, assuming they support the dtterm extension. It also adjusts the cursor shape in insert mode using 'Ss' and 'Se' terminfo extensions, constructing them if missing, and addresses cursor visibility issues in tmux by advising users to configure 'terminal-overrides'.