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