500
|
1 *various.txt* For Vim version 7.0aa. Last change: 2005 Aug 27
|
7
|
2
|
|
3
|
|
4 VIM REFERENCE MANUAL by Bram Moolenaar
|
|
5
|
|
6
|
|
7 Various commands *various*
|
|
8
|
|
9 1. Various commands |various-cmds|
|
|
10 2. Online help |online-help|
|
15
|
11 3. Using Vim like less or more |less|
|
7
|
12
|
|
13 ==============================================================================
|
|
14 1. Various commands *various-cmds*
|
|
15
|
|
16 *CTRL-L*
|
348
|
17 CTRL-L Clear and redraw the screen. The redraw may happen
|
|
18 later, after processing typeahead.
|
7
|
19
|
|
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*
|
|
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 Mnemonic: Get Ascii value. {not in Vi}
|
|
59
|
|
60 *g8*
|
|
61 g8 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*
|
169
|
70 :[range]p[rint] [flags]
|
|
71 Print [range] lines (default current line).
|
7
|
72 Note: If you are looking for a way to print your text
|
169
|
73 on paper see |:hardcopy|. In the GUI you can use the
|
|
74 File.Print menu entry.
|
|
75 See |ex-flags| for [flags].
|
7
|
76
|
169
|
77 :[range]p[rint] {count} [flags]
|
7
|
78 Print {count} lines, starting with [range] (default
|
|
79 current line |cmdline-ranges|).
|
169
|
80 See |ex-flags| for [flags].
|
7
|
81
|
|
82 *:P* *:Print*
|
169
|
83 :[range]P[rint] [count] [flags]
|
7
|
84 Just as ":print". Was apparently added to Vi for
|
|
85 people that keep the shift key pressed too long...
|
169
|
86 See |ex-flags| for [flags].
|
7
|
87
|
|
88 *:l* *:list*
|
169
|
89 :[range]l[ist] [count] [flags]
|
7
|
90 Same as :print, but display unprintable characters
|
169
|
91 with '^' and put $ after the line.
|
|
92 See |ex-flags| for [flags].
|
7
|
93
|
|
94 *:nu* *:number*
|
169
|
95 :[range]nu[mber] [count] [flags]
|
7
|
96 Same as :print, but precede each line with its line
|
|
97 number. (See also 'highlight' option).
|
169
|
98 See |ex-flags| for [flags].
|
7
|
99
|
|
100 *:#*
|
169
|
101 :[range]# [count] [flags]
|
|
102 synonym for :number.
|
7
|
103
|
|
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
|
164
|
108 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.
|
7
|
111
|
|
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
|
159
|
121 . 1/2 scr back 1/2 scr fwd 1/2 scr fwd
|
|
122 = 1/2 scr back 1/2 scr fwd current line
|
7
|
123
|
|
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 *:=*
|
169
|
133 := [flags] Print the last line number.
|
|
134 See |ex-flags| for [flags].
|
7
|
135
|
169
|
136 :{range}= [flags] Prints the last line number in {range}. For example,
|
7
|
137 this prints the current line number: >
|
|
138 :.=
|
169
|
139 < See |ex-flags| for [flags].
|
7
|
140
|
|
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 ":"
|
161
|
153 command must be completed as well. And you can't use
|
|
154 "Q" or "gQ" to start Ex mode.
|
237
|
155 {commands} cannot start with a space. Put a 1 (one)
|
7
|
156 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
|
|
252 B *+arabic* |Arabic| language support
|
|
253 N *+autocmd* |:autocmd|, automatic commands
|
191
|
254 m *+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.
|
7
|
257 N *+browse* |:browse| command
|
|
258 N *+builtin_terms* some terminals builtin |builtin-terms|
|
|
259 B *++builtin_terms* maximal terminals builtin |builtin-terms|
|
|
260 N *+byte_offset* support for 'o' flag in 'statusline' option, "go"
|
|
261 and ":goto" commands.
|
|
262 N *+cindent* |'cindent'|, C indenting
|
|
263 N *+clientserver* Unix and Win32: Remote invocation |clientserver|
|
|
264 *+clipboard* |clipboard| support
|
|
265 N *+cmdline_compl* command line completion |cmdline-completion|
|
|
266 N *+cmdline_hist* command line history |cmdline-history|
|
|
267 N *+cmdline_info* |'showcmd'| and |'ruler'|
|
|
268 N *+comments* |'comments'| support
|
|
269 N *+cryptv* encryption support |encryption|
|
|
270 B *+cscope* |cscope| support
|
500
|
271 m *+cursorshape* |termcap-cursor-shape| support
|
|
272 m *+debug* Compiled for debugging.
|
7
|
273 N *+dialog_gui* Support for |:confirm| with GUI dialog.
|
|
274 N *+dialog_con* Support for |:confirm| with console dialog.
|
|
275 N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
|
|
276 N *+diff* |vimdiff| and 'diff'
|
|
277 N *+digraphs* |digraphs| *E196*
|
|
278 *+dnd* Support for DnD into the "~ register |quote_~|.
|
|
279 B *+emacs_tags* |emacs-tags| files
|
|
280 N *+eval* expression evaluation |eval.txt|
|
|
281 N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|,
|
|
282 |:normal|, |:retab| and |:right|
|
|
283 N *+extra_search* |'hlsearch'| and |'incsearch'| options.
|
|
284 B *+farsi* |farsi| language
|
|
285 N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>|
|
|
286 N *+find_in_path* include file searches: |[I|, |:isearch|,
|
|
287 |CTRL-W_CTRL-I|, |:checkpath|, etc.
|
|
288 N *+folding* |folding|
|
|
289 *+footer* |gui-footer|
|
|
290 *+fork* Unix only: |fork| shell commands
|
|
291 N *+gettext* message translations |multi-lang|
|
|
292 *+GUI_Athena* Unix only: Athena |GUI|
|
|
293 *+GUI_neXtaw* Unix only: neXtaw |GUI|
|
|
294 *+GUI_GTK* Unix only: GTK+ |GUI|
|
|
295 *+GUI_Motif* Unix only: Motif |GUI|
|
|
296 *+GUI_Photon* QNX only: Photon |GUI|
|
|
297 m *+hangul_input* Hangul input support |hangul|
|
|
298 *+iconv* Compiled with the |iconv()| function, may have |/dyn|
|
|
299 N *+insert_expand* |insert_expand| Insert mode completion
|
|
300 N *+jumplist* |jumplist|
|
|
301 B *+keymap* |'keymap'|
|
|
302 B *+langmap* |'langmap'|
|
|
303 N *+libcall* |libcall()|
|
|
304 N *+linebreak* |'linebreak'|, |'breakat'| and |'showbreak'|
|
|
305 N *+lispindent* |'lisp'|
|
|
306 N *+listcmds* Vim commands for the list of buffers |buffer-hidden|
|
|
307 and argument list |:argdelete|
|
|
308 N *+localmap* Support for mappings local to a buffer |:map-local|
|
|
309 N *+menu* |:menu|
|
|
310 N *+mksession* |:mksession|
|
|
311 N *+modify_fname* |filename-modifiers|
|
|
312 N *+mouse* Mouse handling |mouse-using|
|
|
313 N *+mouseshape* |'mouseshape'|
|
|
314 B *+mouse_dec* Unix only: Dec terminal mouse handling |dec-mouse|
|
|
315 N *+mouse_gpm* Unix only: Linux console mouse handling |gpm-mouse|
|
|
316 B *+mouse_netterm* Unix only: netterm mouse handling |netterm-mouse|
|
|
317 N *+mouse_pterm* QNX only: pterm mouse handling |qnx-terminal|
|
|
318 N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
|
|
319 B *+multi_byte* Korean and other languages |multibyte|
|
|
320 *+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
|
|
321 N *+multi_lang* non-English language support |multi-lang|
|
14
|
322 m *+mzscheme* Mzscheme interface |mzscheme|
|
7
|
323 m *+netbeans_intg* |netbeans|
|
|
324 m *+ole* Win32 GUI only: |ole-interface|
|
|
325 *+osfiletype* Support for the 'osfiletype' option and filetype
|
|
326 checking in automatic commands. |autocmd-osfiletypes|
|
|
327 N *+path_extra* Up/downwards search in 'path' and 'tags'
|
|
328 m *+perl* Perl interface |perl|, may have |/dyn|
|
|
329 *+postscript* |:hardcopy| writes a PostScript file
|
|
330 N *+printer* |:hardcopy| command
|
179
|
331 H *+profile* |:profile| command
|
7
|
332 m *+python* Python interface |python|, may have |/dyn|
|
|
333 N *+quickfix* |:make| and |quickfix| commands
|
|
334 B *+rightleft* Right to left typing |'rightleft'|
|
|
335 m *+ruby* Ruby interface |ruby|, may have |/dyn|
|
|
336 N *+scrollbind* |'scrollbind'|
|
|
337 B *+signs* |:sign|
|
|
338 N *+smartindent* |'smartindent'|
|
|
339 m *+sniff* SniFF interface |sniff|
|
|
340 N *+statusline* Options 'statusline', 'rulerformat' and special
|
|
341 formats of 'titlestring' and 'iconstring'
|
|
342 m *+sun_workshop* |workshop|
|
|
343 N *+syntax* Syntax highlighting |syntax|
|
|
344 *+system()* Unix only: opposite of |+fork|
|
|
345 N *+tag_binary* binary searching in tags file |tag-binary-search|
|
|
346 N *+tag_old_static* old method for static tags |tag-old-static|
|
|
347 m *+tag_any_white* any white space allowed in tags file |tag-any-white|
|
|
348 m *+tcl* Tcl interface |tcl|, may have |/dyn|
|
|
349 *+terminfo* uses |terminfo| instead of termcap
|
|
350 N *+termresponse* support for |t_RV| and |v:termresponse|
|
|
351 N *+textobjects* |text-objects| selection
|
|
352 *+tgetent* non-Unix only: able to use external termcap
|
|
353 N *+title* Setting the window title |'title'|
|
|
354 N *+toolbar* |gui-toolbar|
|
|
355 N *+user_commands* User-defined commands. |user-commands|
|
|
356 N *+viminfo* |'viminfo'|
|
|
357 N *+vertsplit* Vertically split windows |:vsplit|
|
|
358 N *+virtualedit* |'virtualedit'|
|
|
359 S *+visual* Visual mode |Visual-mode|
|
|
360 N *+visualextra* extra Visual mode commands |blockwise-operators|
|
|
361 N *+vreplace* |gR| and |gr|
|
|
362 N *+wildignore* |'wildignore'|
|
|
363 N *+wildmenu* |'wildmenu'|
|
|
364 S *+windows* more than one window
|
|
365 m *+writebackup* |'writebackup'| is default on
|
|
366 m *+xim* X input method |xim|
|
|
367 *+xfontset* X fontset support |xfontset|
|
|
368 *+xsmp* XSMP (X session management) support
|
|
369 *+xsmp_interact* interactive XSMP (X session management) support
|
|
370 N *+xterm_clipboard* Unix only: xterm clipboard handling
|
|
371 m *+xterm_save* save and restore xterm screen |xterm-screens|
|
|
372 N *+X11* Unix only: can restore window title |X11|
|
|
373
|
|
374 */dyn* *E370* *E448*
|
|
375 To some of the features "/dyn" is added when the
|
|
376 feature is only available when the related library can
|
|
377 be dynamically loaded.
|
|
378
|
|
379 :ve[rsion] {nr} Is now ignored. This was previously used to check the
|
|
380 version number of a .vimrc file. It was removed,
|
|
381 because you can now use the ":if" command for
|
|
382 version-dependent behavior. {not in Vi}
|
|
383
|
|
384 *:redi* *:redir*
|
|
385 :redi[r][!] > {file} Redirect messages to file {file}. The messages which
|
|
386 are the output of commands are written to that file,
|
|
387 until redirection ends. The messages are also still
|
|
388 shown on the screen. When [!] is included, an
|
|
389 existing file is overwritten. When [!] is omitted,
|
|
390 and {file} exists, this command fails.
|
|
391 Only one ":redir" can be active at a time. Calls to
|
|
392 ":redir" will close any active redirection before
|
|
393 starting redirection to the new target.
|
|
394 To stop the messages and commands from being echoed to
|
|
395 the screen, put the commands in a function and call it
|
|
396 with ":silent call Function()".
|
294
|
397 An alternative is to use the 'verbosefile' option,
|
|
398 this can be used in combination with ":redir".
|
7
|
399 {not in Vi}
|
|
400
|
|
401 :redi[r] >> {file} Redirect messages to file {file}. Append if {file}
|
|
402 already exists. {not in Vi}
|
|
403
|
298
|
404 :redi[r] @{a-zA-Z}> Redirect messages to register {a-z}. Append to the
|
7
|
405 contents of the register if its name is given
|
298
|
406 uppercase {A-Z}. For backward compatibility, the ">"
|
|
407 after the register name can be omitted. {not in Vi}
|
271
|
408 :redi[r] @{a-z}>> Append messages to register {a-z}. {not in Vi}
|
7
|
409
|
298
|
410 :redi[r] @*> Redirect messages to the clipboard. For backward
|
|
411 compatibility, the ">" after the register name can be
|
|
412 omitted. {not in Vi}
|
271
|
413 :redi[r] @*>> Append messages to the clipboard. {not in Vi}
|
7
|
414
|
298
|
415 :redi[r] @"> Redirect messages to the unnamed register. For
|
|
416 backward compatibility, the ">" after the register
|
|
417 name can be omitted. {not in Vi}
|
271
|
418 :redi[r] @">> Append messages to the unnamed register. {not in Vi}
|
7
|
419
|
169
|
420 :redi[r] => {var} Redirect messages to a variable. If the variable
|
|
421 doesn't exist, then it is created. If the variable
|
|
422 exists, then it is initialized to an empty string.
|
|
423 Only string variables can be used. After the
|
|
424 redirection starts, if the variable is removed or
|
|
425 locked or the variable type is changed, then further
|
|
426 command output messages will cause errors. {not in Vi}
|
|
427
|
|
428 :redi[r] =>> {var} Append messages to an existing variable. Only string
|
|
429 variables can be used. {not in Vi}
|
|
430
|
7
|
431 :redi[r] END End redirecting messages. {not in Vi}
|
|
432
|
|
433 *:sil* *:silent*
|
|
434 :sil[ent][!] {command} Execute {command} silently. Normal messages will not
|
|
435 be given or added to the message history.
|
|
436 When [!] is added, error messages will also be
|
|
437 skipped, and commands and mappings will not be aborted
|
|
438 when an error is detected. |v:errmsg| is still set.
|
|
439 When [!] is not used, an error message will cause
|
|
440 further messages to be displayed normally.
|
|
441 Redirection, started with |:redir|, will continue as
|
|
442 usual, although there might be small differences.
|
|
443 This will allow redirecting the output of a command
|
|
444 without seeing it on the screen. Example: >
|
|
445 :redir >/tmp/foobar
|
|
446 :silent g/Aap/p
|
|
447 :redir END
|
|
448 < To execute a Normal mode command silently, use the
|
|
449 |:normal| command. For example, to search for a
|
|
450 string without messages: >
|
|
451 :silent exe "normal /path\<CR>"
|
|
452 < ":silent!" is useful to execute a command that may
|
|
453 fail, but the failure is to be ignored. Example: >
|
|
454 :let v:errmsg = ""
|
|
455 :silent! /^begin
|
|
456 :if v:errmsg != ""
|
|
457 : ... pattern was not found
|
|
458 < ":silent" will also avoid the hit-enter prompt. When
|
|
459 using this for an external command, this may cause the
|
|
460 screen to be messed up. Use |CTRL-L| to clean it up
|
|
461 then.
|
|
462 ":silent menu ..." defines a menu that will not echo a
|
|
463 Command-line command. The command will still produce
|
|
464 messages though. Use ":silent" in the command itself
|
|
465 to avoid that: ":silent menu .... :silent command".
|
|
466
|
|
467 *:verb* *:verbose*
|
|
468 :[count]verb[ose] {command}
|
|
469 Execute {command} with 'verbose' set to [count]. If
|
8
|
470 [count] is omitted one is used. ":0verbose" can be
|
|
471 used to set 'verbose' to zero.
|
7
|
472 The additional use of ":silent" makes messages
|
|
473 generated but not displayed.
|
|
474 The combination of ":silent" and ":verbose" can be
|
|
475 used to generate messages and check them with
|
|
476 |v:statusmsg| and friends. For example: >
|
|
477 :let v:statusmsg = ""
|
|
478 :silent verbose runtime foobar.vim
|
|
479 :if v:statusmsg != ""
|
|
480 : " foobar.vim could not be found
|
|
481 :endif
|
|
482 < When concatenating another command, the ":verbose"
|
|
483 only applies to the first one: >
|
|
484 :4verbose set verbose | set verbose
|
|
485 < verbose=4 ~
|
|
486 verbose=0 ~
|
294
|
487 For logging verbose messages in a file use the
|
|
488 'verbosefile' option.
|
7
|
489
|
484
|
490 *:verbose-cmd*
|
|
491 When 'verbose' is non-zero, listing the value of a Vim option or a key map or
|
502
|
492 an abbreviation or a user-defined function or a command or a highlight group
|
|
493 or an autocommand will also display where it was last defined. If it was
|
|
494 defined manually then there will be no "Last set" message. When it was
|
|
495 defined while executing a function, user command or autocommand, the script in
|
|
496 which it was defined is reported.
|
484
|
497 {not available when compiled without the +eval feature}
|
|
498
|
7
|
499 *K*
|
|
500 K Run a program to lookup the keyword under the
|
|
501 cursor. The name of the program is given with the
|
|
502 'keywordprg' (kp) option (default is "man"). The
|
|
503 keyword is formed of letters, numbers and the
|
|
504 characters in 'iskeyword'. The keyword under or
|
|
505 right of the cursor is used. The same can be done
|
|
506 with the command >
|
|
507 :!{program} {keyword}
|
|
508 < There is an example of a program to use in the tools
|
|
509 directory of Vim. It is called 'ref' and does a
|
|
510 simple spelling check.
|
|
511 Special cases:
|
|
512 - If 'keywordprg' is empty, the ":help" command is
|
|
513 used. It's a good idea to include more characters
|
|
514 in 'iskeyword' then, to be able to find more help.
|
|
515 - When 'keywordprg' is equal to "man", a count before
|
|
516 "K" is inserted after the "man" command and before
|
|
517 the keyword. For example, using "2K" while the
|
|
518 cursor is on "mkdir", results in: >
|
|
519 !man 2 mkdir
|
|
520 < - When 'keywordprg' is equal to "man -s", a count
|
|
521 before "K" is inserted after the "-s". If there is
|
|
522 no count, the "-s" is removed.
|
|
523 {not in Vi}
|
|
524
|
|
525 *v_K*
|
|
526 {Visual}K Like "K", but use the visually highlighted text for
|
|
527 the keyword. Only works when the highlighted text is
|
|
528 not more than one line. {not in Vi}
|
|
529
|
|
530 [N]gs *gs* *:sl* *:sleep*
|
|
531 :[N]sl[eep] [N] [m] Do nothing for [N] seconds. When [m] is included,
|
237
|
532 sleep for [N] milliseconds. The count for "gs" always
|
7
|
533 uses seconds. The default is one second. >
|
|
534 :sleep "sleep for one second
|
|
535 :5sleep "sleep for five seconds
|
|
536 :sleep 100m "sleep for a hundred milliseconds
|
|
537 10gs "sleep for ten seconds
|
|
538 < Can be interrupted with CTRL-C (CTRL-Break on MS-DOS).
|
140
|
539 "gs" stands for "goto sleep".
|
|
540 While sleeping the cursor is positioned in the text,
|
|
541 if at a visible position. {not in Vi}
|
7
|
542
|
|
543 *g_CTRL-A*
|
|
544 g CTRL-A Only when Vim was compiled with MEM_PROFILING defined
|
|
545 (which is very rare): print memory usage statistics.
|
|
546 Only useful for debugging Vim.
|
|
547
|
|
548 ==============================================================================
|
|
549 2. Online help *online-help*
|
|
550
|
|
551 *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
|
|
552 <Help> or
|
|
553 :h[elp] Open a window and display the help file in read-only
|
|
554 mode. If there is a help window open already, use
|
|
555 that one. Otherwise, if the current window uses the
|
|
556 full width of the screen or is at least 80 characters
|
|
557 wide, the help window will appear just above the
|
|
558 current window. Otherwise the new window is put at
|
|
559 the very top.
|
|
560 The 'helplang' option is used to select a language, if
|
|
561 the main help file is available in several languages.
|
|
562 {not in Vi}
|
|
563
|
|
564 *{subject}* *E149* *E661*
|
|
565 :h[elp] {subject} Like ":help", additionally jump to the tag {subject}.
|
|
566 {subject} can include wildcards like "*", "?" and
|
|
567 "[a-z]":
|
|
568 :help z? jump to help for any "z" command
|
|
569 :help z. jump to the help for "z."
|
|
570 If there is no full match for the pattern, or there
|
|
571 are several matches, the "best" match will be used.
|
|
572 A sophisticated algorithm is used to decide which
|
|
573 match is better than another one. These items are
|
|
574 considered in the computation:
|
|
575 - A match with same case is much better than a match
|
|
576 with different case.
|
|
577 - A match that starts after a non-alphanumeric
|
|
578 character is better than a match in the middle of a
|
|
579 word.
|
|
580 - A match at or near the beginning of the tag is
|
|
581 better than a match further on.
|
|
582 - The more alphanumeric characters match, the better.
|
|
583 - The shorter the length of the match, the better.
|
|
584
|
|
585 The 'helplang' option is used to select a language, if
|
|
586 the {subject} is available in several languages.
|
|
587 To find a tag in a specific language, append "@ab",
|
|
588 where "ab" is the two-letter language code. See
|
|
589 |help-translated|.
|
|
590
|
|
591 Note that the longer the {subject} you give, the less
|
|
592 matches will be found. You can get an idea how this
|
|
593 all works by using commandline completion (type CTRL-D
|
|
594 after ":help subject").
|
|
595 If there are several matches, you can have them listed
|
|
596 by hitting CTRL-D. Example: >
|
|
597 :help cont<Ctrl-D>
|
|
598 < To use a regexp |pattern|, first do ":help" and then
|
|
599 use ":tag {pattern}" in the help window. The
|
|
600 ":tnext" command can then be used to jump to other
|
|
601 matches, "tselect" to list matches and choose one. >
|
|
602 :help index| :tse z.
|
|
603 < This command can be followed by '|' and another
|
|
604 command, but you don't need to escape the '|' inside a
|
|
605 help command. So these both work: >
|
|
606 :help |
|
|
607 :help k| only
|
|
608 < Note that a space before the '|' is seen as part of
|
|
609 the ":help" argument.
|
|
610 You can also use <LF> or <CR> to separate the help
|
|
611 command from a following command. You need to type
|
|
612 CTRL-V first to insert the <LF> or <CR>. Example: >
|
|
613 :help so<C-V><CR>only
|
|
614 < {not in Vi}
|
|
615
|
|
616 :h[elp]! [subject] Like ":help", but in non-English help files prefer to
|
|
617 find a tag in a file with the same language as the
|
|
618 current file. See |help-translated|.
|
|
619
|
|
620 *:helpg* *:helpgrep*
|
9
|
621 :helpg[rep] {pattern}[@xx]
|
7
|
622 Search all help text files and make a list of lines
|
|
623 in which {pattern} matches. Jumps to the first match.
|
9
|
624 The optional [@xx] specifies that only matches in the
|
|
625 "xx" language are to be found.
|
7
|
626 You can navigate through the matches with the
|
|
627 |quickfix| commands, e.g., |:cnext| to jump to the
|
|
628 next one. Or use |:cwindow| to get the list of
|
|
629 matches in the quickfix window.
|
|
630 {pattern} is used as a Vim regexp |pattern|.
|
|
631 'ignorecase' is not used, add "\c" to ignore case.
|
|
632 Example for case sensitive search: >
|
|
633 :helpgrep Uganda
|
|
634 < Example for case ignoring search: >
|
|
635 :helpgrep uganda\c
|
9
|
636 < Example for searching in French help: >
|
|
637 :helpgrep backspace@fr
|
7
|
638 < Cannot be followed by another command, everything is
|
|
639 used as part of the pattern. But you can use
|
|
640 |:execute| when needed.
|
|
641 Compressed help files will not be searched (Debian
|
|
642 compresses the help files).
|
|
643 {not in Vi}
|
|
644
|
40
|
645 *:exu* *:exusage*
|
|
646 :exu[sage] Show help on Ex commands. Added to simulate the Nvi
|
|
647 command. {not in Vi}
|
|
648
|
|
649 *:viu* *:viusage*
|
|
650 :viu[sage] Show help on Normal mode commands. Added to simulate
|
|
651 the Nvi command. {not in Vi}
|
7
|
652
|
|
653 When no argument is given to |:help| the file given with the 'helpfile' option
|
|
654 will be opened. Otherwise the specified tag is searched for in all "doc/tags"
|
|
655 files in the directories specified in the 'runtimepath' option.
|
|
656
|
|
657 The initial height of the help window can be set with the 'helpheight' option
|
|
658 (default 20).
|
|
659
|
|
660 Jump to specific subjects by using tags. This can be done in two ways:
|
|
661 - Use the "CTRL-]" command while standing on the name of a command or option.
|
|
662 This only works when the tag is a keyword. "<C-Leftmouse>" and
|
|
663 "g<LeftMouse>" work just like "CTRL-]".
|
|
664 - use the ":ta {subject}" command. This also works with non-keyword
|
|
665 characters.
|
|
666
|
|
667 Use CTRL-T or CTRL-O to jump back.
|
|
668 Use ":q" to close the help window.
|
|
669
|
|
670 If there are several matches for an item you are looking for, this is how you
|
|
671 can jump to each one of them:
|
|
672 1. Open a help window
|
|
673 2. Use the ":tag" command with a slash prepended to the tag. E.g.: >
|
|
674 :tag /min
|
|
675 3. Use ":tnext" to jump to the next matching tag.
|
|
676
|
|
677 It is possible to add help files for plugins and other items. You don't need
|
|
678 to change the distributed help files for that. See |add-local-help|.
|
|
679
|
|
680 To write a local help file, see |write-local-help|.
|
|
681
|
|
682 Note that the title lines from the local help files are automagically added to
|
|
683 the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
|
|
684 This is done when viewing the file in Vim, the file itself is not changed. It
|
|
685 is done by going through all help files and obtaining the first line of each
|
|
686 file. The files in $VIMRUNTIME/doc are skipped.
|
|
687
|
|
688 *help-xterm-window*
|
|
689 If you want to have the help in another xterm window, you could use this
|
|
690 command: >
|
|
691 :!xterm -e vim +help &
|
|
692 <
|
|
693
|
|
694 *:helpfind* *:helpf*
|
|
695 :helpf[ind] Like |:help|, but use a dialog to enter the argument.
|
|
696 Only for backwards compatibility. It now executes the
|
|
697 ToolBar.FindHelp menu entry instead of using a builtin
|
|
698 dialog. {only when compiled with |+GUI_GTK|}
|
|
699 < {not in Vi}
|
|
700
|
|
701 *:helpt* *:helptags*
|
|
702 *E154* *E150* *E151* *E152* *E153* *E670*
|
|
703 :helpt[ags] {dir} Generate the help tags file(s) for directory {dir}.
|
|
704 All "*.txt" and "*.??x" files in the directory are
|
|
705 scanned for a help tag definition in between stars.
|
|
706 The "*.??x" files are for translated docs, they
|
|
707 generate the "tags-??" file, see |help-translated|.
|
|
708 The generated tags files are sorted.
|
|
709 When there are duplicates an error message is given.
|
|
710 An existing tags file is silently overwritten.
|
|
711 To rebuild the help tags in the runtime directory
|
|
712 (requires write permission there): >
|
|
713 :helptags $VIMRUNTIME/doc
|
|
714 < {not in Vi}
|
|
715
|
|
716
|
|
717 TRANSLATED HELP *help-translated*
|
|
718
|
|
719 It is possible to add translated help files, next to the original English help
|
|
720 files. Vim will search for all help in "doc" directories in 'runtimepath'.
|
|
721 This is only available when compiled with the |+multi_lang| feature.
|
|
722
|
|
723 A set of translated help files consists of these files:
|
|
724
|
|
725 help.abx
|
|
726 howto.abx
|
|
727 ...
|
|
728 tags-ab
|
|
729
|
|
730 "ab" is the two-letter language code. Thus for Italian the names are:
|
|
731
|
|
732 help.itx
|
|
733 howto.itx
|
|
734 ...
|
|
735 tags-it
|
|
736
|
|
737 The 'helplang' option can be set to the preferred language(s). The default is
|
|
738 set according to the environment. Vim will first try to find a matching tag
|
|
739 in the preferred language(s). English is used when it cannot be found.
|
|
740
|
|
741 To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
|
|
742 two-letter language code. Example: >
|
|
743 :he user-manual@it
|
|
744 :he user-manual@en
|
|
745 The first one finds the Italian user manual, even when 'helplang' is empty.
|
|
746 The second one finds the English user manual, even when 'helplang' is set to
|
|
747 "it".
|
|
748
|
|
749 When using command-line completion for the ":help" command, the "@en"
|
|
750 extention is only shown when a tag exists for multiple languages. When the
|
|
751 tag only exists for English "@en" is omitted.
|
|
752
|
|
753 When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
|
|
754 find the tag in the same language. If not found then 'helplang' will be used
|
|
755 to select a language.
|
|
756
|
|
757 Help files must use latin1 or utf-8 encoding. Vim assumes the encoding is
|
|
758 utf-8 when finding non-ASCII characters in the first line. Thus you must
|
|
759 translate the header with "For Vim version".
|
|
760
|
|
761 The same encoding must be used for the help files of one language in one
|
|
762 directory. You can use a different encoding for different languages and use
|
|
763 a different encoding for help files of the same language but in a different
|
|
764 directory.
|
|
765
|
|
766 Hints for translators:
|
|
767 - Do not translate the tags. This makes it possible to use 'helplang' to
|
|
768 specify the preferred language. You may add new tags in your language.
|
|
769 - When you do not translate a part of a file, add tags to the English version,
|
|
770 using the "tag@en" notation.
|
|
771 - Make a package with all the files and the tags file available for download.
|
|
772 Users can drop it in one of the "doc" directories and start use it.
|
|
773 Report this to Bram, so that he can add a link on www.vim.org.
|
|
774 - Use the |:helptags| command to generate the tags files. It will find all
|
|
775 languages in the specified directory.
|
|
776
|
|
777 ==============================================================================
|
|
778 4. Using Vim like less or more *less*
|
|
779
|
|
780 If you use the less or more program to view a file, you don't get syntax
|
|
781 highlighting. Thus you would like to use Vim instead. You can do this by
|
|
782 using the shell script "$VIMRUNTIME/macros/less.sh".
|
|
783
|
|
784 This shell script uses the Vim script "$VIMRUNTIME/macros/less.vim". It sets
|
|
785 up mappings to simulate the commands that less supports. Otherwise, you can
|
|
786 still use the Vim commands.
|
|
787
|
|
788 This isn't perfect. For example, when viewing a short file Vim will still use
|
|
789 the whole screen. But it works good enough for most uses, and you get syntax
|
|
790 highlighting.
|
|
791
|
|
792 The "h" key will give you a short overview of the available commands.
|
|
793
|
|
794 vim:tw=78:ts=8:ft=help:norl:
|