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