Nvim :help
pages, generated
from source
using the tree-sitter-vimdoc parser.
CTRL-L
CTRL-L Clears and redraws the screen. The redraw may happen
later, after processing typeahead.
See also nvim__redraw().
CTRL-L-default
By default, also clears search highlighting
:nohlsearch and updates diffs :diffupdate.
default-mappings:redr
:redraw
:redr[aw][!] Redraws pending screen updates now, or the entire
screen if "!" is included. To CLEAR the screen use
:mode or CTRL-L.
It can be used to redraw the screen in a script
or function (or a mapping if 'lazyredraw' is set).
See also nvim__redraw().:redraws
:redrawstatus
:redraws[tatus][!] Redraws the status line and window bar of the current
window, or all status lines and window bars if "!" is
included. Redraws the commandline instead if it contains
the 'ruler'. Useful if 'statusline' or 'winbar' includes
an item that doesn't cause automatic updating.
See also nvim__redraw().:redrawt
:redrawtabline
:redrawt[abline] Redraw the tabline. Useful to update the tabline when
'tabline' includes an item that doesn't trigger
automatic updating. See also nvim__redraw().N<Del>
<Del>
When entering a number: Remove the last digit.
Note: if you like to use <BS>
for this, add this
mapping to your vimrc::map CTRL-V <BS> CTRL-V <Del>
ga
:as
:ascii
ga Print the ascii value of the character under the
cursor in decimal, hexadecimal and octal.
Mnemonic: Get Ascii value.<R>
82, Hex 52, Octal 122<M-x>
form
is also printed. For example:
<p>
<|~> <M-~>
254, Hex fe, Octal 376<p>
is a special character)<Nul>
character in a file is stored internally as
<NL>
, but it will be shown as:
CTRL-K
o : to insert ö.g8
g8 Print the hex values of the bytes used in the
character under the cursor, assuming it is in UTF-8
encoding. This also shows composing characters. The
value of 'maxcombine' doesn't matter.
Example of a character with two composing characters:
8g8
8g8 Find an illegal UTF-8 byte sequence at or after the
cursor.
Can be used when editing a file that was supposed to
be UTF-8 but was read as if it is an 8-bit encoding
because it contains illegal bytes.
Does not wrap around the end of the file.
Note that when the cursor is on an illegal byte or the
cursor is halfway through a multibyte character the
command won't move the cursor.gx
gx Opens the current filepath or URL (decided by
<cfile>, 'isfname') at cursor using the system
default handler, by calling vim.ui.open().:p
:pr
:print
E749
:[range]p[rint] [flags]
Print [range] lines (default current line).
In the GUI you can use the File.Print menu entry.
See ex-flags for [flags].
The :filter command can be used to only show lines
matching a pattern.{count}
[flags]
Print {count}
lines, starting with [range] (default
current line cmdline-ranges).
See ex-flags for [flags].:l
:list
:[range]l[ist] [count] [flags]
Same as :print, but show tabs as ">", trailing spaces
as "-", and non-breakable space characters as "+" by
default. Further changed by the 'listchars' option.
See ex-flags for [flags].:nu
:number
:[range]nu[mber] [count] [flags]
Same as :print, but precede each line with its line
number. (See also hl-LineNr and 'numberwidth').
See ex-flags for [flags].:#
:[range]# [count] [flags]
synonym for :number.:#!
vim-shebang
:#!{anything} Ignored, so that you can start a Vim script with:#!vim -S let mylogbook='$HOME/logbook.md' exe $':e {mylogbook}' $ put ='## ' .. strftime('%d. %b %Y') norm! o
:z
E144
:[range]z[+-^.=][count] Display several lines of text surrounding the line
specified with [range], or around the current line
if there is no [range].:z!
:[range]z![+-^.=][count]
Like ":z", but when [count] is not specified, it
defaults to the Vim window height minus one.:z#
Like ":z" or ":z!", but number the lines.:=
:= [args] Without [args]: prints the last line number.
With [args]: equivalent to :lua ={expr}
. see :lua{range}
. For example,
this prints the current line number::.=:norm[al][!]
{commands}
:norm
:normal
Execute Normal mode commands {commands}
. This makes
it possible to execute Normal mode commands typed on
the command-line. {commands}
are executed like they
are typed. For undo all commands are undone together.
Execution stops when an error is encountered.{commands}
should be a complete command. If
{commands}
does not finish a command, the last one
will be aborted as if <Esc>
or <C-C>
was typed.
This implies that an insert command must be completed
(to start Insert mode, see :startinsert). A ":"
command must be completed as well. And you can't use
"gQ" to start Ex mode.{commands}
cannot start with a space. Put a count of
1 (one) before it, "1 " is one space.:exe "normal \<c-w>\<c-w>"
{commands}
:normal-range
Execute Normal mode commands {commands}
for each line
in the {range}
. Before executing the {commands}
, the
cursor is positioned in the first column of the range,
for each line. Otherwise it's the same as the
":normal" command without a range.:terminal
:te
:te[rminal][!] [{cmd}
] Run {cmd}
in a non-interactive 'shell' in a new
terminal-emulator buffer. Without {cmd}
, start an
interactive 'shell'.<C-\>
<C-N>
to
leave Terminal-mode. CTRL-\_CTRL-N. Type <C-\>
<C-O>
to execute a single normal mode command t_CTRL-\_CTRL-O{cmd}
is omitted, and the 'shell' job exits with no
error, the buffer is closed automatically
default-autocmds.autocmd TermOpen * startinsert
:call jobstart('foo', {'detach':1})
:!Write-Output "1`n2" | & "C:\Windows\System32\sort.exe" /r
E34
Any "!" in {cmd}
is replaced with the previous
external command (see also 'cpoptions'), unless
escaped by a backslash. Example: ":!ls" followed by
":!echo ! \! \\!" executes "echo ls ! \!".{cmd}
is passed to the shell, you cannot
use it to append a Vim command. See :bar.{cmd}
is expanded to the current file name.
Any "#" in {cmd}
is expanded to the alternate file name.
Special characters are not escaped, use quotes or
shellescape()::!ls "%" :exe "!ls " .. shellescape(expand("%"))
{cmd}
unless a backslash
precedes the newline. What follows is interpreted as
another : command.:silent !{cmd}
:!!
:!! Repeat last ":!{cmd}".:redi
:redir
:redi[r][!] > {file}
Redirect messages to file {file}
. The messages which
are the output of commands are written to that file,
until redirection ends. The messages are also still
shown on the screen. When [!] is included, an
existing file is overwritten. When [!] is omitted,
and {file}
exists, this command fails.{file}
Redirect messages to file {file}
. Append if {file}
already exists.{a-z}
. Append to the
contents of the register if its name is given
uppercase {A-Z}
. The ">" after the register name is
optional.
:redi[r] @{a-z}>> Append messages to register {a-z}
.{var}
Redirect messages to a variable. If the variable
doesn't exist, then it is created. If the variable
exists, then it is initialized to an empty string.
The variable will remain empty until redirection ends.
Only string variables can be used. After the
redirection starts, if the variable is removed or
locked or the variable type is changed, then further
command output messages will cause errors. When using
a local variable (l:var in a function or s:var in a
script) and another :redir
causes the current one to
end, the scope might be different and the assignment
fails.
To get the output of one command the execute()
function can be used instead of redirection.{var}
Append messages to an existing variable. Only string
variables can be used.:filt
:filter
:filt[er][!] {pattern}
{command}
:filt[er][!] /{pattern}/ {command}
Restrict the output of {command}
to lines matching
with {pattern}
. For example, to list only xml files::filter /\.xml$/ oldfiles
{command}
to lines that do NOT match {pattern}
.{pattern}
is a Vim search pattern. Instead of enclosing
it in / any non-ID character (see 'isident') can be
used, so long as it does not appear in {pattern}
.
Without the enclosing character the pattern cannot
include the bar character. 'ignorecase' is not used.:sil
:silent
:silent!
:sil[ent][!] {command}
Execute {command}
silently. Normal messages will not
be given or added to the message history.
When [!] is added, error messages will also be
skipped, and commands and mappings will not be aborted
when an error is detected. v:errmsg is still set.
When [!] is not used, an error message will cause
further messages to be displayed normally.
Redirection, started with :redir, will continue as
usual, although there might be small differences.
This will allow redirecting the output of a command
without seeing it on the screen. Example::redir >/tmp/foobar :silent g/Aap/p :redir END
:silent exe "normal /path\<CR>"
:let v:errmsg = "" :silent! /^begin :if v:errmsg != "" : ... pattern was not found
:uns
:unsilent
:uns[ilent] {command}
Execute {command}
not silently. Only makes a
difference when :silent was used to get to this
command.
Use this for giving a message even when :silent was
used. In this example :silent is used to avoid the
message about reading the file and :unsilent to be
able to list the first line of each file.:silent argdo unsilent echo expand('%') .. ": " .. getline(1)
:verb
:verbose
:[count]verb[ose] {command}
Execute {command}
with 'verbose' set to [count]. If
[count] is omitted one is used. ":0verbose" can be
used to set 'verbose' to zero.
The additional use of ":silent" makes messages
generated but not displayed.
The combination of ":silent" and ":verbose" can be
used to generate messages and check them with
v:statusmsg and friends. For example::let v:statusmsg = "" :silent verbose runtime foobar.vim :if v:statusmsg != "" : " foobar.vim could not be found :endif
:4verbose set verbose | set verbose
:verbose-cmd
When 'verbose' is non-zero, listing the value of a Vim option or a key map or
an abbreviation or a user-defined function or a command or a highlight group
or an autocommand will also display where it was last defined. If they were
defined in Lua they will only be located if 'verbose' is set. So Start
nvim with -V1 arg to see them. If it was defined manually then there
will be no "Last set" message. When it was defined while executing a function,
user command or autocommand, the script in which it was defined is reported.K
[count]K Runs the program given by 'keywordprg' to lookup the
word (defined by 'iskeyword') under or right of the
cursor. Default is "man". Works like this::tabnew | terminal {program} {keyword}
!man 2 mkdir
K-lsp-default
v_K
{Visual}
K Like "K", but use the visually highlighted text for
the keyword. Only works when the highlighted text is
not more than one line.gO
gO Show a filetype-specific, navigable "outline" of the
current buffer. For example, in a help buffer this
shows the table of contents.gs
:sl
:sleep
:[N]sl[eep] [N][m] Do nothing for [N] seconds, or [N] milliseconds if [m]
was given. "gs" always uses seconds.
Default is one second.:sleep "sleep for one second :5sleep "sleep for five seconds :sleep 100m "sleep for 100 milliseconds 10gs "sleep for ten seconds
CTRL-C
.
"gs" stands for "goto sleep".
While sleeping the cursor is positioned in the text,
if at a visible position.
Queued messages are processed during the sleep.:sl!
:sleep!
:[N]sl[eep]! [N][m] Same as above. Unlike Vim, it does not hide the
cursor. vim-differencesfunc LessInitFunc() set nocursorcolumn nocursorline endfunc
/*foo*/
is transformed to foo
).
foo
is
transformed to /*foo*/
). Blank lines are ignored.
/**/
). Comment markers are aligned to
the least indented line.
gcc
gcc-default
gcc Comment or uncomment [count] lines starting at cursor.o_gc
o_gc-default
gc Text object for the largest contiguous block of
non-blank commented lines around the cursor (e.g.
gcgc
uncomments a comment block; dgc
deletes it).
Works only in Operator-pending mode.