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