blob: c16587f8f8bbca31a52c469cf9abe94f3f02a4eb [file] [log] [blame]
Bram Moolenaar362e1a32006-03-06 23:29:24 +00001*various.txt* For Vim version 7.0aa. Last change: 2006 Mar 05
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Various commands *various*
8
91. Various commands |various-cmds|
102. Online help |online-help|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000113. Using Vim like less or more |less|
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13==============================================================================
141. Various commands *various-cmds*
15
16 *CTRL-L*
Bram Moolenaar30abd282005-06-22 22:35:10 +000017CTRL-L Clear and redraw the screen. The redraw may happen
18 later, after processing typeahead.
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20 *:redr* *:redraw*
21:redr[aw][!] Redraw the screen right now. When ! is included it is
22 cleared first.
23 Useful to update the screen halfway executing a script
24 or function. Also when halfway a mapping and
25 'lazyredraw' is set.
26
27 *:redraws* *:redrawstatus*
28:redraws[tatus][!] Redraw the status line of the current window. When !
29 is included all status lines are redrawn.
30 Useful to update the status line(s) when 'statusline'
31 includes an item that doesn't cause automatic
32 updating.
33
34 *N<Del>*
35<Del> When entering a number: Remove the last digit.
36 Note: if you like to use <BS> for this, add this
37 mapping to your .vimrc: >
38 :map CTRL-V <BS> CTRL-V <Del>
39< See |:fixdel| if your <Del> key does not do what you
40 want.
41
42:as[cii] or *ga* *:as* *:ascii*
43ga Print the ascii value of the character under the
44 cursor in decimal, hexadecimal and octal. For
45 example, when the cursor is on a 'R':
46 <R> 82, Hex 52, Octal 122 ~
47 When the character is a non-standard ASCII character,
48 but printable according to the 'isprint' option, the
49 non-printable version is also given. When the
50 character is larger than 127, the <M-x> form is also
51 printed. For example:
52 <~A> <M-^A> 129, Hex 81, Octal 201 ~
53 <p> <|~> <M-~> 254, Hex fe, Octal 376 ~
54 (where <p> is a special character)
55 The <Nul> character in a file is stored internally as
56 <NL>, but it will be shown as:
57 <^@> 0, Hex 00, Octal 000 ~
Bram Moolenaar362e1a32006-03-06 23:29:24 +000058 If the character has composing characters these are
59 also shown. The value of 'maxcombine' doesn't matter.
Bram Moolenaar071d4272004-06-13 20:20:40 +000060 Mnemonic: Get Ascii value. {not in Vi}
61
62 *g8*
63g8 Print the hex values of the bytes used in the
64 character under the cursor, assuming it is in |UTF-8|
Bram Moolenaar362e1a32006-03-06 23:29:24 +000065 encoding. This also shows composing characters. The
66 value of 'maxcombine' doesn't matter.
67 Example of a character with two composing characters:
Bram Moolenaar071d4272004-06-13 20:20:40 +000068 e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
69 {not in Vi}
70
71 *:p* *:pr* *:print*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000072:[range]p[rint] [flags]
73 Print [range] lines (default current line).
Bram Moolenaar071d4272004-06-13 20:20:40 +000074 Note: If you are looking for a way to print your text
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000075 on paper see |:hardcopy|. In the GUI you can use the
76 File.Print menu entry.
77 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000079:[range]p[rint] {count} [flags]
Bram Moolenaar071d4272004-06-13 20:20:40 +000080 Print {count} lines, starting with [range] (default
81 current line |cmdline-ranges|).
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000082 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +000083
84 *:P* *:Print*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000085:[range]P[rint] [count] [flags]
Bram Moolenaar071d4272004-06-13 20:20:40 +000086 Just as ":print". Was apparently added to Vi for
87 people that keep the shift key pressed too long...
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000088 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +000089
90 *:l* *:list*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000091:[range]l[ist] [count] [flags]
Bram Moolenaar071d4272004-06-13 20:20:40 +000092 Same as :print, but display unprintable characters
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000093 with '^' and put $ after the line.
94 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +000095
96 *:nu* *:number*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +000097:[range]nu[mber] [count] [flags]
Bram Moolenaar071d4272004-06-13 20:20:40 +000098 Same as :print, but precede each line with its line
Bram Moolenaarfaa959a2006-02-20 21:37:40 +000099 number. (See also 'highlight' and 'numberwidth'
100 option).
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000101 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +0000102
103 *:#*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000104:[range]# [count] [flags]
105 synonym for :number.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106
107 *:z* *E144*
108:{range}z[+-^.=]{count} Display several lines of text surrounding the line
109 specified with {range}, or around the current line
110 if there is no {range}. If there is a {count}, that's
Bram Moolenaar4399ef42005-02-12 14:29:27 +0000111 how many lines you'll see; if there is only one window
112 then the 'window' option is used, otherwise the
113 current window size is used.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000114
115 :z can be used either alone or followed by any of
116 several punctuation marks. These have the following
117 effect:
118
119 mark first line last line new location ~
120 ---- ---------- --------- ------------
121 + current line 1 scr forward 1 scr forward
122 - 1 scr back current line current line
123 ^ 2 scr back 1 scr back 1 scr back
Bram Moolenaar2a8d1f82005-02-05 21:43:56 +0000124 . 1/2 scr back 1/2 scr fwd 1/2 scr fwd
125 = 1/2 scr back 1/2 scr fwd current line
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126
127 Specifying no mark at all is the same as "+".
128 If the mark is "=", a line of dashes is printed
129 around the current line.
130
131:{range}z#[+-^.=]{count} *:z#*
132 Like ":z", but number the lines.
133 {not in all versions of Vi, not with these arguments}
134
135 *:=*
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000136:= [flags] Print the last line number.
137 See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +0000138
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000139:{range}= [flags] Prints the last line number in {range}. For example,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000140 this prints the current line number: >
141 :.=
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000142< See |ex-flags| for [flags].
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143
144:norm[al][!] {commands} *:norm* *:normal*
145 Execute Normal mode commands {commands}. This makes
146 it possible to execute Normal mode commands typed on
147 the command-line. {commands} is executed like it is
148 typed. For undo all commands are undone together.
149 If the [!] is given, mappings will not be used.
150 {commands} should be a complete command. If
151 {commands} does not finish a command, the last one
152 will be aborted as if <Esc> or <C-C> was typed.
153 The display isn't updated while ":normal" is busy.
154 This implies that an insert command must be completed
155 (to start Insert mode, see |:startinsert|). A ":"
Bram Moolenaar7c626922005-02-07 22:01:03 +0000156 command must be completed as well. And you can't use
157 "Q" or "gQ" to start Ex mode.
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000158 {commands} cannot start with a space. Put a 1 (one)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159 before it, 1 space is one space.
160 The 'insertmode' option is ignored for {commands}.
161 This command cannot be followed by another command,
162 since any '|' is considered part of the command.
163 This command can be used recursively, but the depth is
164 limited by 'maxmapdepth'.
165 When this command is called from a non-remappable
166 mapping |:noremap|, the argument can be mapped anyway.
167 An alternative is to use |:execute|, which uses an
168 expression as argument. This allows the use of
169 printable characters. Example: >
170 :exe "normal \<c-w>\<c-w>"
171< {not in Vi, of course}
172 {not available when the |+ex_extra| feature was
173 disabled at compile time}
174
175:{range}norm[al][!] {commands} *:normal-range*
176 Execute Normal mode commands {commands} for each line
177 in the {range}. Before executing the {commands}, the
178 cursor is positioned in the first column of the range,
179 for each line. Otherwise it's the same as the
180 ":normal" command without a range.
181 {not in Vi}
182 Not available when |+ex_extra| feature was disabled at
183 compile time.
184
185 *:sh* *:shell* *E371*
186:sh[ell] This command starts a shell. When the shell exits
187 (after the "exit" command) you return to Vim. The
188 name for the shell command comes from 'shell' option.
189 *E360*
190 Note: This doesn't work when Vim on the Amiga was
191 started in QuickFix mode from a compiler, because the
192 compiler will have set stdin to a non-interactive
193 mode.
194
195 *:!cmd* *:!* *E34*
196:!{cmd} Execute {cmd} with the shell. See also the 'shell'
197 and 'shelltype' option.
198 Any '!' in {cmd} is replaced with the previous
199 external command (see also 'cpoptions'). But not when
200 there is a backslash before the '!', then that
201 backslash is removed. Example: ":!ls" followed by
202 ":!echo ! \! \\!" executes "echo ls ! \!".
203 After the command has been executed, the timestamp of
204 the current file is checked |timestamp|.
205 There cannot be a '|' in {cmd}, see |:bar|.
206 A newline character ends {cmd}, what follows is
207 interpreted as a following ":" command. However, if
208 there is a backslash before the newline it is removed
209 and {cmd} continues. It doesn't matter how many
210 backslashes are before the newline, only one is
211 removed.
212 On Unix the command normally runs in a non-interactive
213 shell. If you want an interactive shell to be used
214 (to use aliases) set 'shellcmdflag' to "-ic".
215 For Win32 also see |:!start|.
216 Vim redraws the screen after the command is finished,
217 because it may have printed any text. This requires a
218 hit-enter prompt, so that you can read any messages.
219 To avoid this use: >
220 :silent !{cmd}
221< The screen is not redrawn then, thus you have to use
222 CTRL-L or ":redraw!" if the command did display
223 something.
224 Also see |shell-window|.
225
226 *:!!*
227:!! Repeat last ":!{cmd}".
228
229 *:ve* *:version*
230:ve[rsion] Print the version number of the editor. If the
231 compiler used understands "__DATE__" the compilation
232 date is mentioned. Otherwise a fixed release-date is
233 shown.
234 The following lines contain information about which
235 features were enabled when Vim was compiled. When
236 there is a preceding '+', the feature is included,
237 when there is a '-' it is excluded. To change this,
238 you have to edit feature.h and recompile Vim.
239 To check for this in an expression, see |has()|.
240 Here is an overview of the features.
241 The first column shows the smallest version in which
242 they are included:
243 T tiny
244 S small
245 N normal
246 B big
247 H huge
248 m manually enabled or depends on other features
249 (none) system dependent
250 Thus if a feature is marked with "N", it is included
251 in the normal, big and huge versions of Vim.
252
253 *+feature-list*
254 *+ARP* Amiga only: ARP support included
255B *+arabic* |Arabic| language support
256N *+autocmd* |:autocmd|, automatic commands
Bram Moolenaar4d34b432005-03-07 23:22:00 +0000257m *+balloon_eval* |balloon-eval| support. Included when compiling with
258 supported GUI (Motif, GTK, GUI) and either
259 Netbeans/Sun Workshop integration or |+eval| feature.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260N *+browse* |:browse| command
261N *+builtin_terms* some terminals builtin |builtin-terms|
262B *++builtin_terms* maximal terminals builtin |builtin-terms|
263N *+byte_offset* support for 'o' flag in 'statusline' option, "go"
264 and ":goto" commands.
265N *+cindent* |'cindent'|, C indenting
266N *+clientserver* Unix and Win32: Remote invocation |clientserver|
267 *+clipboard* |clipboard| support
268N *+cmdline_compl* command line completion |cmdline-completion|
269N *+cmdline_hist* command line history |cmdline-history|
270N *+cmdline_info* |'showcmd'| and |'ruler'|
271N *+comments* |'comments'| support
272N *+cryptv* encryption support |encryption|
273B *+cscope* |cscope| support
Bram Moolenaarac6e65f2005-08-29 22:25:38 +0000274m *+cursorshape* |termcap-cursor-shape| support
275m *+debug* Compiled for debugging.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276N *+dialog_gui* Support for |:confirm| with GUI dialog.
277N *+dialog_con* Support for |:confirm| with console dialog.
278N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
279N *+diff* |vimdiff| and 'diff'
280N *+digraphs* |digraphs| *E196*
281 *+dnd* Support for DnD into the "~ register |quote_~|.
282B *+emacs_tags* |emacs-tags| files
283N *+eval* expression evaluation |eval.txt|
284N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|,
285 |:normal|, |:retab| and |:right|
286N *+extra_search* |'hlsearch'| and |'incsearch'| options.
287B *+farsi* |farsi| language
288N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>|
289N *+find_in_path* include file searches: |[I|, |:isearch|,
290 |CTRL-W_CTRL-I|, |:checkpath|, etc.
291N *+folding* |folding|
292 *+footer* |gui-footer|
293 *+fork* Unix only: |fork| shell commands
294N *+gettext* message translations |multi-lang|
295 *+GUI_Athena* Unix only: Athena |GUI|
296 *+GUI_neXtaw* Unix only: neXtaw |GUI|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297 *+GUI_GTK* Unix only: GTK+ |GUI|
298 *+GUI_Motif* Unix only: Motif |GUI|
299 *+GUI_Photon* QNX only: Photon |GUI|
300m *+hangul_input* Hangul input support |hangul|
Bram Moolenaara5792f52005-11-23 21:25:05 +0000301 *+iconv* Compiled with the |iconv()| function
302 *+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303N *+insert_expand* |insert_expand| Insert mode completion
304N *+jumplist* |jumplist|
305B *+keymap* |'keymap'|
306B *+langmap* |'langmap'|
307N *+libcall* |libcall()|
308N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'|
309N *+lispindent* |'lisp'|
310N *+listcmds* Vim commands for the list of buffers |buffer-hidden|
311 and argument list |:argdelete|
312N *+localmap* Support for mappings local to a buffer |:map-local|
313N *+menu* |:menu|
314N *+mksession* |:mksession|
315N *+modify_fname* |filename-modifiers|
316N *+mouse* Mouse handling |mouse-using|
317N *+mouseshape* |'mouseshape'|
318B *+mouse_dec* Unix only: Dec terminal mouse handling |dec-mouse|
319N *+mouse_gpm* Unix only: Linux console mouse handling |gpm-mouse|
320B *+mouse_netterm* Unix only: netterm mouse handling |netterm-mouse|
321N *+mouse_pterm* QNX only: pterm mouse handling |qnx-terminal|
322N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
323B *+multi_byte* Korean and other languages |multibyte|
324 *+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
325N *+multi_lang* non-English language support |multi-lang|
Bram Moolenaar325b7a22004-07-05 15:58:32 +0000326m *+mzscheme* Mzscheme interface |mzscheme|
Bram Moolenaar4770d092006-01-12 23:22:24 +0000327m *+mzscheme/dyn* Mzscheme interface |mzscheme-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000328m *+netbeans_intg* |netbeans|
329m *+ole* Win32 GUI only: |ole-interface|
330 *+osfiletype* Support for the 'osfiletype' option and filetype
331 checking in automatic commands. |autocmd-osfiletypes|
332N *+path_extra* Up/downwards search in 'path' and 'tags'
Bram Moolenaara5792f52005-11-23 21:25:05 +0000333m *+perl* Perl interface |perl|
334m *+perl/dyn* Perl interface |perl-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335 *+postscript* |:hardcopy| writes a PostScript file
336N *+printer* |:hardcopy| command
Bram Moolenaar19a09a12005-03-04 23:39:37 +0000337H *+profile* |:profile| command
Bram Moolenaara5792f52005-11-23 21:25:05 +0000338m *+python* Python interface |python|
339m *+python/dyn* Python interface |python-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340N *+quickfix* |:make| and |quickfix| commands
341B *+rightleft* Right to left typing |'rightleft'|
Bram Moolenaara5792f52005-11-23 21:25:05 +0000342m *+ruby* Ruby interface |ruby|
343m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000344N *+scrollbind* |'scrollbind'|
345B *+signs* |:sign|
346N *+smartindent* |'smartindent'|
347m *+sniff* SniFF interface |sniff|
348N *+statusline* Options 'statusline', 'rulerformat' and special
349 formats of 'titlestring' and 'iconstring'
350m *+sun_workshop* |workshop|
351N *+syntax* Syntax highlighting |syntax|
352 *+system()* Unix only: opposite of |+fork|
353N *+tag_binary* binary searching in tags file |tag-binary-search|
354N *+tag_old_static* old method for static tags |tag-old-static|
355m *+tag_any_white* any white space allowed in tags file |tag-any-white|
Bram Moolenaara5792f52005-11-23 21:25:05 +0000356m *+tcl* Tcl interface |tcl|
357m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358 *+terminfo* uses |terminfo| instead of termcap
359N *+termresponse* support for |t_RV| and |v:termresponse|
360N *+textobjects* |text-objects| selection
361 *+tgetent* non-Unix only: able to use external termcap
362N *+title* Setting the window title |'title'|
363N *+toolbar* |gui-toolbar|
364N *+user_commands* User-defined commands. |user-commands|
365N *+viminfo* |'viminfo'|
366N *+vertsplit* Vertically split windows |:vsplit|
367N *+virtualedit* |'virtualedit'|
368S *+visual* Visual mode |Visual-mode|
369N *+visualextra* extra Visual mode commands |blockwise-operators|
370N *+vreplace* |gR| and |gr|
371N *+wildignore* |'wildignore'|
372N *+wildmenu* |'wildmenu'|
373S *+windows* more than one window
374m *+writebackup* |'writebackup'| is default on
375m *+xim* X input method |xim|
376 *+xfontset* X fontset support |xfontset|
377 *+xsmp* XSMP (X session management) support
378 *+xsmp_interact* interactive XSMP (X session management) support
379N *+xterm_clipboard* Unix only: xterm clipboard handling
380m *+xterm_save* save and restore xterm screen |xterm-screens|
381N *+X11* Unix only: can restore window title |X11|
382
383 */dyn* *E370* *E448*
384 To some of the features "/dyn" is added when the
385 feature is only available when the related library can
386 be dynamically loaded.
387
388:ve[rsion] {nr} Is now ignored. This was previously used to check the
389 version number of a .vimrc file. It was removed,
390 because you can now use the ":if" command for
391 version-dependent behavior. {not in Vi}
392
393 *:redi* *:redir*
394:redi[r][!] > {file} Redirect messages to file {file}. The messages which
395 are the output of commands are written to that file,
396 until redirection ends. The messages are also still
397 shown on the screen. When [!] is included, an
398 existing file is overwritten. When [!] is omitted,
399 and {file} exists, this command fails.
400 Only one ":redir" can be active at a time. Calls to
401 ":redir" will close any active redirection before
402 starting redirection to the new target.
403 To stop the messages and commands from being echoed to
404 the screen, put the commands in a function and call it
405 with ":silent call Function()".
Bram Moolenaar54ee7752005-05-31 22:22:17 +0000406 An alternative is to use the 'verbosefile' option,
407 this can be used in combination with ":redir".
Bram Moolenaar071d4272004-06-13 20:20:40 +0000408 {not in Vi}
409
410:redi[r] >> {file} Redirect messages to file {file}. Append if {file}
411 already exists. {not in Vi}
412
Bram Moolenaar6c0b44b2005-06-01 21:56:33 +0000413:redi[r] @{a-zA-Z}> Redirect messages to register {a-z}. Append to the
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414 contents of the register if its name is given
Bram Moolenaar6c0b44b2005-06-01 21:56:33 +0000415 uppercase {A-Z}. For backward compatibility, the ">"
416 after the register name can be omitted. {not in Vi}
Bram Moolenaar34cdc3e2005-05-18 22:24:46 +0000417:redi[r] @{a-z}>> Append messages to register {a-z}. {not in Vi}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418
Bram Moolenaar6c0b44b2005-06-01 21:56:33 +0000419:redi[r] @*> Redirect messages to the clipboard. For backward
420 compatibility, the ">" after the register name can be
421 omitted. {not in Vi}
Bram Moolenaar34cdc3e2005-05-18 22:24:46 +0000422:redi[r] @*>> Append messages to the clipboard. {not in Vi}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423
Bram Moolenaar6c0b44b2005-06-01 21:56:33 +0000424:redi[r] @"> Redirect messages to the unnamed register. For
425 backward compatibility, the ">" after the register
426 name can be omitted. {not in Vi}
Bram Moolenaar34cdc3e2005-05-18 22:24:46 +0000427:redi[r] @">> Append messages to the unnamed register. {not in Vi}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428
Bram Moolenaar5313dcb2005-02-22 08:56:13 +0000429:redi[r] => {var} Redirect messages to a variable. If the variable
430 doesn't exist, then it is created. If the variable
431 exists, then it is initialized to an empty string.
432 Only string variables can be used. After the
433 redirection starts, if the variable is removed or
434 locked or the variable type is changed, then further
435 command output messages will cause errors. {not in Vi}
436
437:redi[r] =>> {var} Append messages to an existing variable. Only string
438 variables can be used. {not in Vi}
439
Bram Moolenaar071d4272004-06-13 20:20:40 +0000440:redi[r] END End redirecting messages. {not in Vi}
441
442 *:sil* *:silent*
443:sil[ent][!] {command} Execute {command} silently. Normal messages will not
444 be given or added to the message history.
445 When [!] is added, error messages will also be
446 skipped, and commands and mappings will not be aborted
447 when an error is detected. |v:errmsg| is still set.
448 When [!] is not used, an error message will cause
449 further messages to be displayed normally.
450 Redirection, started with |:redir|, will continue as
451 usual, although there might be small differences.
452 This will allow redirecting the output of a command
453 without seeing it on the screen. Example: >
454 :redir >/tmp/foobar
455 :silent g/Aap/p
456 :redir END
457< To execute a Normal mode command silently, use the
458 |:normal| command. For example, to search for a
459 string without messages: >
460 :silent exe "normal /path\<CR>"
461< ":silent!" is useful to execute a command that may
462 fail, but the failure is to be ignored. Example: >
463 :let v:errmsg = ""
464 :silent! /^begin
465 :if v:errmsg != ""
466 : ... pattern was not found
467< ":silent" will also avoid the hit-enter prompt. When
468 using this for an external command, this may cause the
469 screen to be messed up. Use |CTRL-L| to clean it up
470 then.
471 ":silent menu ..." defines a menu that will not echo a
472 Command-line command. The command will still produce
473 messages though. Use ":silent" in the command itself
474 to avoid that: ":silent menu .... :silent command".
475
476 *:verb* *:verbose*
477:[count]verb[ose] {command}
478 Execute {command} with 'verbose' set to [count]. If
Bram Moolenaared203462004-06-16 11:19:22 +0000479 [count] is omitted one is used. ":0verbose" can be
480 used to set 'verbose' to zero.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481 The additional use of ":silent" makes messages
482 generated but not displayed.
483 The combination of ":silent" and ":verbose" can be
484 used to generate messages and check them with
485 |v:statusmsg| and friends. For example: >
486 :let v:statusmsg = ""
487 :silent verbose runtime foobar.vim
488 :if v:statusmsg != ""
489 : " foobar.vim could not be found
490 :endif
491< When concatenating another command, the ":verbose"
492 only applies to the first one: >
493 :4verbose set verbose | set verbose
494< verbose=4 ~
495 verbose=0 ~
Bram Moolenaar54ee7752005-05-31 22:22:17 +0000496 For logging verbose messages in a file use the
497 'verbosefile' option.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000498
Bram Moolenaar8aff23a2005-08-19 20:40:30 +0000499 *:verbose-cmd*
500When 'verbose' is non-zero, listing the value of a Vim option or a key map or
Bram Moolenaare344bea2005-09-01 20:46:49 +0000501an abbreviation or a user-defined function or a command or a highlight group
502or an autocommand will also display where it was last defined. If it was
503defined manually then there will be no "Last set" message. When it was
504defined while executing a function, user command or autocommand, the script in
505which it was defined is reported.
Bram Moolenaar8aff23a2005-08-19 20:40:30 +0000506{not available when compiled without the +eval feature}
507
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508 *K*
509K Run a program to lookup the keyword under the
510 cursor. The name of the program is given with the
511 'keywordprg' (kp) option (default is "man"). The
512 keyword is formed of letters, numbers and the
513 characters in 'iskeyword'. The keyword under or
514 right of the cursor is used. The same can be done
515 with the command >
516 :!{program} {keyword}
517< There is an example of a program to use in the tools
518 directory of Vim. It is called 'ref' and does a
519 simple spelling check.
520 Special cases:
521 - If 'keywordprg' is empty, the ":help" command is
522 used. It's a good idea to include more characters
523 in 'iskeyword' then, to be able to find more help.
524 - When 'keywordprg' is equal to "man", a count before
525 "K" is inserted after the "man" command and before
526 the keyword. For example, using "2K" while the
527 cursor is on "mkdir", results in: >
528 !man 2 mkdir
529< - When 'keywordprg' is equal to "man -s", a count
530 before "K" is inserted after the "-s". If there is
531 no count, the "-s" is removed.
532 {not in Vi}
533
534 *v_K*
535{Visual}K Like "K", but use the visually highlighted text for
536 the keyword. Only works when the highlighted text is
537 not more than one line. {not in Vi}
538
539[N]gs *gs* *:sl* *:sleep*
540:[N]sl[eep] [N] [m] Do nothing for [N] seconds. When [m] is included,
Bram Moolenaar13fcaaf2005-04-15 21:13:42 +0000541 sleep for [N] milliseconds. The count for "gs" always
Bram Moolenaar071d4272004-06-13 20:20:40 +0000542 uses seconds. The default is one second. >
543 :sleep "sleep for one second
544 :5sleep "sleep for five seconds
545 :sleep 100m "sleep for a hundred milliseconds
546 10gs "sleep for ten seconds
547< Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
Bram Moolenaar677ee682005-01-27 14:41:15 +0000548 "gs" stands for "goto sleep".
549 While sleeping the cursor is positioned in the text,
550 if at a visible position. {not in Vi}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000551
552 *g_CTRL-A*
553g CTRL-A Only when Vim was compiled with MEM_PROFILING defined
554 (which is very rare): print memory usage statistics.
555 Only useful for debugging Vim.
556
557==============================================================================
5582. Online help *online-help*
559
560 *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
561<Help> or
562:h[elp] Open a window and display the help file in read-only
563 mode. If there is a help window open already, use
564 that one. Otherwise, if the current window uses the
565 full width of the screen or is at least 80 characters
566 wide, the help window will appear just above the
567 current window. Otherwise the new window is put at
568 the very top.
569 The 'helplang' option is used to select a language, if
570 the main help file is available in several languages.
571 {not in Vi}
572
573 *{subject}* *E149* *E661*
574:h[elp] {subject} Like ":help", additionally jump to the tag {subject}.
575 {subject} can include wildcards like "*", "?" and
576 "[a-z]":
577 :help z? jump to help for any "z" command
578 :help z. jump to the help for "z."
579 If there is no full match for the pattern, or there
580 are several matches, the "best" match will be used.
581 A sophisticated algorithm is used to decide which
582 match is better than another one. These items are
583 considered in the computation:
584 - A match with same case is much better than a match
585 with different case.
586 - A match that starts after a non-alphanumeric
587 character is better than a match in the middle of a
588 word.
589 - A match at or near the beginning of the tag is
590 better than a match further on.
591 - The more alphanumeric characters match, the better.
592 - The shorter the length of the match, the better.
593
594 The 'helplang' option is used to select a language, if
595 the {subject} is available in several languages.
596 To find a tag in a specific language, append "@ab",
597 where "ab" is the two-letter language code. See
598 |help-translated|.
599
600 Note that the longer the {subject} you give, the less
601 matches will be found. You can get an idea how this
602 all works by using commandline completion (type CTRL-D
603 after ":help subject").
604 If there are several matches, you can have them listed
605 by hitting CTRL-D. Example: >
606 :help cont<Ctrl-D>
607< To use a regexp |pattern|, first do ":help" and then
608 use ":tag {pattern}" in the help window. The
609 ":tnext" command can then be used to jump to other
610 matches, "tselect" to list matches and choose one. >
611 :help index| :tse z.
612< This command can be followed by '|' and another
613 command, but you don't need to escape the '|' inside a
614 help command. So these both work: >
615 :help |
616 :help k| only
617< Note that a space before the '|' is seen as part of
618 the ":help" argument.
619 You can also use <LF> or <CR> to separate the help
620 command from a following command. You need to type
621 CTRL-V first to insert the <LF> or <CR>. Example: >
622 :help so<C-V><CR>only
623< {not in Vi}
624
625:h[elp]! [subject] Like ":help", but in non-English help files prefer to
626 find a tag in a file with the same language as the
627 current file. See |help-translated|.
628
629 *:helpg* *:helpgrep*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000630:helpg[rep] {pattern}[@xx]
Bram Moolenaar071d4272004-06-13 20:20:40 +0000631 Search all help text files and make a list of lines
632 in which {pattern} matches. Jumps to the first match.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000633 The optional [@xx] specifies that only matches in the
634 "xx" language are to be found.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000635 You can navigate through the matches with the
636 |quickfix| commands, e.g., |:cnext| to jump to the
637 next one. Or use |:cwindow| to get the list of
638 matches in the quickfix window.
639 {pattern} is used as a Vim regexp |pattern|.
640 'ignorecase' is not used, add "\c" to ignore case.
641 Example for case sensitive search: >
642 :helpgrep Uganda
643< Example for case ignoring search: >
644 :helpgrep uganda\c
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000645< Example for searching in French help: >
646 :helpgrep backspace@fr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000647< Cannot be followed by another command, everything is
648 used as part of the pattern. But you can use
649 |:execute| when needed.
650 Compressed help files will not be searched (Debian
651 compresses the help files).
652 {not in Vi}
653
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000654 *:lh* *:lhelpgrep*
655:lh[elpgrep] {pattern}[@xx]
656 Same as ":helpgrep", except the location list is used
657 instead of the quickfix list. If the help window is
658 already opened, then the location list for that window
659 is used. Otherwise, a new help window is opened and
660 the location list for that window is set. The
661 location list for the current window is not changed.
662
Bram Moolenaarb5bf5b82004-12-24 14:35:23 +0000663 *:exu* *:exusage*
664:exu[sage] Show help on Ex commands. Added to simulate the Nvi
665 command. {not in Vi}
666
667 *:viu* *:viusage*
668:viu[sage] Show help on Normal mode commands. Added to simulate
669 the Nvi command. {not in Vi}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000670
671When no argument is given to |:help| the file given with the 'helpfile' option
672will be opened. Otherwise the specified tag is searched for in all "doc/tags"
673files in the directories specified in the 'runtimepath' option.
674
675The initial height of the help window can be set with the 'helpheight' option
676(default 20).
677
678Jump to specific subjects by using tags. This can be done in two ways:
679- Use the "CTRL-]" command while standing on the name of a command or option.
680 This only works when the tag is a keyword. "<C-Leftmouse>" and
681 "g<LeftMouse>" work just like "CTRL-]".
682- use the ":ta {subject}" command. This also works with non-keyword
683 characters.
684
685Use CTRL-T or CTRL-O to jump back.
686Use ":q" to close the help window.
687
688If there are several matches for an item you are looking for, this is how you
689can jump to each one of them:
6901. Open a help window
6912. Use the ":tag" command with a slash prepended to the tag. E.g.: >
692 :tag /min
6933. Use ":tnext" to jump to the next matching tag.
694
695It is possible to add help files for plugins and other items. You don't need
696to change the distributed help files for that. See |add-local-help|.
697
698To write a local help file, see |write-local-help|.
699
700Note that the title lines from the local help files are automagically added to
701the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
702This is done when viewing the file in Vim, the file itself is not changed. It
703is done by going through all help files and obtaining the first line of each
704file. The files in $VIMRUNTIME/doc are skipped.
705
706 *help-xterm-window*
707If you want to have the help in another xterm window, you could use this
708command: >
709 :!xterm -e vim +help &
710<
711
712 *:helpfind* *:helpf*
713:helpf[ind] Like |:help|, but use a dialog to enter the argument.
714 Only for backwards compatibility. It now executes the
715 ToolBar.FindHelp menu entry instead of using a builtin
716 dialog. {only when compiled with |+GUI_GTK|}
717< {not in Vi}
718
719 *:helpt* *:helptags*
720 *E154* *E150* *E151* *E152* *E153* *E670*
721:helpt[ags] {dir} Generate the help tags file(s) for directory {dir}.
722 All "*.txt" and "*.??x" files in the directory are
723 scanned for a help tag definition in between stars.
724 The "*.??x" files are for translated docs, they
725 generate the "tags-??" file, see |help-translated|.
726 The generated tags files are sorted.
727 When there are duplicates an error message is given.
728 An existing tags file is silently overwritten.
729 To rebuild the help tags in the runtime directory
730 (requires write permission there): >
731 :helptags $VIMRUNTIME/doc
732< {not in Vi}
733
734
735TRANSLATED HELP *help-translated*
736
737It is possible to add translated help files, next to the original English help
738files. Vim will search for all help in "doc" directories in 'runtimepath'.
739This is only available when compiled with the |+multi_lang| feature.
740
741A set of translated help files consists of these files:
742
743 help.abx
744 howto.abx
745 ...
746 tags-ab
747
748"ab" is the two-letter language code. Thus for Italian the names are:
749
750 help.itx
751 howto.itx
752 ...
753 tags-it
754
755The 'helplang' option can be set to the preferred language(s). The default is
756set according to the environment. Vim will first try to find a matching tag
757in the preferred language(s). English is used when it cannot be found.
758
759To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
760two-letter language code. Example: >
761 :he user-manual@it
762 :he user-manual@en
763The first one finds the Italian user manual, even when 'helplang' is empty.
764The second one finds the English user manual, even when 'helplang' is set to
765"it".
766
767When using command-line completion for the ":help" command, the "@en"
768extention is only shown when a tag exists for multiple languages. When the
769tag only exists for English "@en" is omitted.
770
771When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
772find the tag in the same language. If not found then 'helplang' will be used
773to select a language.
774
775Help files must use latin1 or utf-8 encoding. Vim assumes the encoding is
776utf-8 when finding non-ASCII characters in the first line. Thus you must
777translate the header with "For Vim version".
778
779The same encoding must be used for the help files of one language in one
780directory. You can use a different encoding for different languages and use
781a different encoding for help files of the same language but in a different
782directory.
783
784Hints for translators:
785- Do not translate the tags. This makes it possible to use 'helplang' to
786 specify the preferred language. You may add new tags in your language.
787- When you do not translate a part of a file, add tags to the English version,
788 using the "tag@en" notation.
789- Make a package with all the files and the tags file available for download.
790 Users can drop it in one of the "doc" directories and start use it.
791 Report this to Bram, so that he can add a link on www.vim.org.
792- Use the |:helptags| command to generate the tags files. It will find all
793 languages in the specified directory.
794
795==============================================================================
Bram Moolenaar071d4272004-06-13 20:20:40 +00007964. Using Vim like less or more *less*
797
798If you use the less or more program to view a file, you don't get syntax
799highlighting. Thus you would like to use Vim instead. You can do this by
800using the shell script "$VIMRUNTIME/macros/less.sh".
801
802This shell script uses the Vim script "$VIMRUNTIME/macros/less.vim". It sets
803up mappings to simulate the commands that less supports. Otherwise, you can
804still use the Vim commands.
805
806This isn't perfect. For example, when viewing a short file Vim will still use
807the whole screen. But it works good enough for most uses, and you get syntax
808highlighting.
809
810The "h" key will give you a short overview of the available commands.
811
812 vim:tw=78:ts=8:ft=help:norl: