1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-18 07:47:09 +01:00
vim/runtime/doc/various.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

823 lines
32 KiB
Text
Raw Normal View History

*various.txt* For Vim version 9.1. Last change: 2024 Dec 16
2004-06-13 20:20:40 +00:00
VIM REFERENCE MANUAL by Bram Moolenaar
Various commands *various*
1. Various commands |various-cmds|
2. Using Vim like less or more |less|
2004-06-13 20:20:40 +00:00
==============================================================================
1. Various commands *various-cmds*
*CTRL-L*
2005-06-22 22:35:10 +00:00
CTRL-L Clear and redraw the screen. The redraw may happen
later, after processing typeahead.
2004-06-13 20:20:40 +00:00
*:redr* *:redraw*
:redr[aw][!] Redraw the screen right now. When ! is included it is
cleared first.
It can be used to redraw the screen in a script
or function (or a mapping if |'lazyredraw'| is set).
2004-06-13 20:20:40 +00:00
*: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.
2022-09-27 17:30:34 +01:00
If the command line is being edited the redraw is
postponed until later.
2004-06-13 20:20:40 +00:00
*:redrawt* *:redrawtabline*
:redrawt[abline] Redraw the tabline. Useful to update the tabline when
'tabline' includes an item that doesn't trigger
automatic updating.
2004-06-13 20:20:40 +00:00
*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.
:as[cii] or *ga* *:as* *:ascii*
ga Print the ascii value of the character under the
cursor in decimal, hexadecimal and octal.
Mnemonic: Get Ascii value.
For example, when the cursor is on a 'R':
2004-06-13 20:20:40 +00:00
<R> 82, Hex 52, Octal 122 ~
When the character is a non-standard ASCII character,
but printable according to the 'isprint' option, the
non-printable version is also given.
2019-12-07 16:03:51 +01:00
When the character is larger than 127, the <M-x> form
is also printed. For example:
2004-06-13 20:20:40 +00:00
<~A> <M-^A> 129, Hex 81, Octal 201 ~
<p> <|~> <M-~> 254, Hex fe, Octal 376 ~
(where <p> is a special character)
2004-06-13 20:20:40 +00:00
The <Nul> character in a file is stored internally as
<NL>, but it will be shown as:
<^@> 0, Hex 00, Octal 000 ~
2006-03-06 23:29:24 +00:00
If the character has composing characters these are
also shown. The value of 'maxcombine' doesn't matter.
If the character can be inserted as a digraph, also
output the two characters that can be used to create
the character:
<ö> 246, Hex 00f6, Oct 366, Digr o: ~
This shows you can type CTRL-K o : to insert ö.
2004-06-13 20:20:40 +00:00
*g8*
g8 Print the hex values of the bytes used in the
character under the cursor, assuming it is in |UTF-8|
2006-03-06 23:29:24 +00:00
encoding. This also shows composing characters. The
value of 'maxcombine' doesn't matter.
Example of a character with two composing characters:
2004-06-13 20:20:40 +00:00
e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
2006-03-17 23:19:38 +00:00
*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
2020-08-30 17:20:20 +02:00
cursor is halfway a multibyte character the command
2006-03-17 23:19:38 +00:00
won't move the cursor.
2004-06-13 20:20:40 +00:00
2006-04-25 22:13:59 +00:00
*:p* *:pr* *:print* *E749*
2005-02-22 08:56:13 +00:00
:[range]p[rint] [flags]
Print [range] lines (default current line).
2004-06-13 20:20:40 +00:00
Note: If you are looking for a way to print your text
2005-02-22 08:56:13 +00:00
on paper see |:hardcopy|. 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.
2004-06-13 20:20:40 +00:00
2005-02-22 08:56:13 +00:00
:[range]p[rint] {count} [flags]
2004-06-13 20:20:40 +00:00
Print {count} lines, starting with [range] (default
current line |cmdline-ranges|).
2005-02-22 08:56:13 +00:00
See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
*:P* *:Print*
2005-02-22 08:56:13 +00:00
:[range]P[rint] [count] [flags]
2004-06-13 20:20:40 +00:00
Just as ":print". Was apparently added to Vi for
people that keep the shift key pressed too long...
2022-03-08 21:35:07 +00:00
This command is not supported in |Vim9| script.
2010-11-16 20:34:40 +01:00
Note: A user command can overrule this command.
2005-02-22 08:56:13 +00:00
See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
*:l* *:list*
2005-02-22 08:56:13 +00:00
:[range]l[ist] [count] [flags]
2004-06-13 20:20:40 +00:00
Same as :print, but display unprintable characters
2010-08-01 16:13:51 +02:00
with '^' and put $ after the line. This can be
further changed with the 'listchars' option.
2005-02-22 08:56:13 +00:00
See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
*:nu* *:number*
2005-02-22 08:56:13 +00:00
:[range]nu[mber] [count] [flags]
2004-06-13 20:20:40 +00:00
Same as :print, but precede each line with its line
2006-02-20 21:37:40 +00:00
number. (See also 'highlight' and 'numberwidth'
option).
2005-02-22 08:56:13 +00:00
See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
*:#*
2005-02-22 08:56:13 +00:00
:[range]# [count] [flags]
synonym for :number.
2004-06-13 20:20:40 +00:00
*:#!* *vim-shebang*
2007-05-05 18:24:42 +00:00
:#!{anything} Ignored, so that you can start a Vim script with: >
2008-06-24 22:58:06 +00:00
#!vim -S
let mylogbook='$HOME/logbook.md'
exe $':e {mylogbook}'
$
put ='## ' .. strftime('%d. %b %Y')
norm! o
2007-05-05 18:24:42 +00:00
<
Make that script executable and run it to create a
new diary entry.
2004-06-13 20:20:40 +00:00
*:z* *E144*
2020-11-21 13:16:30 +01:00
:[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 no [count] and only one window then
twice the value of the 'scroll' option is used,
otherwise the current window height minus 3 is used.
This is the value of "scr" in the table below.
If there is a [count] the 'window' option is set to
2011-12-30 13:11:27 +01:00
its value.
2004-06-13 20:20:40 +00:00
:z can be used either alone or followed by any of
2020-08-30 17:20:20 +02:00
several marks. These have the following effect:
2004-06-13 20:20:40 +00:00
2011-03-22 14:05:35 +01:00
mark first line last line new cursor line ~
2004-06-13 20:20:40 +00:00
---- ---------- --------- ------------
+ current line 1 scr forward 1 scr forward
- 1 scr back current line current line
^ 2 scr back 1 scr back 1 scr back
2005-02-05 21:43:56 +00:00
. 1/2 scr back 1/2 scr fwd 1/2 scr fwd
= 1/2 scr back 1/2 scr fwd current line
2004-06-13 20:20:40 +00:00
Specifying no mark at all is the same as "+".
If the mark is "=", a line of dashes is printed
around the current line.
2021-09-09 21:55:11 +02:00
*:z!*
:[range]z![+-^.=][count]
2021-10-16 15:23:36 +01:00
Like ":z", but when [count] is not specified, it
defaults to the Vim window height minus one.
:[range]z[!]#[+-^.=][count] *:z#*
Like ":z" or ":z!", but number the lines.
2004-06-13 20:20:40 +00:00
*:=*
2005-02-22 08:56:13 +00:00
:= [flags] Print the last line number.
See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
2005-02-22 08:56:13 +00:00
:{range}= [flags] Prints the last line number in {range}. For example,
2004-06-13 20:20:40 +00:00
this prints the current line number: >
:.=
2005-02-22 08:56:13 +00:00
< See |ex-flags| for [flags].
2004-06-13 20:20:40 +00:00
:norm[al][!] {commands} *:norm* *:normal*
Execute Normal mode commands {commands}. This makes
it possible to execute Normal mode commands typed on
2010-09-30 21:47:56 +02:00
the command-line. {commands} are executed like they
are typed. For undo all commands are undone together.
2007-05-05 18:24:42 +00:00
Execution stops when an error is encountered.
2013-01-30 14:18:00 +01:00
2004-06-13 20:20:40 +00:00
If the [!] is given, mappings will not be used.
2013-01-30 14:18:00 +01:00
Without it, when this command is called from a
non-remappable mapping (|:noremap|), the argument can
be mapped anyway.
2004-06-13 20:20:40 +00:00
{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 ":"
2005-02-07 22:01:03 +00:00
command must be completed as well. And you can't use
"Q" or "gQ" to start Ex mode.
2013-01-30 14:18:00 +01:00
The display is not updated while ":normal" is busy.
2010-01-06 20:52:26 +01:00
{commands} cannot start with a space. Put a count of
1 (one) before it, "1 " is one space.
2013-01-30 14:18:00 +01:00
2004-06-13 20:20:40 +00:00
The 'insertmode' option is ignored for {commands}.
2013-01-30 14:18:00 +01:00
2004-06-13 20:20:40 +00:00
This command cannot be followed by another command,
since any '|' is considered part of the command.
2013-01-30 14:18:00 +01:00
2004-06-13 20:20:40 +00:00
This command can be used recursively, but the depth is
limited by 'maxmapdepth'.
2013-01-30 14:18:00 +01:00
2004-06-13 20:20:40 +00:00
An alternative is to use |:execute|, which uses an
expression as argument. This allows the use of
2010-06-12 20:18:19 +02:00
printable characters to represent special characters.
2013-01-30 14:18:00 +01:00
2010-06-12 20:18:19 +02:00
Example: >
2004-06-13 20:20:40 +00:00
:exe "normal \<c-w>\<c-w>"
:{range}norm[al][!] {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.
*:sh* *:shell* *E371*
:sh[ell] This command starts a shell. When the shell exits
(after the "exit" command) you return to Vim. The
name for the shell command comes from 'shell' option.
*E360*
Note: This doesn't work when Vim on the Amiga was
started in QuickFix mode from a compiler, because the
compiler will have set stdin to a non-interactive
mode.
2022-01-08 21:51:59 +00:00
*:!cmd* *:!*
2004-06-13 20:20:40 +00:00
:!{cmd} Execute {cmd} with the shell. See also the 'shell'
and 'shelltype' option. For the filter command, see
|:range!|.
Vim builds command line using options 'shell', 'shcf',
'sxq' and 'shq' in the following order:
`&sh &shcf &sxq &shq {cmd} &shq &sxq`
So setting both 'sxq' and 'shq' is possible but rarely
useful. Additional escaping inside `{cmd}` may also
be due to 'sxe' option.
Also, all |cmdline-special| characters in {cmd} are
replaced by Vim before passing them to shell.
2022-01-08 21:51:59 +00:00
*E34*
2004-06-13 20:20:40 +00:00
Any '!' in {cmd} is replaced with the previous
external command (see also 'cpoptions'). But not when
there is a backslash before the '!', then that
backslash is removed. Example: ":!ls" followed by
":!echo ! \! \\!" executes "echo ls ! \!".
2014-04-05 22:55:53 +02:00
2008-06-24 22:58:06 +00:00
A '|' in {cmd} is passed to the shell, you cannot use
it to append a Vim command. See |:bar|.
2014-04-05 22:55:53 +02:00
If {cmd} contains "%" it is expanded to the current
2020-06-07 21:07:18 +02:00
file name, "#" is expanded to the alternate file name.
Special characters in the file name are not escaped,
use quotes to avoid their special meaning: >
2014-04-05 22:55:53 +02:00
:!ls "%"
2020-06-07 21:07:18 +02:00
< If the file name contains a "$" then single quotes
might work better, but this only works if the file
name does not contain a single quote: >
2014-04-05 22:55:53 +02:00
:!ls '%'
< This should always work, but it's more typing: >
2022-02-26 12:25:45 +00:00
:exe "!ls " .. shellescape(expand("%"))
2020-06-07 21:07:18 +02:00
< To get a literal "%" or "#" prepend it with a
backslash. For example, to list all files starting
with "%": >
:!ls \%*
2014-04-05 22:55:53 +02:00
<
2004-06-13 20:20:40 +00:00
A newline character ends {cmd}, what follows is
interpreted as a following ":" command. However, if
there is a backslash before the newline it is removed
and {cmd} continues. It doesn't matter how many
backslashes are before the newline, only one is
removed.
2014-04-05 22:55:53 +02:00
2004-06-13 20:20:40 +00:00
On Unix the command normally runs in a non-interactive
shell. If you want an interactive shell to be used
(to use aliases) set 'shellcmdflag' to "-ic".
For Win32 also see |:!start|.
2014-04-05 22:55:53 +02:00
2014-05-13 20:23:24 +02:00
After the command has been executed, the timestamp and
size of the current file is checked |timestamp|.
2014-04-05 22:55:53 +02:00
2004-06-13 20:20:40 +00:00
Vim redraws the screen after the command is finished,
because it may have printed any text. This requires a
hit-enter prompt, so that you can read any messages.
To avoid this use: >
:silent !{cmd}
< The screen is not redrawn then, thus you have to use
CTRL-L or ":redraw!" if the command did display
2022-11-09 21:21:04 +00:00
something. However, this depends on what the |t_ti|
and |t_te| termcap entries are set to.
Hint: use |:terminal| command if you want to run {cmd}
in Vim window. `:term ++shell ++close {cmd}` could
serve as close approximation to what `:!{cmd}` does.
2004-06-13 20:20:40 +00:00
*:!!*
:!! Repeat last ":!{cmd}".
2019-06-06 12:14:49 +02:00
*:ve* *:ver* *:version*
2004-06-13 20:20:40 +00:00
:ve[rsion] Print the version number of the editor. If the
compiler used understands "__DATE__" the compilation
date is mentioned. Otherwise a fixed release-date is
shown.
The following lines contain information about which
features were enabled when Vim was compiled. When
there is a preceding '+', the feature is included,
when there is a '-' it is excluded. To change this,
you have to edit feature.h and recompile Vim.
To check for this in an expression, see |has()|.
Here is an overview of the features.
The first column shows the smallest version in which
they are included:
2018-03-09 22:22:21 +01:00
T tiny (always)
2004-06-13 20:20:40 +00:00
N normal
H huge
m manually enabled or depends on other features
2019-12-03 22:49:09 +01:00
- never, feature was removed
2004-06-13 20:20:40 +00:00
(none) system dependent
Thus if a feature is marked with "N", it is included
in the normal and huge versions of Vim.
2004-06-13 20:20:40 +00:00
*+feature-list*
2013-09-05 22:13:31 +02:00
*+acl* |ACL| support included
2004-06-13 20:20:40 +00:00
*+ARP* Amiga only: ARP support included
H *+arabic* |Arabic| language support
N *+autochdir* support 'autochdir' option
2022-08-24 18:30:14 +01:00
T *+autocmd* |:autocmd|, automatic commands. Always enabled since
8.0.1564
H *+autoservername* Automatically enable |clientserver|
2017-11-21 23:09:50 +01:00
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'
2004-06-13 20:20:40 +00:00
N *+browse* |:browse| command
T *++builtin_terms* maximal terminals builtin |builtin-terms| Always
enabled since 9.0.0280
2004-06-13 20:20:40 +00:00
N *+byte_offset* support for 'o' flag in 'statusline' option, "go"
and ":goto" commands.
2016-01-28 22:38:53 +01:00
m *+channel* inter process communication |channel|
T *+cindent* |'cindent'|, C indenting; Always enabled
2004-06-13 20:20:40 +00:00
N *+clientserver* Unix and Win32: Remote invocation |clientserver|
2019-08-17 20:09:31 +02:00
*+clipboard* |clipboard| support compiled-in
*+clipboard_working* |clipboard| support compiled-in and working
2019-08-31 16:20:32 +02:00
T *+cmdline_compl* command line completion |cmdline-completion|
T *+cmdline_hist* command line history |cmdline-history|
T *+cmdline_info* |'showcmd'| and |'ruler'|; Always enabled since
9.0.0747
T *+cmdwin* |cmdline-window| support; Always enabled since 9.0.0657
T *+comments* |'comments'| support
N *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc.
2004-06-13 20:20:40 +00:00
N *+cryptv* encryption support |encryption|
H *+cscope* |cscope| support
2018-03-09 22:22:21 +01:00
T *+cursorbind* |'cursorbind'| support
2005-08-29 22:25:38 +00:00
m *+cursorshape* |termcap-cursor-shape| support
m *+debug* Compiled for debugging.
2004-06-13 20:20:40 +00:00
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'|
2004-06-13 20:20:40 +00:00
*+dnd* Support for DnD into the "~ register |quote_~|.
H *+emacs_tags* |emacs-tags| files
2004-06-13 20:20:40 +00:00
N *+eval* expression evaluation |eval.txt|
2021-12-05 21:54:04 +00:00
T *+ex_extra* always on now, used to be for Vim's extra Ex commands
2004-06-13 20:20:40 +00:00
N *+extra_search* |'hlsearch'| and |'incsearch'| options.
2019-12-03 22:49:09 +01:00
- *+farsi* Removed: |farsi| language
2022-08-26 18:01:12 +01:00
T *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>| Always enabled since
9.0.265
2004-06-13 20:20:40 +00:00
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
T *+float* Floating point support Always enabled since 9.0.0491
2004-06-13 20:20:40 +00:00
N *+gettext* message translations |multi-lang|
2022-04-08 17:45:08 +01:00
- *+GUI_Athena* Unix only: Athena |GUI|
2004-06-13 20:20:40 +00:00
*+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|
2005-11-23 21:25:05 +00:00
*+iconv* Compiled with the |iconv()| function
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
2019-08-31 16:20:32 +02:00
T *+insert_expand* |insert_expand| Insert mode completion
m *+ipv6* Support for IPv6 networking |channel|
2016-02-15 22:07:32 +01:00
m *+job* starting and stopping jobs |job|
T *+jumplist* |jumplist|; Always enabled since 8.2.3795
H *+keymap* |'keymap'|
2016-08-02 21:04:33 +02:00
N *+lambda* |lambda| and |closure|
H *+langmap* |'langmap'|
2004-06-13 20:20:40 +00:00
N *+libcall* |libcall()|
N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'|
T *+lispindent* |'lisp'|
T *+listcmds* Vim commands for the list of buffers |buffer-hidden|
2004-06-13 20:20:40 +00:00
and argument list |:argdelete|
2019-08-08 22:15:18 +02:00
T *+localmap* Support for mappings local to a buffer |:map-local|
2010-07-14 23:23:17 +02:00
m *+lua* |Lua| interface
m *+lua/dyn* |Lua| interface |/dyn|
2004-06-13 20:20:40 +00:00
N *+menu* |:menu|
N *+mksession* |:mksession|
2019-09-07 16:24:12 +02:00
T *+modify_fname* |filename-modifiers|
2019-10-26 19:53:45 +02:00
T *+mouse* Mouse handling |mouse-using|
2004-06-13 20:20:40 +00:00
N *+mouseshape* |'mouseshape'|
N *+mouse_dec* Unix only: Dec terminal mouse handling |dec-mouse|
2004-06-13 20:20:40 +00:00
N *+mouse_gpm* Unix only: Linux console mouse handling |gpm-mouse|
2022-06-26 12:21:15 +01:00
m *+mouse_gpm/dyn* Same as |+mouse_gpm| with optional library dependency
|/dyn|
2014-05-22 18:26:40 +02:00
N *+mouse_jsbterm* JSB mouse handling |jsbterm-mouse|
N *+mouse_netterm* Unix only: netterm mouse handling |netterm-mouse|
2012-12-05 19:01:43 +01:00
N *+mouse_pterm* QNX only: pterm mouse handling |qnx-terminal|
2008-06-24 22:58:06 +00:00
N *+mouse_sysmouse* Unix only: *BSD console mouse handling |sysmouse|
N *+mouse_sgr* Unix only: sgr mouse handling |sgr-mouse|
N *+mouse_urxvt* Unix only: urxvt mouse handling |urxvt-mouse|
2012-12-05 19:01:43 +01:00
N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
2021-01-18 19:55:44 +01:00
T *+multi_byte* Unicode support, 16 and 32 bit characters |multibyte|
2004-06-13 20:20:40 +00:00
*+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
2012-12-05 19:01:43 +01:00
N *+multi_lang* non-English language support |multi-lang|
2004-07-05 15:58:32 +00:00
m *+mzscheme* Mzscheme interface |mzscheme|
2006-01-12 23:22:24 +00:00
m *+mzscheme/dyn* Mzscheme interface |mzscheme-dynamic| |/dyn|
2004-06-13 20:20:40 +00:00
m *+netbeans_intg* |netbeans|
2021-12-05 21:54:04 +00:00
T *+num64* 64-bit Number support |Number|
2022-02-04 16:09:54 +00:00
Always enabled since 8.2.0271, use v:numbersize to
check the actual size of a Number.
2012-12-05 19:01:43 +01:00
m *+ole* Win32 GUI only: |ole-interface|
2016-05-08 09:50:29 +02:00
N *+packages* Loading |packages|
T *+path_extra* Up/downwards search in 'path' and 'tags' Always
enabled since 9.0.0270
2005-11-23 21:25:05 +00:00
m *+perl* Perl interface |perl|
m *+perl/dyn* Perl interface |perl-dynamic| |/dyn|
N *+persistent_undo* Persistent undo |undo-persistence|
2019-12-03 22:49:09 +01:00
N *+popupwin* Popup windows |popup-window|
2012-12-05 19:01:43 +01:00
*+postscript* |:hardcopy| writes a PostScript file
2004-06-13 20:20:40 +00:00
N *+printer* |:hardcopy| command
2005-03-04 23:39:37 +00:00
H *+profile* |:profile| command
2010-07-21 20:36:22 +02:00
m *+python* Python 2 interface |python|
2012-12-05 19:01:43 +01:00
m *+python/dyn* Python 2 interface |python-dynamic| |/dyn|
2010-07-21 20:36:22 +02:00
m *+python3* Python 3 interface |python|
2012-12-05 19:01:43 +01:00
m *+python3/dyn* Python 3 interface |python-dynamic| |/dyn|
patch 9.0.1776: No support for stable Python 3 ABI Problem: No support for stable Python 3 ABI Solution: Support Python 3 stable ABI Commits: 1) Support Python 3 stable ABI to allow mixed version interoperatbility Vim currently supports embedding Python for use with plugins, and the "dynamic" linking option allows the user to specify a locally installed version of Python by setting `pythonthreedll`. However, one caveat is that the Python 3 libs are not binary compatible across minor versions, and mixing versions can potentially be dangerous (e.g. let's say Vim was linked against the Python 3.10 SDK, but the user sets `pythonthreedll` to a 3.11 lib). Usually, nothing bad happens, but in theory this could lead to crashes, memory corruption, and other unpredictable behaviors. It's also difficult for the user to tell something is wrong because Vim has no way of reporting what Python 3 version Vim was linked with. For Vim installed via a package manager, this usually isn't an issue because all the dependencies would already be figured out. For prebuilt Vim binaries like MacVim (my motivation for working on this), AppImage, and Win32 installer this could potentially be an issue as usually a single binary is distributed. This is more tricky when a new Python version is released, as there's a chicken-and-egg issue with deciding what Python version to build against and hard to keep in sync when a new Python version just drops and we have a mix of users of different Python versions, and a user just blindly upgrading to a new Python could lead to bad interactions with Vim. Python 3 does have a solution for this problem: stable ABI / limited API (see https://docs.python.org/3/c-api/stable.html). The C SDK limits the API to a set of functions that are promised to be stable across versions. This pull request adds an ifdef config that allows us to turn it on when building Vim. Vim binaries built with this option should be safe to freely link with any Python 3 libraies without having the constraint of having to use the same minor version. Note: Python 2 has no such concept and this doesn't change how Python 2 integration works (not that there is going to be a new version of Python 2 that would cause compatibility issues in the future anyway). --- Technical details: ====== The stable ABI can be accessed when we compile with the Python 3 limited API (by defining `Py_LIMITED_API`). The Python 3 code (in `if_python3.c` and `if_py_both.h`) would now handle this and switch to limited API mode. Without it set, Vim will still use the full API as before so this is an opt-in change. The main difference is that `PyType_Object` is now an opaque struct that we can't directly create "static types" out of, and we have to create type objects as "heap types" instead. This is because the struct is not stable and changes from version to version (e.g. 3.8 added a `tp_vectorcall` field to it). I had to change all the types to be allocated on the heap instead with just a pointer to them. Other functions are also simply missing in limited API, or they are introduced too late (e.g. `PyUnicode_AsUTF8AndSize` in 3.10) to it that we need some other ways to do the same thing, so I had to abstract a few things into macros, and sometimes re-implement functions like `PyObject_NEW`. One caveat is that in limited API, `OutputType` (used for replacing `sys.stdout`) no longer inherits from `PyStdPrinter_Type` which I don't think has any real issue other than minor differences in how they convert to a string and missing a couple functions like `mode()` and `fileno()`. Also fixed an existing bug where `tp_basicsize` was set incorrectly for `BufferObject`, `TabListObject, `WinListObject`. Technically, there could be a small performance drop, there is a little more indirection with accessing type objects, and some APIs like `PyUnicode_AsUTF8AndSize` are missing, but in practice I didn't see any difference, and any well-written Python plugin should try to avoid excessing callbacks to the `vim` module in Python anyway. I only tested limited API mode down to Python 3.7, which seemes to compile and work fine. I haven't tried earlier Python versions. 2) Fix PyIter_Check on older Python vers / type##Ptr unused warning For PyIter_Check, older versions exposed them as either macros (used in full API), or a function (for use in limited API). A previous change exposed PyIter_Check to the dynamic build because Python just moved it to function-only in 3.10 anyway. Because of that, just make sure we always grab the function in dynamic builds in earlier versions since that's what Python eventually did anyway. 3) Move Py_LIMITED_API define to configure script Can now use --with-python-stable-abi flag to customize what stable ABI version to target. Can also use an env var to do so as well. 4) Show +python/dyn-stable in :version, and allow has() feature query Not sure if the "/dyn-stable" suffix would break things, or whether we should do it another way. Or just don't show it in version and rely on has() feature checking. 5) Documentation first draft. Still need to implement v:python3_version 6) Fix PyIter_Check build breaks when compiling against Python 3.8 7) Add CI coverage stable ABI on Linux/Windows / make configurable on Windows This adds configurable options for Windows make files (both MinGW and MSVC). CI will also now exercise both traditional full API and stable ABI for Linux and Windows in the matrix for coverage. Also added a "dynamic" option to Linux matrix as a drive-by change to make other scripting languages like Ruby / Perl testable under both static and dynamic builds. 8) Fix inaccuracy in Windows docs Python's own docs are confusing but you don't actually want to use `python3.dll` for the dynamic linkage. 9) Add generated autoconf file 10) Add v:python3_version support This variable indicates the version of Python3 that Vim was built against (PY_VERSION_HEX), and will be useful to check whether the Python library you are loading in dynamically actually fits it. When built with stable ABI, it will be the limited ABI version instead (`Py_LIMITED_API`), which indicates the minimum version of Python 3 the user should have, rather than the exact match. When stable ABI is used, we won't be exposing PY_VERSION_HEX in this var because it just doesn't seem necessary to do so (the whole point of stable ABI is the promise that it will work across versions), and I don't want to confuse the user with too many variables. Also, cleaned up some documentation, and added help tags. 11) Fix Python 3.7 compat issues Fix a couple issues when using limited API < 3.8 - Crash on exit: In Python 3.7, if a heap-allocated type is destroyed before all instances are, it would cause a crash later. This happens when we destroyed `OptionsType` before calling `Py_Finalize` when using the limited API. To make it worse, later versions changed the semantics and now each instance has a strong reference to its own type and the recommendation has changed to have each instance de-ref its own type and have its type in GC traversal. To avoid dealing with these cross-version variations, we just don't free the heap type. They are static types in non-limited-API anyway and are designed to last through the entirety of the app, and we also don't restart the Python runtime and therefore do not need it to have absolutely 0 leaks. See: - https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-c-api - https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-c-api - PyIter_Check: This function is not provided in limited APIs older than 3.8. Previously I was trying to mock it out using manual PyType_GetSlot() but it was brittle and also does not actually work properly for static types (it will generate a Python error). Just return false. It does mean using limited API < 3.8 is not recommended as you lose the functionality to handle iterators, but from playing with plugins I couldn't find it to be an issue. - Fix loading of PyIter_Check so it will be done when limited API < 3.8. Otherwise loading a 3.7 Python lib will fail even if limited API was specified to use it. 12) Make sure to only load `PyUnicode_AsUTF8AndSize` in needed in limited API We don't use this function unless limited API >= 3.10, but we were loading it regardless. Usually it's ok in Unix-like systems where Python just has a single lib that we load from, but in Windows where there is a separate python3.dll this would not work as the symbol would not have been exposed in this more limited DLL file. This makes it much clearer under what condition is this function needed. closes: #12032 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-08-20 21:18:38 +02:00
m *+python3/dyn-stable*
Python 3 interface |python-dynamic| |python-stable|
|/dyn|
2004-06-13 20:20:40 +00:00
N *+quickfix* |:make| and |quickfix| commands
2008-06-24 22:58:06 +00:00
N *+reltime* |reltime()| function, 'hlsearch'/'incsearch' timeout,
'redrawtime' option
H *+rightleft* Right to left typing |'rightleft'|
2005-11-23 21:25:05 +00:00
m *+ruby* Ruby interface |ruby|
m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn|
T *+scrollbind* |'scrollbind'|
N *+signs* |:sign|
T *+smartindent* |'smartindent'|
H *+sodium* compiled with libsodium for better encryption support
H *+sound* |sound_playevent()|, |sound_playfile()| functions, etc.
2019-06-10 22:47:40 +02:00
N *+spell* spell checking support, see |spell|
2012-12-05 19:01:43 +01:00
N *+startuptime* |--startuptime| argument
N *+statusline* Options 'statusline', 'rulerformat' and special
2004-06-13 20:20:40 +00:00
formats of 'titlestring' and 'iconstring'
2019-12-03 22:49:09 +01:00
- *+sun_workshop* Removed: |workshop|
2004-06-13 20:20:40 +00:00
N *+syntax* Syntax highlighting |syntax|
*+system()* Unix only: opposite of |+fork|
2016-09-06 22:12:34 +02:00
T *+tag_binary* binary searching in tags file |tag-binary-search|
2019-12-03 22:49:09 +01:00
- *+tag_old_static* Removed; method for static tags |tag-old-static|
- *+tag_any_white* Removed; was to allow any white space in tags files
2012-12-05 19:01:43 +01:00
m *+tcl* Tcl interface |tcl|
2005-11-23 21:25:05 +00:00
m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
2017-08-11 19:50:37 +02:00
m *+terminal* Support for terminal window |terminal|
2004-06-13 20:20:40 +00:00
*+terminfo* uses |terminfo| instead of termcap
N *+termresponse* support for |t_RV| and |v:termresponse|
N *+termguicolors* 24-bit color in xterm-compatible terminals support
T *+textobjects* |text-objects| selection. Always enabled since 9.0.0222.
2018-12-18 21:41:50 +01:00
N *+textprop* |text-properties|
2004-06-13 20:20:40 +00:00
*+tgetent* non-Unix only: able to use external termcap
2016-03-20 21:08:34 +01:00
N *+timers* the |timer_start()| function
2021-12-05 21:54:04 +00:00
T *+title* Setting the window 'title' and 'icon'; Always enabled
2004-06-13 20:20:40 +00:00
N *+toolbar* |gui-toolbar|
T *+user_commands* User-defined commands. |user-commands|
Always enabled since 8.1.1210.
H *+vartabs* Variable-width tabstops. |'vartabstop'|
2021-12-05 21:54:04 +00:00
T *+vertsplit* Vertically split windows |:vsplit|; Always enabled
2017-09-19 22:06:03 +02:00
since 8.0.1118.
T *+vim9script* |Vim9| script
N *+viminfo* |'viminfo'|
2021-12-05 21:54:04 +00:00
T *+virtualedit* |'virtualedit'| Always enabled since 8.1.826.
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'
T *+wildignore* |'wildignore'| Always enabled since 9.0.0278
2022-12-31 15:30:45 +00:00
T *+wildmenu* |'wildmenu'| Always enabled since 9.0.0279
T *+windows* more than one window; Always enabled since 8.0.1118.
2012-12-05 19:01:43 +01:00
m *+writebackup* |'writebackup'| is default on
m *+xim* X input method |xim|
2004-06-13 20:20:40 +00:00
*+xfontset* X fontset support |xfontset|
N *+xattr* compiled with extended attribute support (Linux only)
2013-09-05 22:13:31 +02:00
*+xpm* pixmap support
2012-08-15 17:43:31 +02:00
m *+xpm_w32* Win32 GUI only: pixmap support |w32-xpm-support|
2004-06-13 20:20:40 +00:00
*+xsmp* XSMP (X session management) support
*+xsmp_interact* interactive XSMP (X session management) support
N *+xterm_clipboard* Unix only: xterm clipboard handling
2012-12-05 19:01:43 +01:00
m *+xterm_save* save and restore xterm screen |xterm-screens|
N *+X11* Unix only: can restore window title |X11|
2004-06-13 20:20:40 +00:00
*/dyn* *E370* *E448*
To some of the features "/dyn" is added when the
feature is only available when the related library can
be dynamically loaded.
: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.
2004-06-13 20:20:40 +00:00
*: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.
2016-07-09 20:21:48 +02:00
2004-06-13 20:20:40 +00:00
Only one ":redir" can be active at a time. Calls to
":redir" will close any active redirection before
2016-07-09 20:21:48 +02:00
starting redirection to the new target. For recursive
use check out |execute()|.
2004-06-13 20:20:40 +00:00
To stop the messages and commands from being echoed to
the screen, put the commands in a function and call it
with ":silent call Function()".
2005-05-31 22:22:17 +00:00
An alternative is to use the 'verbosefile' option,
this can be used in combination with ":redir".
2004-06-13 20:20:40 +00:00
:redi[r] >> {file} Redirect messages to file {file}. Append if {file}
already exists.
2004-06-13 20:20:40 +00:00
2008-06-24 22:58:06 +00:00
:redi[r] @{a-zA-Z}
2005-06-01 21:56:33 +00:00
:redi[r] @{a-zA-Z}> Redirect messages to register {a-z}. Append to the
2004-06-13 20:20:40 +00:00
contents of the register if its name is given
2008-06-24 22:58:06 +00:00
uppercase {A-Z}. The ">" after the register name is
optional.
:redi[r] @{a-z}>> Append messages to register {a-z}.
2004-06-13 20:20:40 +00:00
2019-12-07 16:03:51 +01:00
:redi[r] @*>
2007-05-05 18:24:42 +00:00
:redi[r] @+> Redirect messages to the selection or clipboard. For
backward compatibility, the ">" after the register
name can be omitted. See |quotestar| and |quoteplus|.
2019-12-07 16:03:51 +01:00
:redi[r] @*>>
2007-05-05 18:24:42 +00:00
:redi[r] @+>> Append messages to the selection or clipboard.
2004-06-13 20:20:40 +00:00
2005-06-01 21:56:33 +00:00
: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.
2022-02-04 16:09:54 +00:00
*E1092*
2021-12-24 13:18:38 +00:00
:redi[r] => {var} Redirect messages to a variable.
In legacy script: If the variable doesn't exist, then
it is created. If the variable exists, then it is
initialized to an empty string. After the redirection
starts, if the variable is removed or locked or the
variable type is changed, then further command output
2022-06-25 18:01:32 +01:00
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.
2021-12-24 13:18:38 +00:00
In Vim9 script: the variable must have been declared
as a string.
2007-05-05 18:24:42 +00:00
The variable will remain empty until redirection ends.
2021-12-24 13:18:38 +00:00
Only string variables can be used.
2016-07-09 20:21:48 +02:00
To get the output of one command the |execute()|
2020-04-20 19:52:53 +02:00
function can be used instead of redirection.
2005-02-22 08:56:13 +00:00
:redi[r] =>> {var} Append messages to an existing variable. Only string
variables can be used.
2022-02-04 16:09:54 +00:00
*E1185*
:redi[r] END End redirecting messages.
2004-06-13 20:20:40 +00:00
*:filt* *:filter*
2022-01-16 14:46:06 +00:00
:filt[er][!] {pattern} {command}
:filt[er][!] /{pattern}/ {command}
2017-03-05 17:04:09 +01:00
Restrict the output of {command} to lines matching
2022-01-16 14:46:06 +00:00
with {pattern}. For example, to list only xml files: >
:filter /\.xml$/ oldfiles
2017-03-05 17:04:09 +01:00
< If the [!] is given, restrict the output of {command}
2022-01-16 14:46:06 +00:00
to lines that do NOT match {pattern}.
2017-03-05 17:04:09 +01:00
2022-01-16 14:46:06 +00:00
{pattern} is a Vim search pattern. Instead of enclosing
it in / any non-ID character (see |'isident'|) can be
2022-01-16 14:46:06 +00:00
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.
The pattern is matched against the relevant part of
the output, not necessarily the whole line. Only some
commands support filtering, try it out to check if it
works. Some of the commands that support filtering:
|:#| - filter whole line
|:clist| - filter by file name or module name
|:command| - filter by command name
|:files| - filter by file name
|:highlight| - filter by highlight group
|:history| - filter by history commands
|:jumps| - filter by file name
|:let| - filter by variable name
|:list| - filter whole line
|:llist| - filter by file name or module name
|:marks| - filter by text in the current file,
or file name for other files
|:oldfiles| - filter by file name
|:registers| - filter by register contents
(does not work multi-line)
2021-12-16 14:41:10 +00:00
|:set| - filter by option name
Only normal messages are filtered, error messages are
not.
2016-02-20 15:47:01 +01:00
*:sil* *:silent* *:silent!*
2004-06-13 20:20:40 +00:00
: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
< To execute a Normal mode command silently, use the
|:normal| command. For example, to search for a
string without messages: >
:silent exe "normal /path\<CR>"
< ":silent!" is useful to execute a command that may
fail, but the failure is to be ignored. Example: >
:let v:errmsg = ""
:silent! /^begin
:if v:errmsg != ""
: ... pattern was not found
< ":silent" will also avoid the hit-enter prompt. When
using this for an external command, this may cause the
screen to be messed up. Use |CTRL-L| to clean it up
then.
":silent menu ..." defines a menu that will not echo a
Command-line command. The command will still produce
messages though. Use ":silent" in the command itself
to avoid that: ":silent menu .... :silent command".
2009-07-09 13:55:43 +00:00
*: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. >
2022-02-26 12:25:45 +00:00
:silent argdo unsilent echo expand('%') .. ": " .. getline(1)
2009-07-09 13:55:43 +00:00
<
2004-06-13 20:20:40 +00:00
*:verb* *:verbose*
:[count]verb[ose] {command}
Execute {command} with 'verbose' set to [count]. If
2004-06-16 11:19:22 +00:00
[count] is omitted one is used. ":0verbose" can be
used to set 'verbose' to zero.
2004-06-13 20:20:40 +00:00
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 ~
2005-05-31 22:22:17 +00:00
For logging verbose messages in a file use the
'verbosefile' option.
2004-06-13 20:20:40 +00:00
2005-08-19 20:40:30 +00:00
*:verbose-cmd*
When 'verbose' is non-zero, listing the value of a Vim option or a key map or
2005-09-01 20:46:49 +00:00
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}
2005-08-19 20:40:30 +00:00
2004-06-13 20:20:40 +00:00
*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
2017-03-05 17:04:09 +01:00
directory of Vim. It is called "ref" and does a
2004-06-13 20:20:40 +00:00
simple spelling check.
Special cases:
2016-05-24 20:02:38 +02:00
- If 'keywordprg' begins with ":" it is invoked as
a Vim Ex command with [count].
2004-06-13 20:20:40 +00:00
- 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.
2016-05-24 20:02:38 +02:00
- 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: >
2004-06-13 20:20:40 +00:00
!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.
2004-06-13 20:20:40 +00:00
[N]gs *gs* *:sl* *:sleep*
:[N]sl[eep] [N][m] Do nothing for [N] seconds. When [m] is included,
2005-04-15 21:13:42 +00:00
sleep for [N] milliseconds. The count for "gs" always
2004-06-13 20:20:40 +00:00
uses seconds. The default is one second. >
:sleep "sleep for one second
:5sleep "sleep for five seconds
:sleep 100m "sleep for 100 milliseconds
2004-06-13 20:20:40 +00:00
10gs "sleep for ten seconds
2019-12-26 14:35:26 +01:00
< Can be interrupted with CTRL-C (CTRL-Break on
MS-Windows). "gs" stands for "goto sleep".
2005-01-27 14:41:15 +00:00
While sleeping the cursor is positioned in the text,
if at a visible position.
2011-10-20 22:22:38 +02:00
Also process the received netbeans messages. {only
available when compiled with the |+netbeans_intg|
feature}
2021-01-18 19:55:44 +01:00
*:sl!* *:sleep!*
2021-06-13 19:02:49 +02:00
:[N]sl[eep]! [N][m] Same as above, but hide the cursor.
2021-01-18 19:55:44 +01:00
*: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
2019-05-26 21:33:31 +02:00
different machines.
2019-12-07 16:03:51 +01:00
[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.
2019-12-07 16:03:51 +01:00
{only available when compiled with the |+clipboard|
feature}
2004-06-13 20:20:40 +00:00
*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.
2016-01-15 20:57:49 +01:00
For incrementing in Visual mode see |v_g_CTRL-A|.
2004-06-13 20:20:40 +00:00
==============================================================================
2010-09-19 19:01:21 +02:00
2. Using Vim like less or more *less*
2004-06-13 20:20:40 +00:00
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 shell script uses the Vim script "$VIMRUNTIME/macros/less.vim". It sets
up mappings to simulate the commands that less supports. Otherwise, you can
still use the Vim commands.
This isn't perfect. For example, when viewing a short file Vim will still use
2020-07-10 22:00:53 +02:00
the whole screen. But it works well enough for most uses, and you get syntax
2004-06-13 20:20:40 +00:00
highlighting.
The "h" key will give you a short overview of the available commands.
2015-11-19 20:38:09 +01:00
If you want to set options differently when using less, define the
LessInitFunc in your vimrc, for example: >
func LessInitFunc()
set nocursorcolumn nocursorline
endfunc
<
2018-07-31 22:23:58 +02:00
vim:tw=78:ts=8:noet:ft=help:norl: