Add support for :winpos
[MacVim.git] / runtime / doc / various.txt
blob484c639d1f905190660419e63ce3b6c65c76ffd0
1 *various.txt*   For Vim version 7.2.  Last change: 2009 Nov 11
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Various commands                                        *various*
9 1. Various commands             |various-cmds|
10 2. Online help                  |online-help|
11 3. Using Vim like less or more  |less|
13 ==============================================================================
14 1. Various commands                                     *various-cmds*
16                                                         *CTRL-L*
17 CTRL-L                  Clear and redraw the screen.  The redraw may happen
18                         later, after processing typeahead.
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.
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.
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.
42 :as[cii]        or                                      *ga* *:as* *:ascii*
43 ga                      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                         If the character has composing characters these are
59                         also shown.  The value of 'maxcombine' doesn't matter.
60                         Mnemonic: Get Ascii value.  {not in Vi}
62                                                         *g8*
63 g8                      Print the hex values of the bytes used in the
64                         character under the cursor, assuming it is in |UTF-8|
65                         encoding.  This also shows composing characters.  The
66                         value of 'maxcombine' doesn't matter.
67                         Example of a character with two composing characters:
68                                 e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
69                         {not in Vi} {only when compiled with the |+multi_byte|
70                         feature}
72                                                         *8g8*
73 8g8                     Find an illegal UTF-8 byte sequence at or after the
74                         cursor.  This works in two situations:
75                         1. when 'encoding' is any 8-bit encoding
76                         2. when 'encoding' is "utf-8" and 'fileencoding' is
77                            any 8-bit encoding
78                         Thus it can be used when editing a file that was
79                         supposed to be UTF-8 but was read as if it is an 8-bit
80                         encoding because it contains illegal bytes.
81                         Does not wrap around the end of the file.
82                         Note that when the cursor is on an illegal byte or the
83                         cursor is halfway a multi-byte character the command
84                         won't move the cursor.
85                         {not in Vi} {only when compiled with the |+multi_byte|
86                         feature}
88                                                 *:p* *:pr* *:print* *E749*
89 :[range]p[rint] [flags]
90                         Print [range] lines (default current line).
91                         Note: If you are looking for a way to print your text
92                         on paper see |:hardcopy|.  In the GUI you can use the
93                         File.Print menu entry.
94                         See |ex-flags| for [flags].
96 :[range]p[rint] {count} [flags]
97                         Print {count} lines, starting with [range] (default
98                         current line |cmdline-ranges|).
99                         See |ex-flags| for [flags].
101                                                         *:P* *:Print*
102 :[range]P[rint] [count] [flags]
103                         Just as ":print".  Was apparently added to Vi for
104                         people that keep the shift key pressed too long...
105                         See |ex-flags| for [flags].
107                                                         *:l* *:list*
108 :[range]l[ist] [count] [flags]
109                         Same as :print, but display unprintable characters
110                         with '^' and put $ after the line.
111                         See |ex-flags| for [flags].
113                                                         *:nu* *:number*
114 :[range]nu[mber] [count] [flags]
115                         Same as :print, but precede each line with its line
116                         number.  (See also 'highlight' and 'numberwidth'
117                         option).
118                         See |ex-flags| for [flags].
120                                                         *:#*
121 :[range]# [count] [flags]
122                         synonym for :number.
124                                                         *:#!*
125 :#!{anything}           Ignored, so that you can start a Vim script with: >
126                                 #!vim -S
127                                 echo "this is a Vim script"
128                                 quit
130                                                         *:z* *E144*
131 :{range}z[+-^.=]{count} Display several lines of text surrounding the line
132                         specified with {range}, or around the current line
133                         if there is no {range}.  If there is a {count}, that's
134                         how many lines you'll see; if there is only one window
135                         then the 'window' option is used, otherwise the
136                         current window size is used.
138                         :z can be used either alone or followed by any of
139                         several punctuation marks.  These have the following
140                         effect:
142                         mark   first line    last line      new location   ~
143                         ----   ----------    ---------      ------------
144                         +      current line  1 scr forward  1 scr forward
145                         -      1 scr back    current line   current line
146                         ^      2 scr back    1 scr back     1 scr back
147                         .      1/2 scr back  1/2 scr fwd    1/2 scr fwd
148                         =      1/2 scr back  1/2 scr fwd    current line
150                         Specifying no mark at all is the same as "+".
151                         If the mark is "=", a line of dashes is printed
152                         around the current line.
154 :{range}z#[+-^.=]{count}                                *:z#*
155                         Like ":z", but number the lines.
156                         {not in all versions of Vi, not with these arguments}
158                                                         *:=*
159 := [flags]              Print the last line number.
160                         See |ex-flags| for [flags].
162 :{range}= [flags]       Prints the last line number in {range}.  For example,
163                         this prints the current line number: >
164                                 :.=
165 <                       See |ex-flags| for [flags].
167 :norm[al][!] {commands}                                 *:norm* *:normal*
168                         Execute Normal mode commands {commands}.  This makes
169                         it possible to execute Normal mode commands typed on
170                         the command-line.  {commands} is executed like it is
171                         typed.  For undo all commands are undone together.
172                         Execution stops when an error is encountered.
173                         If the [!] is given, mappings will not be used.
174                         {commands} should be a complete command.  If
175                         {commands} does not finish a command, the last one
176                         will be aborted as if <Esc> or <C-C> was typed.
177                         The display isn't updated while ":normal" is busy.
178                         This implies that an insert command must be completed
179                         (to start Insert mode, see |:startinsert|).  A ":"
180                         command must be completed as well.  And you can't use
181                         "Q" or "gQ" to start Ex mode.
182                         {commands} cannot start with a space.  Put a count of
183                         1 (one) before it, "1 " is one space.
184                         The 'insertmode' option is ignored for {commands}.
185                         This command cannot be followed by another command,
186                         since any '|' is considered part of the command.
187                         This command can be used recursively, but the depth is
188                         limited by 'maxmapdepth'.
189                         When this command is called from a non-remappable
190                         mapping |:noremap|, the argument can be mapped anyway.
191                         An alternative is to use |:execute|, which uses an
192                         expression as argument.  This allows the use of
193                         printable characters.  Example: >
194                                 :exe "normal \<c-w>\<c-w>"
195 <                       {not in Vi, of course}
196                         {not available when the |+ex_extra| feature was
197                         disabled at compile time}
199 :{range}norm[al][!] {commands}                          *:normal-range*
200                         Execute Normal mode commands {commands} for each line
201                         in the {range}.  Before executing the {commands}, the
202                         cursor is positioned in the first column of the range,
203                         for each line.  Otherwise it's the same as the
204                         ":normal" command without a range.
205                         {not in Vi}
206                         Not available when |+ex_extra| feature was disabled at
207                         compile time.
209                                                         *:sh* *:shell* *E371*
210 :sh[ell]                This command starts a shell.  When the shell exits
211                         (after the "exit" command) you return to Vim.  The
212                         name for the shell command comes from 'shell' option.
213                                                         *E360*
214                         Note: This doesn't work when Vim on the Amiga was
215                         started in QuickFix mode from a compiler, because the
216                         compiler will have set stdin to a non-interactive
217                         mode.
219                                                         *:!cmd* *:!* *E34*
220 :!{cmd}                 Execute {cmd} with the shell.  See also the 'shell'
221                         and 'shelltype' option.
222                         Any '!' in {cmd} is replaced with the previous
223                         external command (see also 'cpoptions').  But not when
224                         there is a backslash before the '!', then that
225                         backslash is removed.  Example: ":!ls" followed by
226                         ":!echo ! \! \\!" executes "echo ls ! \!".
227                         After the command has been executed, the timestamp of
228                         the current file is checked |timestamp|.
229                         A '|' in {cmd} is passed to the shell, you cannot use
230                         it to append a Vim command.  See |:bar|.
231                         A newline character ends {cmd}, what follows is
232                         interpreted as a following ":" command.  However, if
233                         there is a backslash before the newline it is removed
234                         and {cmd} continues.  It doesn't matter how many
235                         backslashes are before the newline, only one is
236                         removed.
237                         On Unix the command normally runs in a non-interactive
238                         shell.  If you want an interactive shell to be used
239                         (to use aliases) set 'shellcmdflag' to "-ic".
240                         For Win32 also see |:!start|.
241                         Vim redraws the screen after the command is finished,
242                         because it may have printed any text.  This requires a
243                         hit-enter prompt, so that you can read any messages.
244                         To avoid this use: >
245                                 :silent !{cmd}
246 <                       The screen is not redrawn then, thus you have to use
247                         CTRL-L or ":redraw!" if the command did display
248                         something.
249                         Also see |shell-window|.
251                                                         *:!!*
252 :!!                     Repeat last ":!{cmd}".
254                                                         *:ve* *:version*
255 :ve[rsion]              Print the version number of the editor.  If the
256                         compiler used understands "__DATE__" the compilation
257                         date is mentioned.  Otherwise a fixed release-date is
258                         shown.
259                         The following lines contain information about which
260                         features were enabled when Vim was compiled.  When
261                         there is a preceding '+', the feature is included,
262                         when there is a '-' it is excluded.  To change this,
263                         you have to edit feature.h and recompile Vim.
264                         To check for this in an expression, see |has()|.
265                         Here is an overview of the features.
266                         The first column shows the smallest version in which
267                         they are included:
268                            T    tiny
269                            S    small
270                            N    normal
271                            B    big
272                            H    huge
273                            m    manually enabled or depends on other features
274                          (none) system dependent
275                         Thus if a feature is marked with "N", it is included
276                         in the normal, big and huge versions of Vim.
278                                                         *+feature-list*
279    *+ARP*               Amiga only: ARP support included
280 B  *+arabic*            |Arabic| language support
281 N  *+autocmd*           |:autocmd|, automatic commands
282 m  *+balloon_eval*      |balloon-eval| support. Included when compiling with
283                         supported GUI (Motif, GTK, GUI) and either
284                         Netbeans/Sun Workshop integration or |+eval| feature.
285 N  *+browse*            |:browse| command
286 N  *+builtin_terms*     some terminals builtin |builtin-terms|
287 B  *++builtin_terms*    maximal terminals builtin |builtin-terms|
288 N  *+byte_offset*       support for 'o' flag in 'statusline' option, "go"
289                         and ":goto" commands.
290 N  *+cindent*           |'cindent'|, C indenting
291 N  *+clientserver*      Unix and Win32: Remote invocation |clientserver|
292    *+clipboard*         |clipboard| support
293 N  *+cmdline_compl*     command line completion |cmdline-completion|
294 N  *+cmdline_hist*      command line history |cmdline-history|
295 N  *+cmdline_info*      |'showcmd'| and |'ruler'|
296 N  *+comments*          |'comments'| support
297 N  *+cryptv*            encryption support |encryption|
298 B  *+cscope*            |cscope| support
299 m  *+cursorshape*       |termcap-cursor-shape| support
300 m  *+debug*             Compiled for debugging.
301 N  *+dialog_gui*        Support for |:confirm| with GUI dialog.
302 N  *+dialog_con*        Support for |:confirm| with console dialog.
303 N  *+dialog_con_gui*    Support for |:confirm| with GUI and console dialog.
304 N  *+diff*              |vimdiff| and 'diff'
305 N  *+digraphs*          |digraphs| *E196*
306    *+dnd*               Support for DnD into the "~ register |quote_~|.
307 B  *+emacs_tags*        |emacs-tags| files
308 N  *+eval*              expression evaluation |eval.txt|
309 N  *+ex_extra*          Vim's extra Ex commands: |:center|, |:left|,
310                         |:normal|, |:retab| and |:right|
311 N  *+extra_search*      |'hlsearch'| and |'incsearch'| options.
312 B  *+farsi*             |farsi| language
313 N  *+file_in_path*      |gf|, |CTRL-W_f| and |<cfile>|
314 N  *+find_in_path*      include file searches: |[I|, |:isearch|,
315                         |CTRL-W_CTRL-I|, |:checkpath|, etc.
316 N  *+folding*           |folding|
317    *+footer*            |gui-footer|
318    *+fork*              Unix only: |fork| shell commands
319 m  *+fullscreen*        MacVim only: edit in full-screen
320    *+float*             Floating point support
321 N  *+gettext*           message translations |multi-lang|
322    *+GUI_Athena*        Unix only: Athena |GUI|
323    *+GUI_neXtaw*        Unix only: neXtaw |GUI|
324    *+GUI_GTK*           Unix only: GTK+ |GUI|
325    *+GUI_Motif*         Unix only: Motif |GUI|
326    *+GUI_Photon*        QNX only:  Photon |GUI|
327 m  *+hangul_input*      Hangul input support |hangul|
328    *+iconv*             Compiled with the |iconv()| function
329    *+iconv/dyn*         Likewise |iconv-dynamic| |/dyn|
330 N  *+insert_expand*     |insert_expand| Insert mode completion
331 N  *+jumplist*          |jumplist|
332 B  *+keymap*            |'keymap'|
333 B  *+langmap*           |'langmap'|
334 N  *+libcall*           |libcall()|
335 N  *+linebreak*         |'linebreak'|, |'breakat'| and |'showbreak'|
336 N  *+lispindent*        |'lisp'|
337 N  *+listcmds*          Vim commands for the list of buffers |buffer-hidden|
338                         and argument list |:argdelete|
339 N  *+localmap*          Support for mappings local to a buffer |:map-local|
340 N  *+menu*              |:menu|
341 N  *+mksession*         |:mksession|
342 N  *+modify_fname*      |filename-modifiers|
343 N  *+mouse*             Mouse handling |mouse-using|
344 N  *+mouseshape*        |'mouseshape'|
345 B  *+mouse_dec*         Unix only: Dec terminal mouse handling |dec-mouse|
346 N  *+mouse_gpm*         Unix only: Linux console mouse handling |gpm-mouse|
347 B  *+mouse_netterm*     Unix only: netterm mouse handling |netterm-mouse|
348 N  *+mouse_pterm*       QNX only: pterm mouse handling |qnx-terminal|
349 N  *+mouse_sysmouse*    Unix only: *BSD console mouse handling |sysmouse|
350 N  *+mouse_xterm*       Unix only: xterm mouse handling |xterm-mouse|
351 B  *+multi_byte*        16 and 32 bit characters |multibyte|
352    *+multi_byte_ime*    Win32 input method for multibyte chars |multibyte-ime|
353 N  *+multi_lang*        non-English language support |multi-lang|
354 m  *+mzscheme*          Mzscheme interface |mzscheme|
355 m  *+mzscheme/dyn*      Mzscheme interface |mzscheme-dynamic| |/dyn|
356 m  *+netbeans_intg*     |netbeans|
357 m  *+odbeditor*         MacVim only: ODB Editor Protocol support |odbeditor|
358 m  *+ole*               Win32 GUI only: |ole-interface|
359    *+osfiletype*        Support for the 'osfiletype' option and filetype
360                         checking in automatic commands.  |autocmd-osfiletypes|
361 N  *+path_extra*        Up/downwards search in 'path' and 'tags'
362 m  *+perl*              Perl interface |perl|
363 m  *+perl/dyn*          Perl interface |perl-dynamic| |/dyn|
364    *+postscript*        |:hardcopy| writes a PostScript file
365 N  *+printer*           |:hardcopy| command
366 H  *+profile*           |:profile| command
367 m  *+python*            Python interface |python|
368 m  *+python/dyn*        Python interface |python-dynamic| |/dyn|
369 N  *+quickfix*          |:make| and |quickfix| commands
370 N  *+reltime*           |reltime()| function, 'hlsearch'/'incsearch' timeout,
371                         'redrawtime' option
372 B  *+rightleft*         Right to left typing |'rightleft'|
373 m  *+ruby*              Ruby interface |ruby|
374 m  *+ruby/dyn*          Ruby interface |ruby-dynamic| |/dyn|
375 N  *+scrollbind*        |'scrollbind'|
376 B  *+signs*             |:sign|
377 N  *+smartindent*       |'smartindent'|
378 m  *+sniff*             SniFF interface |sniff|
379 N  *+startuptime*       |--startuptime| argument
380 N  *+statusline*        Options 'statusline', 'rulerformat' and special
381                         formats of 'titlestring' and 'iconstring'
382 m  *+sun_workshop*      |workshop|
383 N  *+syntax*            Syntax highlighting |syntax|
384    *+system()*          Unix only: opposite of |+fork|
385 N  *+tag_binary*        binary searching in tags file |tag-binary-search|
386 N  *+tag_old_static*    old method for static tags |tag-old-static|
387 m  *+tag_any_white*     any white space allowed in tags file |tag-any-white|
388 m  *+tcl*               Tcl interface |tcl|
389 m  *+tcl/dyn*           Tcl interface |tcl-dynamic| |/dyn|
390    *+terminfo*          uses |terminfo| instead of termcap
391 N  *+termresponse*      support for |t_RV| and |v:termresponse|
392 N  *+textobjects*       |text-objects| selection
393    *+tgetent*           non-Unix only: able to use external termcap
394 N  *+title*             Setting the window 'title' and 'icon'
395 N  *+toolbar*           |gui-toolbar|
396 m  *+transparency*      MacVim only: window background transparency
397 N  *+user_commands*     User-defined commands. |user-commands|
398 N  *+viminfo*           |'viminfo'|
399 N  *+vertsplit*         Vertically split windows |:vsplit|
400 N  *+virtualedit*       |'virtualedit'|
401 S  *+visual*            Visual mode |Visual-mode|
402 N  *+visualextra*       extra Visual mode commands |blockwise-operators|
403 N  *+vreplace*          |gR| and |gr|
404 N  *+wildignore*        |'wildignore'|
405 N  *+wildmenu*          |'wildmenu'|
406 S  *+windows*           more than one window
407 m  *+writebackup*       |'writebackup'| is default on
408 m  *+xim*               X input method |xim|
409    *+xfontset*          X fontset support |xfontset|
410    *+xsmp*              XSMP (X session management) support
411    *+xsmp_interact*     interactive XSMP (X session management) support
412 N  *+xterm_clipboard*   Unix only: xterm clipboard handling
413 m  *+xterm_save*        save and restore xterm screen |xterm-screens|
414 N  *+X11*               Unix only: can restore window title |X11|
416                                                         */dyn* *E370* *E448*
417                         To some of the features "/dyn" is added when the
418                         feature is only available when the related library can
419                         be dynamically loaded.
421 :ve[rsion] {nr}         Is now ignored.  This was previously used to check the
422                         version number of a .vimrc file.  It was removed,
423                         because you can now use the ":if" command for
424                         version-dependent behavior.  {not in Vi}
426                                                         *:redi* *:redir*
427 :redi[r][!] > {file}    Redirect messages to file {file}.  The messages which
428                         are the output of commands are written to that file,
429                         until redirection ends.  The messages are also still
430                         shown on the screen.  When [!] is included, an
431                         existing file is overwritten.  When [!] is omitted,
432                         and {file} exists, this command fails.
433                         Only one ":redir" can be active at a time.  Calls to
434                         ":redir" will close any active redirection before
435                         starting redirection to the new target.
436                         To stop the messages and commands from being echoed to
437                         the screen, put the commands in a function and call it
438                         with ":silent call Function()".
439                         An alternative is to use the 'verbosefile' option,
440                         this can be used in combination with ":redir".
441                         {not in Vi}
443 :redi[r] >> {file}      Redirect messages to file {file}.  Append if {file}
444                         already exists.  {not in Vi}
446 :redi[r] @{a-zA-Z}
447 :redi[r] @{a-zA-Z}>     Redirect messages to register {a-z}.  Append to the
448                         contents of the register if its name is given
449                         uppercase {A-Z}.  The ">" after the register name is
450                         optional. {not in Vi}
451 :redi[r] @{a-z}>>       Append messages to register {a-z}. {not in Vi}
453 :redi[r] @*>            
454 :redi[r] @+>            Redirect messages to the selection or clipboard. For
455                         backward compatibility, the ">" after the register
456                         name can be omitted. See |quotestar| and |quoteplus|.
457                         {not in Vi}
458 :redi[r] @*>>           
459 :redi[r] @+>>           Append messages to the selection or clipboard.
460                         {not in Vi}
462 :redi[r] @">            Redirect messages to the unnamed register. For
463                         backward compatibility, the ">" after the register
464                         name can be omitted. {not in Vi}
465 :redi[r] @">>           Append messages to the unnamed register. {not in Vi}
467 :redi[r] => {var}       Redirect messages to a variable.  If the variable
468                         doesn't exist, then it is created.  If the variable
469                         exists, then it is initialized to an empty string.
470                         The variable will remain empty until redirection ends.
471                         Only string variables can be used.  After the
472                         redirection starts, if the variable is removed or
473                         locked or the variable type is changed, then further
474                         command output messages will cause errors. {not in Vi}
476 :redi[r] =>> {var}      Append messages to an existing variable.  Only string
477                         variables can be used. {not in Vi}
479 :redi[r] END            End redirecting messages.  {not in Vi}
481                                                 *:sil* *:silent*
482 :sil[ent][!] {command}  Execute {command} silently.  Normal messages will not
483                         be given or added to the message history.
484                         When [!] is added, error messages will also be
485                         skipped, and commands and mappings will not be aborted
486                         when an error is detected.  |v:errmsg| is still set.
487                         When [!] is not used, an error message will cause
488                         further messages to be displayed normally.
489                         Redirection, started with |:redir|, will continue as
490                         usual, although there might be small differences.
491                         This will allow redirecting the output of a command
492                         without seeing it on the screen.  Example: >
493                             :redir >/tmp/foobar
494                             :silent g/Aap/p
495                             :redir END
496 <                       To execute a Normal mode command silently, use the
497                         |:normal| command.  For example, to search for a
498                         string without messages: >
499                             :silent exe "normal /path\<CR>"
500 <                       ":silent!" is useful to execute a command that may
501                         fail, but the failure is to be ignored.  Example: >
502                             :let v:errmsg = ""
503                             :silent! /^begin
504                             :if v:errmsg != ""
505                             : ... pattern was not found
506 <                       ":silent" will also avoid the hit-enter prompt.  When
507                         using this for an external command, this may cause the
508                         screen to be messed up.  Use |CTRL-L| to clean it up
509                         then.
510                         ":silent menu ..." defines a menu that will not echo a
511                         Command-line command.  The command will still produce
512                         messages though.  Use ":silent" in the command itself
513                         to avoid that: ":silent menu .... :silent command".
515                                                 *:uns* *:unsilent*
516 :uns[ilent] {command}   Execute {command} not silently.  Only makes a
517                         difference when |:silent| was used to get to this
518                         command.
519                         Use this for giving a message even when |:silent| was
520                         used.  In this example |:silent| is used to avoid the
521                         message about reading the file and |:unsilent| to be
522                         able to list the first line of each file. >
523                 :silent argdo unsilent echo expand('%') . ": " . getline(1)
526                                                 *:verb* *:verbose*
527 :[count]verb[ose] {command}
528                         Execute {command} with 'verbose' set to [count].  If
529                         [count] is omitted one is used. ":0verbose" can be
530                         used to set 'verbose' to zero.
531                         The additional use of ":silent" makes messages
532                         generated but not displayed.
533                         The combination of ":silent" and ":verbose" can be
534                         used to generate messages and check them with
535                         |v:statusmsg| and friends.  For example: >
536                                 :let v:statusmsg = ""
537                                 :silent verbose runtime foobar.vim
538                                 :if v:statusmsg != ""
539                                 :  " foobar.vim could not be found
540                                 :endif
541 <                       When concatenating another command, the ":verbose"
542                         only applies to the first one: >
543                                 :4verbose set verbose | set verbose
544 <                                 verbose=4 ~
545                                   verbose=0 ~
546                         For logging verbose messages in a file use the
547                         'verbosefile' option.
549                                                         *:verbose-cmd*
550 When 'verbose' is non-zero, listing the value of a Vim option or a key map or
551 an abbreviation or a user-defined function or a command or a highlight group
552 or an autocommand will also display where it was last defined.  If it was
553 defined manually then there will be no "Last set" message.  When it was
554 defined while executing a function, user command or autocommand, the script in
555 which it was defined is reported.
556 {not available when compiled without the +eval feature}
558                                                         *K*
559 K                       Run a program to lookup the keyword under the
560                         cursor.  The name of the program is given with the
561                         'keywordprg' (kp) option (default is "man").  The
562                         keyword is formed of letters, numbers and the
563                         characters in 'iskeyword'.  The keyword under or
564                         right of the cursor is used.  The same can be done
565                         with the command >
566                                 :!{program} {keyword}
567 <                       There is an example of a program to use in the tools
568                         directory of Vim.  It is called 'ref' and does a
569                         simple spelling check.
570                         Special cases:
571                         - If 'keywordprg' is empty, the ":help" command is
572                           used.  It's a good idea to include more characters
573                           in 'iskeyword' then, to be able to find more help.
574                         - When 'keywordprg' is equal to "man", a count before
575                           "K" is inserted after the "man" command and before
576                           the keyword.  For example, using "2K" while the
577                           cursor is on "mkdir", results in: >
578                                 !man 2 mkdir
579 <                       - When 'keywordprg' is equal to "man -s", a count
580                           before "K" is inserted after the "-s".  If there is
581                           no count, the "-s" is removed.
582                         {not in Vi}
584                                                         *v_K*
585 {Visual}K               Like "K", but use the visually highlighted text for
586                         the keyword.  Only works when the highlighted text is
587                         not more than one line.  {not in Vi}
589 [N]gs                                                   *gs* *:sl* *:sleep*
590 :[N]sl[eep] [N] [m]     Do nothing for [N] seconds.  When [m] is included,
591                         sleep for [N] milliseconds.  The count for "gs" always
592                         uses seconds.  The default is one second. >
593                              :sleep          "sleep for one second
594                              :5sleep         "sleep for five seconds
595                              :sleep 100m     "sleep for a hundred milliseconds
596                              10gs            "sleep for ten seconds
597 <                       Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
598                         "gs" stands for "goto sleep".
599                         While sleeping the cursor is positioned in the text,
600                         if at a visible position.  {not in Vi}
602                                                         *g_CTRL-A*
603 g CTRL-A                Only when Vim was compiled with MEM_PROFILING defined
604                         (which is very rare): print memory usage statistics.
605                         Only useful for debugging Vim.
607 ==============================================================================
608 2. Online help                                          *online-help*
610                         *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
611 <Help>          or
612 :h[elp]                 Open a window and display the help file in read-only
613                         mode.  If there is a help window open already, use
614                         that one.  Otherwise, if the current window uses the
615                         full width of the screen or is at least 80 characters
616                         wide, the help window will appear just above the
617                         current window.  Otherwise the new window is put at
618                         the very top.
619                         The 'helplang' option is used to select a language, if
620                         the main help file is available in several languages.
621                         {not in Vi}
623                                                 *{subject}* *E149* *E661*
624 :h[elp] {subject}       Like ":help", additionally jump to the tag {subject}.
625                         {subject} can include wildcards like "*", "?" and
626                         "[a-z]":
627                            :help z?     jump to help for any "z" command
628                            :help z.     jump to the help for "z."
629                         If there is no full match for the pattern, or there
630                         are several matches, the "best" match will be used.
631                         A sophisticated algorithm is used to decide which
632                         match is better than another one.  These items are
633                         considered in the computation:
634                         - A match with same case is much better than a match
635                           with different case.
636                         - A match that starts after a non-alphanumeric
637                           character is better than a match in the middle of a
638                           word.
639                         - A match at or near the beginning of the tag is
640                           better than a match further on.
641                         - The more alphanumeric characters match, the better.
642                         - The shorter the length of the match, the better.
644                         The 'helplang' option is used to select a language, if
645                         the {subject} is available in several languages.
646                         To find a tag in a specific language, append "@ab",
647                         where "ab" is the two-letter language code.  See
648                         |help-translated|.
650                         Note that the longer the {subject} you give, the less
651                         matches will be found.  You can get an idea how this
652                         all works by using commandline completion (type CTRL-D
653                         after ":help subject" |c_CTRL-D|).
654                         If there are several matches, you can have them listed
655                         by hitting CTRL-D.  Example: >
656                                 :help cont<Ctrl-D>
657 <                       To use a regexp |pattern|, first do ":help" and then
658                         use ":tag {pattern}" in the help window.  The
659                         ":tnext" command can then be used to jump to other
660                         matches, "tselect" to list matches and choose one. >
661                                 :help index| :tse z.
662 <                       When there is no argument you will see matches for
663                         "help", to avoid listing all possible matches (that
664                         would be very slow).
665                         The number of matches displayed is limited to 300.
667                         This command can be followed by '|' and another
668                         command, but you don't need to escape the '|' inside a
669                         help command.  So these both work: >
670                                 :help |
671                                 :help k| only
672 <                       Note that a space before the '|' is seen as part of
673                         the ":help" argument.
674                         You can also use <LF> or <CR> to separate the help
675                         command from a following command.  You need to type
676                         CTRL-V first to insert the <LF> or <CR>.  Example: >
677                                 :help so<C-V><CR>only
678 <                       {not in Vi}
680 :h[elp]! [subject]      Like ":help", but in non-English help files prefer to
681                         find a tag in a file with the same language as the
682                         current file.  See |help-translated|.
684                                                         *:helpg* *:helpgrep*
685 :helpg[rep] {pattern}[@xx]
686                         Search all help text files and make a list of lines
687                         in which {pattern} matches.  Jumps to the first match.
688                         The optional [@xx] specifies that only matches in the
689                         "xx" language are to be found.
690                         You can navigate through the matches with the
691                         |quickfix| commands, e.g., |:cnext| to jump to the
692                         next one.  Or use |:cwindow| to get the list of
693                         matches in the quickfix window.
694                         {pattern} is used as a Vim regexp |pattern|.
695                         'ignorecase' is not used, add "\c" to ignore case.
696                         Example for case sensitive search: >
697                                 :helpgrep Uganda
698 <                       Example for case ignoring search: >
699                                 :helpgrep uganda\c
700 <                       Example for searching in French help: >
701                                 :helpgrep backspace@fr
702 <                       The pattern does not support line breaks, it must
703                         match within one line.  You can use |:grep| instead,
704                         but then you need to get the list of help files in a
705                         complicated way.
706                         Cannot be followed by another command, everything is
707                         used as part of the pattern.  But you can use
708                         |:execute| when needed.
709                         Compressed help files will not be searched (Fedora
710                         compresses the help files).
711                         {not in Vi}
713                                                         *:lh* *:lhelpgrep*
714 :lh[elpgrep] {pattern}[@xx]
715                         Same as ":helpgrep", except the location list is used
716                         instead of the quickfix list. If the help window is
717                         already opened, then the location list for that window
718                         is used. Otherwise, a new help window is opened and
719                         the location list for that window is set.  The
720                         location list for the current window is not changed.
722                                                         *:exu* *:exusage*
723 :exu[sage]              Show help on Ex commands.  Added to simulate the Nvi
724                         command. {not in Vi}
726                                                         *:viu* *:viusage*
727 :viu[sage]              Show help on Normal mode commands.  Added to simulate
728                         the Nvi command. {not in Vi}
730 When no argument is given to |:help| the file given with the 'helpfile' option
731 will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
732 files in the directories specified in the 'runtimepath' option.
734 The initial height of the help window can be set with the 'helpheight' option
735 (default 20).
737 Jump to specific subjects by using tags.  This can be done in two ways:
738 - Use the "CTRL-]" command while standing on the name of a command or option.
739   This only works when the tag is a keyword.  "<C-Leftmouse>" and
740   "g<LeftMouse>" work just like "CTRL-]".
741 - use the ":ta {subject}" command.  This also works with non-keyword
742   characters.
744 Use CTRL-T or CTRL-O to jump back.
745 Use ":q" to close the help window.
747 If there are several matches for an item you are looking for, this is how you
748 can jump to each one of them:
749 1. Open a help window
750 2. Use the ":tag" command with a slash prepended to the tag.  E.g.: >
751         :tag /min
752 3. Use ":tnext" to jump to the next matching tag.
754 It is possible to add help files for plugins and other items.  You don't need
755 to change the distributed help files for that.  See |add-local-help|.
757 To write a local help file, see |write-local-help|.
759 Note that the title lines from the local help files are automagically added to
760 the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
761 This is done when viewing the file in Vim, the file itself is not changed.  It
762 is done by going through all help files and obtaining the first line of each
763 file.  The files in $VIMRUNTIME/doc are skipped.
765                                                         *help-xterm-window*
766 If you want to have the help in another xterm window, you could use this
767 command: >
768         :!xterm -e vim +help &
771                         *:helpfind* *:helpf*
772 :helpf[ind]             Like |:help|, but use a dialog to enter the argument.
773                         Only for backwards compatibility.  It now executes the
774                         ToolBar.FindHelp menu entry instead of using a builtin
775                         dialog.  {only when compiled with |+GUI_GTK|}
776 <                       {not in Vi}
778                                         *:helpt* *:helptags*
779                                 *E154* *E150* *E151* *E152* *E153* *E670*
780 :helpt[ags] [++t] {dir}
781                         Generate the help tags file(s) for directory {dir}.
782                         All "*.txt" and "*.??x" files in the directory are
783                         scanned for a help tag definition in between stars.
784                         The "*.??x" files are for translated docs, they
785                         generate the "tags-??" file, see |help-translated|.
786                         The generated tags files are sorted.
787                         When there are duplicates an error message is given.
788                         An existing tags file is silently overwritten.
789                         The optional "++t" argument forces adding the
790                         "help-tags" tag.  This is also done when the {dir} is
791                         equal to $VIMRUNTIME/doc.
792                         To rebuild the help tags in the runtime directory
793                         (requires write permission there): >
794                                 :helptags $VIMRUNTIME/doc
795 <                       {not in Vi}
798 TRANSLATED HELP                                         *help-translated*
800 It is possible to add translated help files, next to the original English help
801 files.  Vim will search for all help in "doc" directories in 'runtimepath'.
802 This is only available when compiled with the |+multi_lang| feature.
804 At this moment translations are available for:
805         Chinese - multiple authors
806         French  - translated by David Blanchet
807         Italian - translated by Antonio Colombo
808         Polish  - translated by Mikolaj Machowski
809         Russian - translated by Vassily Ragosin
810 See the Vim website to find them: http://www.vim.org/translations.php
812 A set of translated help files consists of these files:
814         help.abx
815         howto.abx
816         ...
817         tags-ab
819 "ab" is the two-letter language code.  Thus for Italian the names are:
821         help.itx
822         howto.itx
823         ...
824         tags-it
826 The 'helplang' option can be set to the preferred language(s).  The default is
827 set according to the environment.  Vim will first try to find a matching tag
828 in the preferred language(s).  English is used when it cannot be found.
830 To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
831 two-letter language code.  Example: >
832         :he user-manual@it
833         :he user-manual@en
834 The first one finds the Italian user manual, even when 'helplang' is empty.
835 The second one finds the English user manual, even when 'helplang' is set to
836 "it".
838 When using command-line completion for the ":help" command, the "@en"
839 extension is only shown when a tag exists for multiple languages.  When the
840 tag only exists for English "@en" is omitted.
842 When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
843 find the tag in the same language.  If not found then 'helplang' will be used
844 to select a language.
846 Help files must use latin1 or utf-8 encoding.  Vim assumes the encoding is
847 utf-8 when finding non-ASCII characters in the first line.  Thus you must
848 translate the header with "For Vim version".
850 The same encoding must be used for the help files of one language in one
851 directory.  You can use a different encoding for different languages and use
852 a different encoding for help files of the same language but in a different
853 directory.
855 Hints for translators:
856 - Do not translate the tags.  This makes it possible to use 'helplang' to
857   specify the preferred language.  You may add new tags in your language.
858 - When you do not translate a part of a file, add tags to the English version,
859   using the "tag@en" notation.
860 - Make a package with all the files and the tags file available for download.
861   Users can drop it in one of the "doc" directories and start use it.
862   Report this to Bram, so that he can add a link on www.vim.org.
863 - Use the |:helptags| command to generate the tags files.  It will find all
864   languages in the specified directory.
866 ==============================================================================
867 3. Using Vim like less or more                                  *less*
869 If you use the less or more program to view a file, you don't get syntax
870 highlighting.  Thus you would like to use Vim instead.  You can do this by
871 using the shell script "$VIMRUNTIME/macros/less.sh".
873 This shell script uses the Vim script "$VIMRUNTIME/macros/less.vim".  It sets
874 up mappings to simulate the commands that less supports.  Otherwise, you can
875 still use the Vim commands.
877 This isn't perfect.  For example, when viewing a short file Vim will still use
878 the whole screen.  But it works good enough for most uses, and you get syntax
879 highlighting.
881 The "h" key will give you a short overview of the available commands.
883  vim:tw=78:ts=8:ft=help:norl: