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