Vim Documentation: various


    For Vim version 5.0p.  Last modification: 1997 Oct 12


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Various commands					 

1. Various commands	|various-cmds|
2. Online help		|online_help|


1. Various commands CTRL-L Clear and redraw the screen. <Del> When entering a number: Remove the last digit. Note: if you like to use <BS> for this, add this mapping to your .vimrc: :map CTRL-V <BS> CTRL-V <Del> See |:fixdel| if your <Del> key does not do what you want. :as[cii] or ga Print the ascii value of the character under the cursor in decimal, hexadecimal and octal. For example, when the cursor is on a 'R': <R> 82, Hex 52, Octal 122 When the character is a non-standard ASCII character, but printable according to the 'isprint' option, the non-printable version is also given. When the character is larger than 127, the <M-x> form is also printed. For example: <~A> <M-^A> 129, Hex 81, Octal 201 <p> <|~> <M-~> 254, Hex fe, Octal 376 (where <p> is a special character) The <Nul> character in a file is stored internally as <NL>, but it will be shown as: <^@> 0, Hex 00, Octal 000 Mnemonic: Get Ascii value. {not in Vi} :[range]p[rint] Print [range] lines (default current line). :[range]p[rint] {count} Print {count} lines, starting with [range] (default current line |cmdline_ranges|). :[range]l[ist] [count] Same as :print, but display unprintable characters with '^'. :[range]nu[mber] [count] Same as :print, but precede each line with its line number. (See also 'highlight' option). :[range]# [count] synonym for :number. :{range}z[+-^.=]{count} Display several lines of text surrounding the line specified with {range}, or around the current line if there is no {range}. If there is a {count}, that's how many lines you'll see; otherwise, the current window size is used. :z can be used either alone or followed by any of several punctuation marks. These have the following effect: mark first line last line new location ---- ---------- --------- ------------ + current line 1 scr forward 1 scr forward - 1 scr back current line current line ^ 2 scr back 1 scr back 1 scr back . 1/2 scr back 1/2 scr fwd 1/2 src fwd = 1/2 src back 1/2 scr fwd current line Specifying no mark at all is the same as "+". If the mark is "=", a line of dashes is printed around the current line. := Print the cursor line number. :norm[al][!] {commands} Execute Normal mode commands {commands}. This makes it possible to execute Normal mode commands typed on the command line. {commands} is executed like it is typed. For undo all commands are undone together. If the [!] is given, mappings will not be used. {commands} should be a complete command. If {commands} does not finish a command, more characters need to be typed, but the display isn't updated while doing this. Mostly useful for autocommands. This command cannot be followed by another command, since any '|' is considered part of the command. An alternative is to use ":execute", which uses an expression as argument. See |:exe|. Hint: If the {commands} ends in an <Esc>, Vim may think it's the start of a function key, and 'ttimeout' will apply, which makes things very slow, or even wait indefenitely for anything to be typed. Include the [!] in this case. {not in Vi, of course} :{range}norm[al][!] {commands} Execute Normal mode commands {commands} for each line in the {range}. Before executing the {commands}, the cursor is positioned in the first column of the range, for each line. Otherwise it's the same as the ":normal" command without a range. {not in Vi} :sh[ell] This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option. Note: This doesn't work when Vim on the Amiga was started in QuickFix mode from a compiler, because the compiler will have set stdin to a non-interactive mode. :!{cmd} Execute {cmd} with the shell. See also the 'shell' and 'shelltype' option. Any '!' in {cmd} is replaced with the previous external command (see also 'cpoptions'). But not when there is a backslash before the '!', then that backslash is removed. Example: ":!ls" followed by ":!echo ! \! \\!" executes "echo ls ! \!". After the command has been executed, the timestamp of the current file is checked |timestamp|. Also see |shell_window|. :!! Repeat last ":!{cmd}". :ve[rsion] Print the version number of the editor. If the compiler used understands "__DATE__" the compilation date is mentioned. Otherwise a fixed release-date is shown. The following lines contain information about which options were defined when Vim was compiled. :ve[rsion] {nr} Is now ignored. This was previously used to check the version number of a .vimrc file. It was removed, because you can now use the ":if" command for version-dependend behaviour. {not in Vi} :redi[r][!] > {file} Redirect messages to file {file}. The messages which are the output of commands are written to that file, until redirection ends. The messages are also still shown on the screen. When [!] is included, an existing file is overwritten. When [!] is omitted, and {file} exists, this command fails. {not in Vi} :redi[r] >> {file} Redirect message to file {file}. Append if {file} already exists. {not in Vi} :redi[r] END End redirecting messages. {not in Vi} K Run a program to lookup the keyword under the cursor. The name of the program is given with the 'keywordprg' (kp) option (default is "man"). The keyword is formed of letters, numbers and the characters in 'iskeyword'. The keyword under or right of the cursor is used. The same can be done with the command > :!{program} {keyword} There is an example of a program to use in the tools directory of Vim. It is called 'ref' and does a simple spelling check. Special cases: - If 'keywordprg' is empty, the ":help" command is used. It's a good idea to include more characters in 'iskeyword' then, to be able to find more help. - When 'keywordprg' is equal to "man", a count before "K" is inserted after the "man" command and before the keyword. For example, using "2K" while the cursor is on "mkdir", results in: > !man 2 mkdir {not in Vi} {Visual}K Like "K", but use the visually highlighted text for the keyword. Only works when the highlighted text is not more than one line. {not in Vi} [N]gs :[N]sl[eep] [N] Do nothing for [N] seconds. Can be interrupted with CTRL-C (CTRL-Break on MS-DOS). "gs" stands for "goto sleep". While sleeping the cursor is positioned in the text (if visible). {not in Vi}
2. Online help <Help> or :h[elp] Split the window and display the help file in read-only mode. If there is a help window open already, use that one. {not in Vi} :h[elp] {subject} Like ":help", additionally jump to the tag {subject}. {subject} can be a pattern |pattern|. :help z. jump to help for any "z" command :help z\. jump to the help for "z." If there is no full match for the pattern, or there are several matches, the "best" match will be used. A sophisticated algorithm is used to decide which match is better than another one. These items are considered in the computation: - A match with same case is much better than a match with different case. - A match that starts after a non-alphanumeric character is better than a match in the middle of a word. - A match at or near the beginning of the tag is better than a match furter on. - The more alphanumeric characters match, the better. - The shorter the length of the match, the better. Note that the longer the {subject} you give, the less matches will be found. You can get an idea how this all works by using commandline completion (type CTRL-D after ":help subject". This command can be followed by '|' and another command, but you don't need to escape the '|' inside a help command. So these both work: > :help | > :help k| only Note that a space before the '|' is seen as part of the ":help" argument. You can also use <LF> or <CR> to separate the help command from a following command. You need to type CTRL-V first to insert the <LF> or <CR>. Example: > :help so<C-V><CR>only {not in Vi} The help file name can be set with the 'helpfile' option. The initial height of the help window can be set with the 'helpheight' option (default 20). Jump to specific subjects by using tags. This can be done in two ways: - Use the "CTRL-]" command while standing on the name of a command or option. This only works when the tag is a keyword. "<C-Leftmouse>" and "g<LeftMouse>" work just like "CTRL-]". - use the ":ta {subject}" command. This works with all characters. Use "CTRL-T" to jump back. Use ":q" to close the help window. If you want to have the help in another xterm window, you could use this command: :!xterm -e vim +help &

Generated by vim2html on Mon Nov 3 03:34:24 EST 1997