Start anew
[git/jnareb-git.git] / share / vim / vim58 / doc / various.txt
bloba47721d6b9296539e1d5b3befe98fd3f4888893f
1 *various.txt*   For Vim version 5.8.  Last change: 2000 Apr 22
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Various commands                                        *various*
9 1. Various commands     |various-cmds|
10 2. Online help          |online-help|
12 ==============================================================================
13 1. Various commands                                     *various-cmds*
15                                                         *CTRL-L*
16 CTRL-L                  Clear and redraw the screen.
18                                                         *N<Del>*
19 <Del>                   When entering a number: Remove the last digit.
20                         Note: if you like to use <BS> for this, add this
21                         mapping to your .vimrc:
22                                 :map CTRL-V <BS>   CTRL-V <Del>
23                         See |:fixdel| if your <Del> key does not do what you
24                         want.
26 :as[cii]        or                                      *ga* *:as* *:ascii*
27 ga                      Print the ascii value of the character under the
28                         cursor in decimal, hexadecimal and octal.  For
29                         example, when the cursor is on a 'R':
30                                 <R>  82,  Hex 52,  Octal 122
31                         When the character is a non-standard ASCII character,
32                         but printable according to the 'isprint' option, the
33                         non-printable version is also given.  When the
34                         character is larger than 127, the <M-x> form is also
35                         printed.  For example:
36                                 <~A>  <M-^A>  129,  Hex 81,  Octal 201
37                                 <p>  <|~>  <M-~>  254,  Hex fe,  Octal 376
38                         (where <p> is a special character)
39                         The <Nul> character in a file is stored internally as
40                         <NL>, but it will be shown as:
41                                 <^@>  0,  Hex 00,  Octal 000
42                         Mnemonic: Get Ascii value.  {not in Vi}
44                                                         *:p* *:pr* *:print*
45 :[range]p[rint]         Print [range] lines (default current line).
46                         Note: If you are looking for a way to print your text
47                         file, you need an external program for that.  In the
48                         GUI you can use the File.Print menu entry.
50 :[range]p[rint] {count}
51                         Print {count} lines, starting with [range] (default
52                         current line |cmdline-ranges|).
54                                                         *:P* *:Print*
55 :[range]P[rint] [count]
56                         Just as ":print".  Was apparently added to Vi for
57                         people that keep the shift key pressed too long...
59                                                         *:l* *:list*
60 :[range]l[ist] [count]
61                         Same as :print, but display unprintable characters
62                         with '^'.
64                                                         *:nu* *:number*
65 :[range]nu[mber] [count]
66                         Same as :print, but precede each line with its line
67                         number.  (See also 'highlight' option).
69                                                         *:#*
70 :[range]# [count]       synonym for :number.
72                                                         *:z*
73 :{range}z[+-^.=]{count} Display several lines of text surrounding the line
74                         specified with {range}, or around the current line
75                         if there is no {range}.  If there is a {count}, that's
76                         how many lines you'll see; otherwise, the current
77                         window size is used.
79                         :z can be used either alone or followed by any of
80                         several punctuation marks.  These have the following
81                         effect:
83                         mark   first line    last line      new location   ~
84                         ----   ----------    ---------      ------------
85                         +      current line  1 scr forward  1 scr forward
86                         -      1 scr back    current line   current line
87                         ^      2 scr back    1 scr back     1 scr back
88                         .      1/2 scr back  1/2 scr fwd    1/2 src fwd
89                         =      1/2 src back  1/2 scr fwd    current line
91                         Specifying no mark at all is the same as "+".
92                         If the mark is "=", a line of dashes is printed
93                         around the current line.
95                                                         *:=*
96 :=                      Print the cursor line number.
98 :norm[al][!] {commands}                                 *:norm* *:normal*
99                         Execute Normal mode commands {commands}.  This makes
100                         it possible to execute Normal mode commands typed on
101                         the command-line.  {commands} is executed like it is
102                         typed.  For undo all commands are undone together.
103                         If the [!] is given, mappings will not be used.
104                         {commands} should be a complete command.  If
105                         {commands} does not finish a command, more characters
106                         need to be typed, but the display isn't updated while
107                         doing this.  This implies that an insert command must
108                         be completed (to start Insert mode, see
109                         |:startinsert|).
110                         This command cannot be followed by another command,
111                         since any '|' is considered part of the command.
112                         This command can be used recursively, but the depth is
113                         limited by 'maxmapdepth'.
114                         When this command is called from a non-remappable
115                         mapping |:noremap|, the argument can be mapped anyway.
116                         An alternative is to use |:execute|, which uses an
117                         expression as argument.  This allows the use of
118                         printable characters.  Example:
119 >                               :exe "normal \<c-w>\<c-w>"
120                         Hint: If the {commands} ends in an <Esc>, Vim may
121                         think it's the start of a function key, and 'ttimeout'
122                         will apply, which makes things very slow, or even wait
123                         indefenitely for anything to be typed.  Include the
124                         [!] in this case.
125                         {not in Vi, of course}
126                         Not available when |+ex_extra| feature was disabled at
127                         compile time.
129 :{range}norm[al][!] {commands}                          *:normal-range*
130                         Execute Normal mode commands {commands} for each line
131                         in the {range}.  Before executing the {commands}, the
132                         cursor is positioned in the first column of the range,
133                         for each line.  Otherwise it's the same as the
134                         ":normal" command without a range.
135                         {not in Vi}
136                         Not available when |+ex_extra| feature was disabled at
137                         compile time.
139                                                         *:sh* *:shell*
140 :sh[ell]                This command starts a shell.  When the shell exits
141                         (after the "exit" command) you return to Vim.  The
142                         name for the shell command comes from 'shell' option.
143                         Note: This doesn't work when Vim on the Amiga was
144                         started in QuickFix mode from a compiler, because the
145                         compiler will have set stdin to a non-interactive
146                         mode.
148                                                         *:!cmd* *:!*
149 :!{cmd}                 Execute {cmd} with the shell.  See also the 'shell'
150                         and 'shelltype' option.
151                         Any '!' in {cmd} is replaced with the previous
152                         external command (see also 'cpoptions').  But not when
153                         there is a backslash before the '!', then that
154                         backslash is removed.  Example: ":!ls" followed by
155                         ":!echo ! \! \\!" executes "echo ls ! \!".
156                         After the command has been executed, the timestamp of
157                         the current file is checked |timestamp|.
158                         There cannot be a '|' in {cmd}, see |:bar|.
159                         On Unix the command normally runs in a non-interactive
160                         shell.  If you want an interactive shell to be used
161                         (to use aliases) set 'shellcmdflag' to "-ic".
162                         Also see |shell-window|.
164                                                         *:!!*
165 :!!                     Repeat last ":!{cmd}".
167                                                         *:ve* *:version*
168 :ve[rsion]              Print the version number of the editor.  If the
169                         compiler used understands "__DATE__" the compilation
170                         date is mentioned.  Otherwise a fixed release-date is
171                         shown.
172                         The following lines contain information about which
173                         features were enabled when Vim was compiled.  When
174                         there is a preceding '+', the feature is included,
175                         when there is a '-' it is excluded.  To change this,
176                         you have to edit feature.h and recompile Vim.
177                         To check for this in an expression, see |has()|.
178                         Here is an overview of the features:
180                                                         *+feature-list*
181 *+ARP*                  Amiga only: ARP support included
182 *+autocmd*              |:autocmd|, automatic commands
183 *+browse*               |:browse| command
184 *+builtin_terms*        some terminals builtin |builtin-terms|
185 *++builtin_terms*       maximal terminals builtin |builtin-terms|
186 *+byte_offset*          support for 'o' flag in 'statusline' option, "go"
187                         and ":goto" commands.
188 *+cindent*              |'cindent'|, C indenting
189 *+cmdline_compl*        command line completion |cmdline-completion|
190 *+cmdline_info*         |'showcmd'| and |'ruler'|
191 *+comments*             |'comments'| support
192 *+cryptv*               encryption support |encryption|
193 *+cscope*               |cscope| support
194 *+dialog_gui*           Support for |:confirm| with GUI dialog.
195 *+dialog_con*           Support for |:confirm| with console dialog.
196 *+dialog_con_gui*       Support for |:confirm| with GUI and console dialog.
197 *+digraphs*             |digraphs|
198 *+emacs_tags*           |emacs-tags| files
199 *+eval*                 expression evaluation |eval.txt|
200 *+ex_extra*             Vim's extra Ex commands: |:center|, |:left|,
201                         |:normal|, |:retab| and |:right|
202 *+extra_search*         |'hlsearch'| and |'incsearch'| options.
203 *+farsi*                |farsi| language
204 *+file_in_path*         |gf|, |CTRL-W_f| and |<cfile>|
205 *+find_in_path*         include file searches: |[I|, |:isearch|,
206                         |CTRL-W_CTRL-I|, |:checkpath|, etc.
207 *+fork*                 Unix only: |fork| shell commands
208 *+GUI_Athena*           Unix only: Athena |GUI|
209 *+GUI_BeOS*             BeOS only: BeOS |GUI|
210 *+GUI_GTK*              Unix only: GTK+ |GUI|
211 *+GUI_Motif*            Unix only: Motif |GUI|
212 *+hangul_input*         Hangul input support |hangul|
213 *+insert_expand*        |insert_expand| Insert mode completion
214 *+langmap*              |'langmap'|
215 *+linebreak*            |'linebreak'|, |'breakat'| and |'showbreak'|
216 *+lispindent*           |'lisp'|
217 *+menu*                 |:menu|
218 *+mksession*            |:mksession|
219 *+modify_fname*         |filename-modifiers|
220 *+mouse*                Mouse handling |mouse-using|
221 *+mouse_dec*            Unix only: Dec terminal mouse handling |dec-mouse|
222 *+mouse_gpm*            Unix only: Linux console mouse handling |gpm-mouse|
223 *+mouse_netterm*        Unix only: netterm mouse handling |netterm-mouse|
224 *+mouse_xterm*          Unix only: xterm mouse handling |xterm-mouse|
225 *+multi_byte*           Korean and other languages |multibyte|
226 *+multi_byte_ime*       Win32 input method for multi_byte characters.
227 *+ole*                  Win32 GUI only: |ole-interface|
228 *+osfiletype*           Support for the 'osfiletype' option and filetype
229                         checking in automatic commands.  |autocmd-osfiletypes|
230 *+perl*                 Perl interface |perl|
231 *+python*               Python interface |python|
232 *+quickfix*             |:make| and |quickfix| commands
233 *+rightleft*            Right to left typing |'rightleft'|
234 *+scrollbind*           |'scrollbind'|
235 *+smartindent*          |'smartindent'|
236 *+sniff*                SniFF interface (no docs available...)
237 *+statusline*           Options 'statusline', 'rulerformat' and special
238                         formats of 'titlestring' and 'iconstring'
239 *+syntax*               Syntax highlighting |syntax|
240 *+system()*             Unix only: opposite of |+fork|
241 *+tag_binary*           binary searching in tags file |tag-binary-search|
242 *+tag_old_static*       old method for static tags |tag-old-static|
243 *+tag_any_white*        any white space allowed in tags file |tag-any-white|
244 *+tcl*                  Tcl interface |tcl|
245 *+terminfo*             uses |terminfo| instead of termcap
246 *+textobjects*          |text-objects| selection
247 *+tgetent*              non-Unix only: able to use external termcap
248 *+title*                Setting the window title |'title'|
249 *+user_commands*        User-defined commands. |user-commands|
250 *+viminfo*              |'viminfo'|
251 *+visualextra*          Extra Visual mode commands |blockwise-operators|
252 *+wildignore*           |'wildignore'|
253 *+wildmenu*             |'wildmenu'|
254 *+writebackup*          |'writebackup'| is default on
255 *+xim*                  X input method |xim|
256 *+xfontset*             X fontset support |xfontset|
257 *+xterm_clipboard*      Unix only: xterm clipboard handling
258 *+xterm_save*           Save and restore xterm screen |xterm-screens|
259 *+X11*                  Unix only: can restore window title |X11|
261 :ve[rsion] {nr}         Is now ignored.  This was previously used to check the
262                         version number of a .vimrc file.  It was removed,
263                         because you can now use the ":if" command for
264                         version-dependent behavior.  {not in Vi}
266                                                         *:redi* *:redir*
267 :redi[r][!] > {file}    Redirect messages to file {file}.  The messages which
268                         are the output of commands are written to that file,
269                         until redirection ends.  The messages are also still
270                         shown on the screen.  When [!] is included, an
271                         existing file is overwritten.  When [!] is omitted,
272                         and {file} exists, this command fails.  {not in Vi}
274 :redi[r] >> {file}      Redirect message to file {file}.  Append if {file}
275                         already exists.  {not in Vi}
277 :redi[r] @{a-zA-Z}      Redirect message to register {a-z}.  Append to the
278                         contents of the register if its name is given
279                         uppercase {A-Z}.  {not in Vi}
281 :redi[r] END            End redirecting messages.  {not in Vi}
283                                                         *K*
284 K                       Run a program to lookup the keyword under the
285                         cursor.  The name of the program is given with the
286                         'keywordprg' (kp) option (default is "man").  The
287                         keyword is formed of letters, numbers and the
288                         characters in 'iskeyword'.  The keyword under or
289                         right of the cursor is used.  The same can be done
290                         with the command
291 >                               :!{program} {keyword}
292                         There is an example of a program to use in the tools
293                         directory of Vim.  It is called 'ref' and does a
294                         simple spelling check.
295                         Special cases:
296                         - If 'keywordprg' is empty, the ":help" command is
297                           used.  It's a good idea to include more characters
298                           in 'iskeyword' then, to be able to find more help.
299                         - When 'keywordprg' is equal to "man", a count before
300                           "K" is inserted after the "man" command and before
301                           the keyword.  For example, using "2K" while the
302                           cursor is on "mkdir", results in:
303 >                               !man 2 mkdir
304                         - When 'keywordprg' is equal to "man -s", a count
305                           before "K" is inserted after the "-s".  If there is
306                           no count, the "-s" is removed.
307                         {not in Vi}
309                                                         *v_K*
310 {Visual}K               Like "K", but use the visually highlighted text for
311                         the keyword.  Only works when the highlighted text is
312                         not more than one line.  {not in Vi}
314 [N]gs                                                   *gs* *:sl* *:sleep*
315 :[N]sl[eep] [N] [m]     Do nothing for [N] seconds.  When [m] is included,
316                         sleep for [N] milliseconds.
317 >  :sleep         "sleep for one second
318 >  :5sleep        "sleep for five seconds
319 >  :sleep 100m    "sleep for hunderd millisonds
320                         Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
321                         "gs" stands for "goto sleep".  While sleeping the
322                         cursor is positioned in the text (if visible).  {not
323                         in Vi}
325                                                         *g_CTRL-A*
326 g CTRL-A                Only when Vim was compiled with MEM_PROFILING defined
327                         (which is very rare): print memory usage statistics.
328                         Only useful for debugging Vim.
330 ==============================================================================
331 2. Online help                                          *online-help*
333                         *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
334 <Help>          or
335 :h[elp]                 Split the window and display the help file in
336                         read-only mode.  If there is a help window open
337                         already, use that one.  {not in Vi}
339                                                                 *{subject}*
340 :h[elp] {subject}       Like ":help", additionally jump to the tag {subject}.
341                         {subject} can include wildcards like "*", "?" and
342                         "[a-z]":
343                            :help z?     jump to help for any "z" command
344                            :help z.     jump to the help for "z."
345                         If there is no full match for the pattern, or there
346                         are several matches, the "best" match will be used.
347                         A sophisticated algorithm is used to decide which
348                         match is better than another one.  These items are
349                         considered in the computation:
350                         - A match with same case is much better than a match
351                           with different case.
352                         - A match that starts after a non-alphanumeric
353                           character is better than a match in the middle of a
354                           word.
355                         - A match at or near the beginning of the tag is
356                           better than a match further on.
357                         - The more alphanumeric characters match, the better.
358                         - The shorter the length of the match, the better.
359                         Note that the longer the {subject} you give, the less
360                         matches will be found.  You can get an idea how this
361                         all works by using commandline completion (type CTRL-D
362                         after ":help subject").
363                         If there are several matches, you can have them listed
364                         by hitting CTRL-D.  Example:
365 >                               :help cont<Ctrl-D>
366                         To use a regexp |pattern|, first do ":help" and then
367                         use ":tag {pattern}" in the help window.  The
368                         ":tnext" command can then be used to jump to other
369                         matches, "tselect" to list matches and choose one.
370 >                               :help index| :tse z.
371                         This command can be followed by '|' and another
372                         command, but you don't need to escape the '|' inside a
373                         help command.  So these both work:
374 >                               :help |
375 >                               :help k| only
376                         Note that a space before the '|' is seen as part of
377                         the ":help" argument.
378                         You can also use <LF> or <CR> to separate the help
379                         command from a following command.  You need to type
380                         CTRL-V first to insert the <LF> or <CR>.  Example:
381 >                               :help so<C-V><CR>only
382                         {not in Vi}
384 The help file name can be set with the 'helpfile' option.  The initial height
385 of the help window can be set with the 'helpheight' option (default 20).
386 Jump to specific subjects by using tags.  This can be done in two ways:
387 - Use the "CTRL-]" command while standing on the name of a command or option.
388   This only works when the tag is a keyword.  "<C-Leftmouse>" and
389   "g<LeftMouse>" work just like "CTRL-]".
390 - use the ":ta {subject}" command.  This works with all characters.
392 Use "CTRL-T" to jump back.
393 Use ":q" to close the help window.
395                                                         *help-xterm-window*
396 If you want to have the help in another xterm window, you could use this
397 command:
398         :!xterm -e vim +help &
401                         *:helpfind* *:helpf*
402 :helpf[ind]             Like |:help|, but use a dialog to enter the argument.
403                         {only when compiled with |+GUI_GTK|}
405  vim:tw=78:ts=8:sw=8: