Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 1 | VIM(1) General Commands Manual VIM(1) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3 | NAME |
Bram Moolenaar | c572da5 | 2017-08-27 16:52:01 +0200 | [diff] [blame] | 4 | vim - Vi IMproved, a programmer's text editor |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | |
| 6 | SYNOPSIS |
| 7 | vim [options] [file ..] |
| 8 | vim [options] - |
| 9 | vim [options] -t tag |
| 10 | vim [options] -q [errorfile] |
| 11 | |
| 12 | ex |
| 13 | view |
| 14 | gvim gview evim eview |
| 15 | rvim rview rgvim rgview |
| 16 | |
| 17 | DESCRIPTION |
| 18 | Vim is a text editor that is upwards compatible to Vi. It can be used |
| 19 | to edit all kinds of plain text. It is especially useful for editing |
| 20 | programs. |
| 21 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 22 | There are a lot of enhancements above Vi: multi level undo, multi win‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | dows and buffers, syntax highlighting, command line editing, filename |
| 24 | completion, on-line help, visual selection, etc.. See ":help |
| 25 | vi_diff.txt" for a summary of the differences between Vim and Vi. |
| 26 | |
| 27 | While running Vim a lot of help can be obtained from the on-line help |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 28 | system, with the ":help" command. See the ON-LINE HELP section below. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 29 | |
| 30 | Most often Vim is started to edit a single file with the command |
| 31 | |
| 32 | vim file |
| 33 | |
| 34 | More generally Vim is started with: |
| 35 | |
| 36 | vim [options] [filelist] |
| 37 | |
| 38 | If the filelist is missing, the editor will start with an empty buffer. |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 39 | Otherwise exactly one out of the following four may be used to choose |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | one or more files to be edited. |
| 41 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 42 | file .. A list of filenames. The first one will be the current |
| 43 | file and read into the buffer. The cursor will be posi‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 44 | tioned on the first line of the buffer. You can get to the |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 45 | other files with the ":next" command. To edit a file that |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 46 | starts with a dash, precede the filelist with "--". |
| 47 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 48 | - The file to edit is read from stdin. Commands are read |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 49 | from stderr, which should be a tty. |
| 50 | |
| 51 | -t {tag} The file to edit and the initial cursor position depends on |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 52 | a "tag", a sort of goto label. {tag} is looked up in the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 53 | tags file, the associated file becomes the current file and |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 54 | the associated command is executed. Mostly this is used |
| 55 | for C programs, in which case {tag} could be a function |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | name. The effect is that the file containing that function |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 57 | becomes the current file and the cursor is positioned on |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | the start of the function. See ":help tag-commands". |
| 59 | |
| 60 | -q [errorfile] |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 61 | Start in quickFix mode. The file [errorfile] is read and |
| 62 | the first error is displayed. If [errorfile] is omitted, |
| 63 | the filename is obtained from the 'errorfile' option (de‐ |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 64 | faults to "AztecC.Err" for the Amiga, "errors.err" on other |
| 65 | systems). Further errors can be jumped to with the ":cn" |
| 66 | command. See ":help quickfix". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 67 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 68 | Vim behaves differently, depending on the name of the command (the exe‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 69 | cutable may still be the same file). |
| 70 | |
| 71 | vim The "normal" way, everything is default. |
| 72 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 73 | ex Start in Ex mode. Go to Normal mode with the ":vi" command. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 74 | Can also be done with the "-e" argument. |
| 75 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 76 | view Start in read-only mode. You will be protected from writing |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 77 | the files. Can also be done with the "-R" argument. |
| 78 | |
| 79 | gvim gview |
| 80 | The GUI version. Starts a new window. Can also be done with |
| 81 | the "-g" argument. |
| 82 | |
| 83 | evim eview |
| 84 | The GUI version in easy mode. Starts a new window. Can also |
| 85 | be done with the "-y" argument. |
| 86 | |
| 87 | rvim rview rgvim rgview |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 88 | Like the above, but with restrictions. It will not be possi‐ |
| 89 | ble to start shell commands, or suspend Vim. Can also be |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 90 | done with the "-Z" argument. |
| 91 | |
| 92 | OPTIONS |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 93 | The options may be given in any order, before or after filenames. Op‐ |
| 94 | tions without an argument can be combined after a single dash. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 95 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 96 | +[num] For the first file the cursor will be positioned on line |
| 97 | "num". If "num" is missing, the cursor will be positioned |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 98 | on the last line. |
| 99 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 100 | +/{pat} For the first file the cursor will be positioned in the |
| 101 | line with the first occurrence of {pat}. See ":help |
| 102 | search-pattern" for the available search patterns. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 103 | |
| 104 | +{command} |
| 105 | |
| 106 | -c {command} |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 107 | {command} will be executed after the first file has been |
| 108 | read. {command} is interpreted as an Ex command. If the |
| 109 | {command} contains spaces it must be enclosed in double |
| 110 | quotes (this depends on the shell that is used). Example: |
Bram Moolenaar | 2547aa9 | 2020-07-26 17:00:44 +0200 | [diff] [blame] | 111 | vim "+set si" main.c |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 112 | Note: You can use up to 10 "+" or "-c" commands. |
| 113 | |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 114 | -A If Vim has been compiled with ARABIC support for editing |
| 115 | right-to-left oriented files and Arabic keyboard mapping, |
| 116 | this option starts Vim in Arabic mode, i.e. 'arabic' is |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 117 | set. Otherwise an error message is given and Vim aborts. |
| 118 | |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 119 | -b Binary mode. A few options will be set that makes it pos‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 120 | sible to edit a binary or executable file. |
| 121 | |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 122 | -C Compatible. Set the 'compatible' option. This will make |
| 123 | Vim behave mostly like Vi, even though a .vimrc file ex‐ |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 124 | ists. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 125 | |
Bram Moolenaar | 2346a63 | 2021-06-13 19:02:49 +0200 | [diff] [blame] | 126 | -d Start in diff mode. There should between two to eight file |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 127 | name arguments. Vim will open all the files and show dif‐ |
Bram Moolenaar | 2346a63 | 2021-06-13 19:02:49 +0200 | [diff] [blame] | 128 | ferences between them. Works like vimdiff(1). |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 129 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 130 | -d {device}, -dev {device} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 131 | Open {device} for use as a terminal. Only on the Amiga. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 132 | Example: "-d con:20/30/600/150". |
| 133 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 134 | -D Debugging. Go to debugging mode when executing the first |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 135 | command from a script. |
| 136 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 137 | -e Start Vim in Ex mode, just like the executable was called |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 138 | "ex". |
| 139 | |
| 140 | -E Start Vim in improved Ex mode, just like the executable was |
| 141 | called "exim". |
| 142 | |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 143 | -f Foreground. For the GUI version, Vim will not fork and de‐ |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 144 | tach from the shell it was started in. On the Amiga, Vim |
| 145 | is not restarted to open a new window. This option should |
| 146 | be used when Vim is executed by a program that will wait |
| 147 | for the edit session to finish (e.g. mail). On the Amiga |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 148 | the ":sh" and ":!" commands will not work. |
| 149 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 150 | -F If Vim has been compiled with FKMAP support for editing |
| 151 | right-to-left oriented files and Farsi keyboard mapping, |
| 152 | this option starts Vim in Farsi mode, i.e. 'fkmap' and |
| 153 | 'rightleft' are set. Otherwise an error message is given |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 154 | and Vim aborts. |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 155 | Note: Farsi support has been removed in patch 8.1.0932. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 156 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 157 | -g If Vim has been compiled with GUI support, this option en‐ |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 158 | ables the GUI. If no GUI support was compiled in, an error |
| 159 | message is given and Vim aborts. |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 160 | |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 161 | -H If Vim has been compiled with RIGHTLEFT support for editing |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 162 | right-to-left oriented files and Hebrew keyboard mapping, |
| 163 | this option starts Vim in Hebrew mode, i.e. 'hkmap' and |
| 164 | 'rightleft' are set. Otherwise an error message is given |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 165 | and Vim aborts. |
| 166 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 167 | -i {viminfo} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 168 | Specifies the filename to use when reading or writing the |
| 169 | viminfo file, instead of the default "~/.viminfo". This |
| 170 | can also be used to skip the use of the .viminfo file, by |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 171 | giving the name "NONE". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 172 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 173 | -l Lisp mode. Sets the 'lisp' and 'showmatch' options on. |
| 174 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 175 | -L Same as -r. |
| 176 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 177 | -m Modifying files is disabled. Resets the 'write' option. |
| 178 | You can still modify the buffer, but writing a file is not |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 179 | possible. |
| 180 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 181 | -M Modifications not allowed. The 'modifiable' and 'write' |
| 182 | options will be unset, so that changes are not allowed and |
| 183 | files can not be written. Note that these options can be |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 184 | set to enable making modifications. |
| 185 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 186 | -n No swap file will be used. Recovery after a crash will be |
| 187 | impossible. Handy if you want to edit a file on a very |
| 188 | slow medium (e.g. floppy). Can also be done with ":set |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 189 | uc=0". Can be undone with ":set uc=200". |
| 190 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 191 | -N No-compatible mode. Resets the 'compatible' option. This |
| 192 | will make Vim behave a bit better, but less Vi compatible, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 193 | even though a .vimrc file does not exist. |
| 194 | |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 195 | -nb Become an editor server for NetBeans. See the docs for de‐ |
| 196 | tails. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 197 | |
| 198 | -o[N] Open N windows stacked. When N is omitted, open one window |
| 199 | for each file. |
| 200 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 201 | -O[N] Open N windows side by side. When N is omitted, open one |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 202 | window for each file. |
| 203 | |
Bram Moolenaar | 1a14c2c | 2006-03-25 21:52:34 +0000 | [diff] [blame] | 204 | -p[N] Open N tab pages. When N is omitted, open one tab page for |
| 205 | each file. |
| 206 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 207 | -P {parent-title} |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 208 | Win32 GUI only: Specify the title of the parent applica‐ |
| 209 | tion. When possible, Vim will run in an MDI window inside |
| 210 | the application. {parent-title} must appear in the window |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 211 | title of the parent application. Make sure that it is spe‐ |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 212 | cific enough. Note that the implementation is still primi‐ |
| 213 | tive. It won't work with all applications and the menu |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 214 | doesn't work. |
| 215 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 216 | -r List swap files, with information about using them for re‐ |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 217 | covery. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 218 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 219 | -r {file} Recovery mode. The swap file is used to recover a crashed |
| 220 | editing session. The swap file is a file with the same |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 221 | filename as the text file with ".swp" appended. See ":help |
| 222 | recovery". |
| 223 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 224 | -R Read-only mode. The 'readonly' option will be set. You |
| 225 | can still edit the buffer, but will be prevented from acci‐ |
| 226 | dentally overwriting a file. If you do want to overwrite a |
| 227 | file, add an exclamation mark to the Ex command, as in |
| 228 | ":w!". The -R option also implies the -n option (see |
| 229 | above). The 'readonly' option can be reset with ":set |
| 230 | noro". See ":help 'readonly'". |
| 231 | |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 232 | -s Silent mode. Only when started as "Ex" or when the "-e" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 233 | option was given before the "-s" option. |
| 234 | |
| 235 | -s {scriptin} |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 236 | The script file {scriptin} is read. The characters in the |
| 237 | file are interpreted as if you had typed them. The same |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 238 | can be done with the command ":source! {scriptin}". If the |
| 239 | end of the file is reached before the editor exits, further |
| 240 | characters are read from the keyboard. |
| 241 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 242 | -S {file} {file} will be sourced after the first file has been read. |
| 243 | This is equivalent to -c "source {file}". {file} cannot |
| 244 | start with '-'. If {file} is omitted "Session.vim" is used |
| 245 | (only works when -S is the last argument). |
| 246 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 247 | -T {terminal} |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 248 | Tells Vim the name of the terminal you are using. Only re‐ |
| 249 | quired when the automatic way doesn't work. Should be a |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 250 | terminal known to Vim (builtin) or defined in the termcap |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 251 | or terminfo file. |
| 252 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 253 | -u {vimrc} Use the commands in the file {vimrc} for initializations. |
| 254 | All the other initializations are skipped. Use this to |
| 255 | edit a special kind of files. It can also be used to skip |
| 256 | all initializations by giving the name "NONE". See ":help |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 257 | initialization" within vim for more details. |
| 258 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 259 | -U {gvimrc} Use the commands in the file {gvimrc} for GUI initializa‐ |
| 260 | tions. All the other GUI initializations are skipped. It |
| 261 | can also be used to skip all GUI initializations by giving |
| 262 | the name "NONE". See ":help gui-init" within vim for more |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 263 | details. |
| 264 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 265 | -v Start Vim in Vi mode, just like the executable was called |
| 266 | "vi". This only has effect when the executable is called |
| 267 | "ex". |
| 268 | |
| 269 | -V[N] Verbose. Give messages about which files are sourced and |
| 270 | for reading and writing a viminfo file. The optional num‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 271 | ber N is the value for 'verbose'. Default is 10. |
| 272 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 273 | -V[N]{filename} |
| 274 | Like -V and set 'verbosefile' to {filename}. The result is |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 275 | that messages are not displayed but written to the file |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 276 | {filename}. {filename} must not start with a digit. |
| 277 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 278 | -w{number} Set the 'window' option to {number}. |
| 279 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 280 | -w {scriptout} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 281 | All the characters that you type are recorded in the file |
| 282 | {scriptout}, until you exit Vim. This is useful if you |
| 283 | want to create a script file to be used with "vim -s" or |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 284 | ":source!". If the {scriptout} file exists, characters are |
| 285 | appended. |
| 286 | |
| 287 | -W {scriptout} |
| 288 | Like -w, but an existing file is overwritten. |
| 289 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 290 | -x If Vim has been compiled with encryption support, use en‐ |
Christian Brabandt | 1514120 | 2024-08-03 15:40:19 +0200 | [diff] [blame] | 291 | cryption when writing files. Will prompt for a crypt key. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 292 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 293 | -X Don't connect to the X server. Shortens startup time in a |
| 294 | terminal, but the window title and clipboard will not be |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 295 | used. |
| 296 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 297 | -Y Don't connect to the wayland compositor |
| 298 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 299 | -y Start Vim in easy mode, just like the executable was called |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 300 | "evim" or "eview". Makes Vim behave like a click-and-type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 301 | editor. |
| 302 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 303 | -Z Restricted mode. Works like the executable starts with |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 304 | "r". |
| 305 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 306 | -- Denotes the end of the options. Arguments after this will |
| 307 | be handled as a file name. This can be used to edit a |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 308 | filename that starts with a '-'. |
| 309 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 310 | --clean Do not use any personal configuration (vimrc, plugins, |
| 311 | etc.). Useful to see if a problem reproduces with a clean |
Bram Moolenaar | 56994d2 | 2021-04-17 16:31:09 +0200 | [diff] [blame] | 312 | Vim setup. |
| 313 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 314 | --cmd {command} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 315 | Like using "-c", but the command is executed just before |
| 316 | processing any vimrc file. You can use up to 10 of these |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 317 | commands, independently from "-c" commands. |
| 318 | |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 319 | --echo-wid GTK GUI only: Echo the Window ID on stdout. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 320 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 321 | --gui-dialog-file {name} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 322 | When using the GUI, instead of showing a dialog, write the |
| 323 | title and message of the dialog to file {name}. The file |
| 324 | is created or appended to. Only useful for testing, to |
| 325 | avoid that the test gets stuck on a dialog that can't be |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 326 | seen. Without the GUI the argument is ignored. |
| 327 | |
| 328 | --help, -h, -? |
| 329 | Give a bit of help about the command line arguments and op‐ |
| 330 | tions. After this Vim exits. |
| 331 | |
| 332 | --literal Take file name arguments literally, do not expand wild‐ |
| 333 | cards. This has no effect on Unix where the shell expands |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 334 | wildcards. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 335 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 336 | --log {filename} |
| 337 | If Vim has been compiled with eval and channel feature, |
| 338 | start logging and write entries to {filename}. This works |
| 339 | like calling ch_logfile({filename}, 'ao') very early during |
| 340 | startup. |
| 341 | |
| 342 | --nofork Foreground. For the GUI version, Vim will not fork and de‐ |
| 343 | tach from the shell it was started in. |
| 344 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 345 | --noplugin Skip loading plugins. Implied by -u NONE. |
| 346 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 347 | --not-a-term |
| 348 | Tells Vim that the user knows that the input and/or output |
| 349 | is not connected to a terminal. This will avoid the warn‐ |
| 350 | ing and the two second delay that would happen. |
| 351 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 352 | --remote Connect to a Vim server and make it edit the files given in |
| 353 | the rest of the arguments. If no server is found a warning |
| 354 | is given and the files are edited in the current Vim. |
| 355 | |
| 356 | --remote-expr {expr} |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 357 | Connect to a Vim server, evaluate {expr} in it and print |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 358 | the result on stdout. |
| 359 | |
| 360 | --remote-send {keys} |
| 361 | Connect to a Vim server and send {keys} to it. |
| 362 | |
| 363 | --remote-silent |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 364 | As --remote, but without the warning when no server is |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 365 | found. |
| 366 | |
| 367 | --remote-wait |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 368 | As --remote, but Vim does not exit until the files have |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 369 | been edited. |
| 370 | |
| 371 | --remote-wait-silent |
| 372 | As --remote-wait, but without the warning when no server is |
| 373 | found. |
| 374 | |
| 375 | --serverlist |
| 376 | List the names of all Vim servers that can be found. |
| 377 | |
| 378 | --servername {name} |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 379 | Use {name} as the server name. Used for the current Vim, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 380 | unless used with a --remote argument, then it's the name of |
| 381 | the server to connect to. |
| 382 | |
| 383 | --socketid {id} |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 384 | GTK GUI only: Use the GtkPlug mechanism to run gVim in an‐ |
Bram Moolenaar | 06fe74a | 2019-08-31 16:20:32 +0200 | [diff] [blame] | 385 | other window. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 386 | |
Bram Moolenaar | 3132cdd | 2020-11-05 20:41:49 +0100 | [diff] [blame] | 387 | --startuptime {file} |
| 388 | During startup write timing messages to the file {fname}. |
| 389 | |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 390 | --ttyfail When stdin or stdout is not a a terminal (tty) then exit |
| 391 | right away. |
| 392 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 393 | --version Print version information and exit. |
| 394 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 395 | --windowid {id} |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 396 | Win32 GUI only: Make gVim try to use the window {id} as a |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 397 | parent, so that it runs inside that window. |
| 398 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 399 | ON-LINE HELP |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 400 | Type ":help" in Vim to get started. Type ":help subject" to get help |
| 401 | on a specific subject. For example: ":help ZZ" to get help for the |
| 402 | "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmd‐ |
| 403 | line-completion"). Tags are present to jump from one place to another |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 404 | (sort of hypertext links, see ":help"). All documentation files can be |
| 405 | viewed in this way, for example ":help syntax.txt". |
| 406 | |
| 407 | FILES |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 408 | /usr/local/share/vim/vim??/doc/*.txt |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 409 | The Vim documentation files. Use ":help doc-file-list" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 410 | to get the complete list. |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 411 | vim?? is short version number, like vim91 for Vim 9.1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 412 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 413 | /usr/local/share/vim/vim??/doc/tags |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 414 | The tags file used for finding information in the docu‐ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 415 | mentation files. |
| 416 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 417 | /usr/local/share/vim/vim??/syntax/syntax.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 418 | System wide syntax initializations. |
| 419 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 420 | /usr/local/share/vim/vim??/syntax/*.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 421 | Syntax files for various languages. |
| 422 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 423 | /usr/local/share/vim/vimrc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 424 | System wide Vim initializations. |
| 425 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 426 | ~/.vimrc, ~/.vim/vimrc, $XDG_CONFIG_HOME/vim/vimrc |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 427 | Your personal Vim initializations (first one found is |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 428 | used). |
Bram Moolenaar | 05159a0 | 2005-02-26 23:04:13 +0000 | [diff] [blame] | 429 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 430 | /usr/local/share/vim/gvimrc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 431 | System wide gvim initializations. |
| 432 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 433 | ~/.gvimrc, ~/.vim/gvimrc, $XDG_CONFIG_HOME/vim/gvimrc |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 434 | Your personal gVim initializations (first one found is |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 435 | used). |
Bram Moolenaar | 05159a0 | 2005-02-26 23:04:13 +0000 | [diff] [blame] | 436 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 437 | /usr/local/share/vim/vim??/optwin.vim |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 438 | Script used for the ":options" command, a nice way to |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 439 | view and set options. |
| 440 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 441 | /usr/local/share/vim/vim??/menu.vim |
RestorerZ | 81b62dd | 2024-08-15 21:39:33 +0200 | [diff] [blame] | 442 | System wide menu initializations for gVim. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 443 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 444 | /usr/local/share/vim/vim??/bugreport.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 445 | Script to generate a bug report. See ":help bugs". |
| 446 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 447 | /usr/local/share/vim/vim??/filetype.vim |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 448 | Script to detect the type of a file by its name. See |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 449 | ":help 'filetype'". |
| 450 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 451 | /usr/local/share/vim/vim??/scripts.vim |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 452 | Script to detect the type of a file by its contents. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 453 | See ":help 'filetype'". |
| 454 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 455 | /usr/local/share/vim/vim??/print/*.ps |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 456 | Files used for PostScript printing. |
| 457 | |
| 458 | For recent info read the VIM home page: |
| 459 | <URL:http://www.vim.org/> |
| 460 | |
| 461 | SEE ALSO |
| 462 | vimtutor(1) |
| 463 | |
| 464 | AUTHOR |
| 465 | Most of Vim was made by Bram Moolenaar, with a lot of help from others. |
| 466 | See ":help credits" in Vim. |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 467 | Vim is based on Stevie, worked on by: Tim Thompson, Tony Andrews and |
Bram Moolenaar | 86ae720 | 2015-07-10 19:31:35 +0200 | [diff] [blame] | 468 | G.R. (Fred) Walter. Although hardly any of the original code remains. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 469 | |
| 470 | BUGS |
| 471 | Probably. See ":help todo" for a list of known problems. |
| 472 | |
Christian Brabandt | ce6fe84 | 2024-06-04 21:58:32 +0200 | [diff] [blame] | 473 | Note that a number of things that may be regarded as bugs by some, are |
| 474 | in fact caused by a too-faithful reproduction of Vi's behaviour. And |
| 475 | if you think other things are bugs "because Vi does it differently", |
| 476 | you should take a closer look at the vi_diff.txt file (or type :help |
| 477 | vi_diff.txt when in Vim). Also have a look at the 'compatible' and |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 478 | 'cpoptions' options. |
| 479 | |
Foxe Chen | b90c239 | 2025-06-27 21:10:35 +0200 | [diff] [blame] | 480 | 2025 Jun 27 VIM(1) |