*tui.txt* Nvim
NVIM REFERENCE MANUAL
Terminal UI *TUI* *tui*
By default when you run `nvim` (without |--embed| or |--headless|) it starts
the builtin "terminal UI" (TUI). This default UI is optional: you can run Nvim
as a "headless" server, or you can use a |GUI|.
Type |gO| to see the table of contents.
==============================================================================
Startup *startup-tui* *startup-terminal*
Nvim has a client-server architecture: by default when you run `nvim`, this
starts the builtin UI client, which starts a `nvim --embed` server (child)
process that the UI client connects to. After attaching to the server, the UI
client calls |nvim_set_client_info()| (as recommended for all UIs |dev-ui|)
and sets these fields on its channel: >
client = {
attributes = {
license = 'Apache 2',
pid = …,
website = 'https://neovim.io',
},
name = 'nvim-tui',
type = 'ui',
version = { … },
}
Nvim guesses the terminal type when it starts (except in |--embed| and
|--headless| modes). The |$TERM| environment variable is the primary hint that
determines the terminal type.
*terminfo* *E557* *E558* *E559*
To display its user interface, Nvim reads a list of "terminal capabilities"
from the system terminfo database (or builtin defaults if terminfo is not
found). If that information is wrong, the screen may be messed up or keys may
not be recognized.
The Unibilium library (used to read terminfo) allows you to override the
system terminfo with one in the "$HOME/.terminfo/" directory. Building your
own terminfo is usually as simple as running this:
>
curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz
gunzip terminfo.src.gz
tic -x terminfo.src
<
*$TERM*
The $TERM environment variable must match the terminal you are using!
Otherwise Nvim cannot know what sequences your terminal expects, and weird
or sub-optimal behavior will result (scrolling quirks, wrong colors, etc.).
$TERM is also important because it is forwarded by SSH to the remote session,
unlike most other environment variables.
>
For this terminal Set $TERM to |builtin-terms|
-------------------------------------------------------------------------
anything libvte-based vte, vte-256color Y
(e.g. GNOME Terminal) (aliases: gnome, gnome-256color)
iTerm (original) iterm, iTerm.app N
iTerm2 (new capabilities) iterm2, iTerm2.app Y
Konsole konsole-256color N
Linux virtual terminal linux, linux-256color Y
PuTTY putty, putty-256color Y
rxvt rxvt, rxvt-256color Y
screen screen, screen-256color Y
simple terminal (st) st, st-256color Y
Terminal.app nsterm N
tmux tmux, tmux-256color Y
Windows/ConEmu conemu Y
Windows/Cygwin-built Nvim cygwin Y
Windows/Interix interix Y
Windows/VTP console vtpcon Y
Windows/legacy console win32con Y
xterm or compatible xterm, xterm-256color Y
<
*builtin-terms* *builtin_terms*
If a |terminfo| database is not available or there is no entry for the current
terminal, Nvim will map |$TERM| to a builtin entry according to the above
table, or "ansi" if there is no match. For example "TERM=putty-256color" will
be mapped to the builtin "putty" entry. See also |tui-colors|.
The builtin terminfo is not combined with any external terminfo database, nor
can it be used in preference