Various
Various
Various
==============================================================================
1. Various commands *various-cmds*
*CTRL-L*
CTRL-L Clear and redraw the screen. The redraw may happen
later, after processing typeahead.
*:redr* *:redraw*
:redr[aw][!] Redraw the screen right now. When ! is included it is
cleared first.
Useful to update the screen halfway executing a script
or function. Also when halfway a mapping and
'lazyredraw' is set.
*:redraws* *:redrawstatus*
:redraws[tatus][!] Redraw the status line of the current window. When !
is included all status lines are redrawn.
Useful to update the status line(s) when 'statusline'
includes an item that doesn't cause automatic
updating.
*:redrawt* *:redrawtabline*
:redrawt[abline] Redraw the tabline. Useful to update the tabline when
'tabline' includes an item that doesn't trigger
automatic updating.
*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>
< See |:fixdel| if your <Del> key does not do what you
want.
*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:
e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
*8g8*
8g8 Find an illegal UTF-8 byte sequence at or after the
cursor. This works in two situations:
1. when 'encoding' is any 8-bit encoding
2. when 'encoding' is "utf-8" and 'fileencoding' is
any 8-bit encoding
Thus it 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 a multi-byte character the command
won't move the cursor.
*:P* *:Print*
:[range]P[rint] [count] [flags]
Just as ":print". Was apparently added to Vi for
people that keep the shift key pressed too long...
Note: A user command can overrule this command.
See |ex-flags| for [flags].
*:l* *:list*
:[range]l[ist] [count] [flags]
Same as :print, but display unprintable characters
with '^' and put $ after the line. This can be
further changed with 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 'highlight' and 'numberwidth'
option).
See |ex-flags| for [flags].
*:#*
:[range]# [count] [flags]
synonym for :number.
*:#!*
:#!{anything} Ignored, so that you can start a Vim script with: >
#!vim -S
echo "this is a Vim script"
quit
<
*: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}. If there is a {count}, that's
how many lines you'll see; if there is only one window
then twice the value of the 'scroll' option is used,
otherwise the current window height minus 3 is used.
:{range}z#[+-^.=]{count} *:z#*
Like ":z", but number the lines.
*:=*
:= [flags] Print the last line number.
See |ex-flags| for [flags].
:{range}= [flags] Prints the last line number in {range}. For example,
this prints the current line number: >
:.=
< See |ex-flags| for [flags].
Example: >
:exe "normal \<c-w>\<c-w>"
*:!!*
:!! Repeat last ":!{cmd}".
*+feature-list*
*+acl* |ACL| support included
*+ARP* Amiga only: ARP support included
B *+arabic* |Arabic| language support
B *+autochdir* support 'autochdir' option
T *+autocmd* |:autocmd|, automatic commands
H *+autoservername* Automatically enable |clientserver|
m *+balloon_eval* |balloon-eval| support in the GUI. Included when
compiling with supported GUI (Motif, GTK, GUI) and
either Netbeans/Sun Workshop integration or |+eval|
feature.
H *+balloon_eval_term* |balloon-eval| support in the terminal,
'balloonevalterm'
N *+browse* |:browse| command
N *+builtin_terms* some terminals builtin |builtin-terms|
B *++builtin_terms* maximal terminals builtin |builtin-terms|
N *+byte_offset* support for 'o' flag in 'statusline' option, "go"
and ":goto" commands.
m *+channel* inter process communication |channel|
N *+cindent* |'cindent'|, C indenting
N *+clientserver* Unix and Win32: Remote invocation |clientserver|
*+clipboard* |clipboard| support compiled-in
*+clipboard_working* |clipboard| support compiled-in and working
T *+cmdline_compl* command line completion |cmdline-completion|
S *+cmdline_hist* command line history |cmdline-history|
N *+cmdline_info* |'showcmd'| and |'ruler'|
T *+comments* |'comments'| support
B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc.
N *+cryptv* encryption support |encryption|
B *+cscope* |cscope| support
T *+cursorbind* |'cursorbind'| support
m *+cursorshape* |termcap-cursor-shape| support
m *+debug* Compiled for debugging.
N *+dialog_gui* Support for |:confirm| with GUI dialog.
N *+dialog_con* Support for |:confirm| with console dialog.
N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
N *+diff* |vimdiff| and 'diff'
N *+digraphs* |digraphs| *E196*
*+directx* Win32 GUI only: DirectX and |'renderoptions'|
*+dnd* Support for DnD into the "~ register |quote_~|.
B *+emacs_tags* |emacs-tags| files
N *+eval* expression evaluation |eval.txt|
N *+ex_extra* always on now, used to be for Vim's extra Ex commands
N *+extra_search* |'hlsearch'| and |'incsearch'| options.
- *+farsi* Removed: |farsi| language
N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>|
N *+find_in_path* include file searches: |[I|, |:isearch|,
|CTRL-W_CTRL-I|, |:checkpath|, etc.
N *+folding* |folding|
*+footer* |gui-footer|
*+fork* Unix only: |fork| shell commands
*+float* Floating point support
N *+gettext* message translations |multi-lang|
*+GUI_Athena* Unix only: Athena |GUI|
*+GUI_neXtaw* Unix only: neXtaw |GUI|
*+GUI_GTK* Unix only: GTK+ |GUI|
*+GUI_Motif* Unix only: Motif |GUI|
*+GUI_Photon* QNX only: Photon |GUI|
m *+hangul_input* Hangul input support |hangul|
*+iconv* Compiled with the |iconv()| function
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
T *+insert_expand* |insert_expand| Insert mode completion
m *+ipv6* Support for IPv6 networking |channel|
m *+job* starting and stopping jobs |job|
S *+jumplist* |jumplist|
B *+keymap* |'keymap'|
N *+lambda* |lambda| and |closure|
B *+langmap* |'langmap'|
N *+libcall* |libcall()|
N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'|
N *+lispindent* |'lisp'|
T *+listcmds* Vim commands for the list of buffers |buffer-hidden|
and argument list |:argdelete|
T *+localmap* Support for mappings local to a buffer |:map-local|
m *+lua* |Lua| interface
m *+lua/dyn* |Lua| interface |/dyn|
N *+menu* |:menu|
N *+mksession* |:mksession|
T *+modify_fname* |filename-modifiers|
T *+mouse* Mouse handling |mouse-using|
N *+mouseshape* |'mouseshape'|
B *+mouse_dec* Unix only: Dec terminal mouse handling |dec-mouse|
N *+mouse_gpm* Unix only: Linux console mouse handling |gpm-mouse|
N *+mouse_jsbterm* JSB mouse handling |jsbterm-mouse|
B *+mouse_netterm* Unix only: netterm mouse handling |netterm-mouse|
N *+mouse_pterm* QNX only: pterm mouse handling |qnx-terminal|
N *+mouse_sysmouse* Unix only: *BSD console mouse handling |sysmouse|
B *+mouse_sgr* Unix only: sgr mouse handling |sgr-mouse|
B *+mouse_urxvt* Unix only: urxvt mouse handling |urxvt-mouse|
N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
N *+multi_byte* 16 and 32 bit characters |multibyte|
*+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
N *+multi_lang* non-English language support |multi-lang|
m *+mzscheme* Mzscheme interface |mzscheme|
m *+mzscheme/dyn* Mzscheme interface |mzscheme-dynamic| |/dyn|
m *+netbeans_intg* |netbeans|
*+num64* 64-bit Number support |Number|
Always enabled since 8.2.0271, use v:numbersize to
check the actual size of a Number.
m *+ole* Win32 GUI only: |ole-interface|
N *+packages* Loading |packages|
N *+path_extra* Up/downwards search in 'path' and 'tags'
m *+perl* Perl interface |perl|
m *+perl/dyn* Perl interface |perl-dynamic| |/dyn|
N *+persistent_undo* Persistent undo |undo-persistence|
N *+popupwin* Popup windows |popup-window|
*+postscript* |:hardcopy| writes a PostScript file
N *+printer* |:hardcopy| command
H *+profile* |:profile| command
m *+python* Python 2 interface |python|
m *+python/dyn* Python 2 interface |python-dynamic| |/dyn|
m *+python3* Python 3 interface |python|
m *+python3/dyn* Python 3 interface |python-dynamic| |/dyn|
N *+quickfix* |:make| and |quickfix| commands
N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout,
'redrawtime' option
B *+rightleft* Right to left typing |'rightleft'|
m *+ruby* Ruby interface |ruby|
m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn|
T *+scrollbind* |'scrollbind'|
B *+signs* |:sign|
N *+smartindent* |'smartindent'|
B *+sound* |sound_playevent()|, |sound_playfile()| functions, etc.
N *+spell* spell checking support, see |spell|
N *+startuptime* |--startuptime| argument
N *+statusline* Options 'statusline', 'rulerformat' and special
formats of 'titlestring' and 'iconstring'
- *+sun_workshop* Removed: |workshop|
N *+syntax* Syntax highlighting |syntax|
*+system()* Unix only: opposite of |+fork|
T *+tag_binary* binary searching in tags file |tag-binary-search|
- *+tag_old_static* Removed; method for static tags |tag-old-static|
- *+tag_any_white* Removed; was to allow any white space in tags files
m *+tcl* Tcl interface |tcl|
m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
m *+terminal* Support for terminal window |terminal|
*+terminfo* uses |terminfo| instead of termcap
N *+termresponse* support for |t_RV| and |v:termresponse|
B *+termguicolors* 24-bit color in xterm-compatible terminals support
N *+textobjects* |text-objects| selection
N *+textprop* |text-properties|
*+tgetent* non-Unix only: able to use external termcap
N *+timers* the |timer_start()| function
N *+title* Setting the window 'title' and 'icon'
N *+toolbar* |gui-toolbar|
T *+user_commands* User-defined commands. |user-commands|
Always enabled since 8.1.1210.
B *+vartabs* Variable-width tabstops. |'vartabstop'|
N *+viminfo* |'viminfo'|
*+vertsplit* Vertically split windows |:vsplit|; Always enabled
since 8.0.1118.
N *+virtualedit* |'virtualedit'|
T *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
T *+visualextra* extra Visual mode commands |blockwise-operators|
T *+vreplace* |gR| and |gr|
*+vtp* on MS-Windows console: support for 'termguicolors'
N *+wildignore* |'wildignore'|
N *+wildmenu* |'wildmenu'|
T *+windows* more than one window; Always enabled since 8.0.1118.
m *+writebackup* |'writebackup'| is default on
m *+xim* X input method |xim|
*+xfontset* X fontset support |xfontset|
*+xpm* pixmap support
m *+xpm_w32* Win32 GUI only: pixmap support |w32-xpm-support|
*+xsmp* XSMP (X session management) support
*+xsmp_interact* interactive XSMP (X session management) support
N *+xterm_clipboard* Unix only: xterm clipboard handling
m *+xterm_save* save and restore xterm screen |xterm-screens|
N *+X11* Unix only: can restore window title |X11|
:ve[rsion] {nr} Is now ignored. This was previously used to check the
version number of a .vimrc file. It was removed,
because you can now use the ":if" command for
version-dependent behavior.
*: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.
:redi[r] @{a-zA-Z}
:redi[r] @{a-zA-Z}> Redirect messages to register {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}.
:redi[r] @*>
:redi[r] @+> Redirect messages to the selection or clipboard. For
backward compatibility, the ">" after the register
name can be omitted. See |quotestar| and |quoteplus|.
:redi[r] @*>>
:redi[r] @+>> Append messages to the selection or clipboard.
:redi[r] @"> Redirect messages to the unnamed register. For
backward compatibility, the ">" after the register
name can be omitted.
:redi[r] @">> Append messages to the unnamed register.
*:filt* *:filter*
:filt[er][!] {pat} {command}
:filt[er][!] /{pat}/ {command}
Restrict the output of {command} to lines matching
with {pat}. For example, to list only xml files: >
:filter /\.xml$/ oldfiles
< If the [!] is given, restrict the output of {command}
to lines that do NOT match {pat}.
*: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
< When concatenating another command, the ":verbose"
only applies to the first one: >
:4verbose set verbose | set verbose
< verbose=4 ~
verbose=0 ~
For logging verbose messages in a file use the
'verbosefile' option.
*: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 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.
{not available when compiled without the |+eval| feature}
*K*
K Run a program to lookup the keyword under the
cursor. The name of the program is given with the
'keywordprg' (kp) option (default is "man"). The
keyword is formed of letters, numbers and the
characters in 'iskeyword'. The keyword under or
right of the cursor is used. The same can be done
with the command >
:!{program} {keyword}
< There is an example of a program to use in the tools
directory of Vim. It is called "ref" and does a
simple spelling check.
Special cases:
- If 'keywordprg' begins with ":" it is invoked as
a Vim Ex command with [count].
- If 'keywordprg' is empty, the ":help" command is
used. It's a good idea to include more characters
in 'iskeyword' then, to be able to find more help.
- When 'keywordprg' is equal to "man" or starts with
":", a [count] before "K" is inserted after
keywordprg and before the keyword. For example,
using "2K" while the cursor is on "mkdir", results
in: >
!man 2 mkdir
< - When 'keywordprg' is equal to "man -s", a count
before "K" is inserted after the "-s". If there is
no count, the "-s" is removed.
*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.
*:xrestore* *:xr*
:xr[estore] [display] Reinitializes the connection to the X11 server. Useful
after the X server restarts, e.g. when running Vim for
long time inside screen/tmux and connecting from
different machines.
[display] should be in the format of the $DISPLAY
environment variable (e.g. "localhost:10.0")
If [display] is omitted, then it reinitializes the
connection to the X11 server using the same value as
was used for the previous execution of this command.
If the value was never specified, then it uses the
value of $DISPLAY environment variable as it was when
Vim was started.
{only available when compiled with the |+clipboard|
feature}
*g_CTRL-A*
g CTRL-A Only when Vim was compiled with MEM_PROFILING defined
(which is very rare): print memory usage statistics.
Only useful for debugging Vim.
For incrementing in Visual mode see |v_g_CTRL-A|.
==============================================================================
2. Using Vim like less or more *less*
If you use the less or more program to view a file, you don't get syntax
highlighting. Thus you would like to use Vim instead. You can do this by
using the shell script "$VIMRUNTIME/macros/less.sh".
This isn't perfect. For example, when viewing a short file Vim will still use
the whole screen. But it works good enough for most uses, and you get syntax
highlighting.
The "h" key will give you a short overview of the available commands.
If you want to set options differently when using less, define the
LessInitFunc in your vimrc, for example: >
func LessInitFunc()
set nocursorcolumn nocursorline
endfunc
<
vim:tw=78:ts=8:noet:ft=help:norl: