VIM(1)

πŸ’– VIM(1) πŸ’–

okay bestie, so this is the General Commands Manual page for vim, and honestly? it's giving "the most iconic text editor of all time" energy πŸ‘‘. there's a lot here so stay with me β€” every flag matters, i promise.


✨ NAME ✨

vim β€” Vi IMproved, a programmer's text editor. that's it, that's the whole name. slay πŸ’…


🌸 SYNOPSIS 🌸

vim [options] [file ..]
vim [options] -
vim [options] -t tag
vim [options] -q [errorfile]

ex
view
gvim gview evim eview
rvim rview rgvim rgview

like, all of these are valid ways to summon it. the last block? that's the "call me by a different name and i'll act different" thing, which we'll get to πŸ‘€


πŸ¦‹ DESCRIPTION πŸ¦‹

so Vim is a text editor that is upwards compatible to Vi β€” meaning anything Vi can do, Vim can do better, no cap. it can edit, like, all kinds of plain text, and it is especially useful for editing programs (yes, that's the whole reason it exists, and yes it ate πŸ”₯).

there are a lot of enhancements on top of Vi, bestie:

  • multi level undo
  • multi windows and buffers
  • syntax highlighting
  • command line editing
  • filename completion
  • on-line help
  • visual selection
  • etc. (the manpage literally says "etc..", icon behavior ✨)

want the full rundown of how Vim differs from Vi? <green>:help vi_diff.txt</green> has a summary. iykyk 🫢

while Vim is running you can get a lot of help from the on-line help system with the <green>:help</green> command. check the ON-LINE HELP section below (that's a whole other part of the manual, not this one, okay? πŸ‘€).

πŸ’‘ most of the time you just start Vim to edit a single file, like: text vim file

more generally, Vim gets started with:

vim [options] [filelist]

if the filelist is missing, the editor starts with an empty buffer. otherwise, you use exactly one out of the following four ways to choose which file(s) to edit β€” not two, not three, exactly one, bestie 😌


🌈 ways to pick your file(s)

  • file .. β€” a list of filenames. the first one becomes the current file and gets read into the buffer. the cursor lands on the first line of the buffer. you get to the other files with the <green>:next</green> command. and if you ever need to edit a file whose name starts with a dash, precede the whole filelist with -- (so, like, vim -- -weirdfile energy πŸŽ€).
  • - β€” the file to edit is read from stdin. commands are read from stderr, which should be a tty. yes, it's that iconic little combo πŸ“Ό.
  • -t {tag} β€” the file to edit and the initial cursor position both depend on a "tag", which is basically a sort of goto label. {tag} gets looked up in the tags file, and the associated file becomes the current file, and the associated command gets executed. mostly this is used for C programs, where {tag} could be a function name πŸ’…. the effect: the file containing that function becomes the current file and the cursor is positioned on the start of the function. see <green>:help tag-commands</green>.
  • -q [errorfile] β€” start in quickFix mode. the file [errorfile] is read and the first error is displayed 😭. if [errorfile] is omitted, the filename comes from the 'errorfile' option (defaults to "AztecC.Err" for the Amiga, and "errors.err" on other systems). jump to further errors with <green>:cn</green>. see <green>:help quickfix</green>.

🧚 how Vim behaves depends on the name you called it

for real, the executable may still be the same file β€” Vim is just built different depending on what you named it. vibe check:

  • vim β€” the "normal" way. everything is default. the main character 🫢
  • ex β€” start in Ex mode. get to Normal mode with the <green>:vi</green> command. can also be done with the -e argument.
  • view β€” start in read-only mode. you'll be protected from writing the files πŸ”’. can also be done with the -R argument.
  • gvim gview β€” the GUI version. starts a new window πŸͺŸ. can also be done with the -g argument.
  • evim eview β€” the GUI version in easy mode. starts a new window. can also be done with the -y argument.
  • rvim rview rgvim rgview β€” like the above, but with restrictions 😈. it will not be possible to start shell commands, or to suspend Vim. can also be done with the -Z argument.

πŸ’… OPTIONS πŸ’…

kay so general rules first, because the manpage said so:

  • the options may be given in any order, before or after filenames (yes, literally any order, she's flexible ✨)
  • options without an argument can be combined after a single dash (so -xyz is a whole mood)

  • +[num] β€” for the first file, the cursor will be positioned on line "num". if "num" is missing, the cursor lands on the last line. (so just + alone = "take me to the end" πŸ’€)
  • +/{pat} β€” for the first file, the cursor will be positioned on the line with the first occurrence of {pat}. see <green>:help search-pattern</green> for the available search patterns πŸ”Ž
  • +{command} and -c {command} β€” {command} will be executed after the first file has been read. {command} is interpreted as an Ex command. if {command} contains spaces it must be enclosed in double quotes (this depends on the shell that is used, so like, know your shell bestie 🫢). example:
vim "+set si" main.c
⭐ Note: you can use up to 10 "+" or -c commands. ten. not eleven. the limit is real.
  • -A β€” if Vim has been compiled with ARABIC support for editing right-to-left oriented files and Arabic keyboard mapping, this option starts Vim in Arabic mode, i.e. 'arabic' is set. otherwise an error message is given and Vim aborts 😭
  • -b β€” Binary mode. a few options will be set that make it possible to edit a binary or executable file 🧬
  • -C β€” Compatible. sets the 'compatible' option. this makes Vim behave mostly like Vi, even though a .vimrc file exists (she's cosplaying, okay?)
  • -d β€” start in diff mode. there should be between two to eight file name arguments. Vim will open all the files and show differences between them. works like vimdiff(1) πŸ”βœ¨
  • -d {device}, -dev {device} β€” open {device} for use as a terminal. only on the Amiga. example: "-d con:20/30/600/150" πŸ–₯️
  • -D β€” Debugging. go to debugging mode when executing the first command from a script πŸ›
  • -e β€” start Vim in Ex mode, just like the executable was called "ex".
  • -display {display} β€” run Vim on {display}, connecting to that X server instead of the one in $DISPLAY. the "--display" long form is accepted only by the GTK+ 2 or GTK+ 3 GUI. both forms require the +xterm_clipboard feature πŸ–‡οΈ
  • -E β€” start Vim in improved Ex mode, just like the executable was called "exim".
  • -f β€” Foreground. for the GUI version, Vim will not fork and detach from the shell it was started in. on the Amiga, Vim is not restarted to open a new window. this option should be used when Vim is executed by a program that will wait for the edit session to finish (e.g. mail πŸ“§). on the Amiga the <green>:sh</green> and <green>:!</green> commands will not work 🚫
  • -F β€” if Vim has been compiled with FKMAP support for editing right-to-left oriented files and Farsi keyboard mapping, this option starts Vim in Farsi mode, i.e. 'fkmap' and 'rightleft' are set. otherwise an error message is given and Vim aborts.
πŸ’€ Note: Farsi support has been removed in patch 8.1.0932. so like... she's a historical icon now.
  • -g β€” if Vim has been compiled with GUI support, this option enables the GUI. if no GUI support was compiled in, an error message is given and Vim aborts πŸͺŸ
  • -H β€” if Vim has been compiled with RIGHTLEFT support for editing right-to-left oriented files and Hebrew keyboard mapping, this option starts Vim in Hebrew mode, i.e. 'hkmap' and 'rightleft' are set. otherwise an error message is given and Vim aborts.
  • -i {viminfo} β€” specifies the filename to use when reading or writing the viminfo file, instead of the default "~/.viminfo" πŸ—‚οΈ. this can also be used to skip the use of the .viminfo file entirely, by giving the name "NONE" (bye bestie πŸ‘‹).
  • -l β€” Lisp mode. sets the 'lisp' and 'showmatch' options on.
  • -L β€” same as -r. (yes, that's the whole description. she's brief πŸ’…)
  • -m β€” modifying files is disabled. resets the 'write' option. you can still modify the buffer, but writing a file is not possible ✍️🚫
  • -M β€” modifications not allowed. the 'modifiable' and 'write' options will be unset, so that changes are not allowed and files can not be written. note that these options can be set to enable making modifications (so like, it's a vibe, not a prison 🫢).
  • -n β€” no swap file will be used. recovery after a crash will be impossible 😭. handy if you want to edit a file on a very slow medium (e.g. floppy πŸ’Ύ). can also be done with <green>:set uc=0</green>. can be undone with <green>:set uc=200</green>.
  • -N β€” No-compatible mode. resets the 'compatible' option. this makes Vim behave a bit better, but less Vi compatible, even though a .vimrc file does not exist. (growth, honestly 🌱)
  • -nb β€” become an editor server for NetBeans. see the docs for details πŸ“š
  • -o[N] β€” open N windows stacked πŸͺŸπŸͺŸ. when N is omitted, open one window for each file.
  • -O[N] β€” open N windows side by side πŸͺŸπŸͺŸ. when N is omitted, open one window for each file.
  • -p[N] β€” open N tab pages πŸ—‚οΈ. when N is omitted, open one tab page for each file.
  • -P {parent-title} β€” Win32 GUI only: specify the title of the parent application. when possible, Vim will run in an MDI window inside the application. {parent-title} must appear in the window title of the parent application. make sure that it is specific enough πŸ‘€. note that the implementation is still primitive β€” it won't work with all applications and the menu doesn't work πŸ’€
  • -r β€” list swap files, with information about using them for recovery 🩹
  • -r {file} β€” Recovery mode. the swap file is used to recover a crashed editing session. the swap file is a file with the same filename as the text file with ".swp" appended. see <green>:help recovery</green> 🫢
  • -R β€” Read-only mode. the 'readonly' option will be set. you can still edit the buffer, but will be prevented from accidentally overwriting a file πŸ”’. if you do want to overwrite a file, add an exclamation mark to the Ex command, as in <green>:w!</green>. the -R option also implies the -n option (see above πŸ‘€). the 'readonly' option can be reset with <green>:set noro</green>. see <green>:help 'readonly'</green>.
  • -s β€” Silent mode. only when started as "Ex" or when the -e option was given before the -s option 🀫
  • -s {scriptin} β€” the script file {scriptin} is read. the characters in the file are interpreted as if you had typed them ⌨️✨. the same can be done with the command <green>:source! {scriptin}</green>. if the end of the file is reached before the editor exits, further characters are read from the keyboard 🎹
  • -S {file} β€” okay so after Vim reads the first file, it sources {file}. This is literally equivalent to -c "source {file}". {file} cannot start with '-'. If {file} is omitted, "Session.vim" is used, and that only works when -S is the last argument. 🫢
  • -T {terminal} β€” tells Vim the name of the terminal you're using. Only required when the automatic way doesn't work. It should be a terminal known to Vim (builtin) or defined in the termcap or terminfo file. ✨
  • -u {vimrc} β€” use the commands in the file {vimrc} for initializations. All the other initializations are skipped. Use this to edit a special kind of files. You can also skip all initializations by giving the name "NONE". See ":help initialization" within vim for more details. πŸ’…
  • -U {gvimrc} β€” use the commands in the file {gvimrc} for GUI initializations. All the other GUI initializations are skipped. You can also skip all GUI initializations by giving the name "NONE". See ":help gui-init" within vim for more details. πŸŽ€
  • -v β€” start Vim in Vi mode, just like the executable was called "vi". This only has effect when the executable is called "ex". πŸ’€
  • -V[N] β€” verbose, bb. Give messages about which files are sourced and for reading and writing a viminfo file. The optional number N is the value for 'verbose'. Default is 10. πŸ”₯
  • -V[N]{filename} β€” like -V and set 'verbosefile' to {filename}. The result is that messages are not displayed but written to the file {filename}. {filename} must not start with a digit. ✨
  • -w{number} β€” set the 'window' option to {number}. πŸŽ€
  • -w {scriptout} β€” all the characters that you type are recorded in the file {scriptout}, until you exit Vim. This is useful if you want to create a script file to be used with "vim -s" or ":source!". If the {scriptout} file exists, characters are appended. πŸ¦‹
  • -W {scriptout} β€” like -w, but an existing file is overwritten. πŸ’…
  • -x β€” if Vim has been compiled with encryption support, use encryption when writing files. Will prompt for a crypt key. πŸŽ€
  • -X β€” don't connect to the X server. Shortens startup time in a terminal, but the window title and clipboard will not be used. ✨
  • -Y β€” don't connect to the wayland compositor. πŸ¦‹
  • -y β€” start Vim in easy mode, just like the executable was called "evim" or "eview". Makes Vim behave like a click-and-type editor. πŸ‘‘
  • -Z β€” restricted mode. Works like the executable starts with "r". πŸ”₯
  • -- β€” denotes the end of the options. Arguments after this will be handled as a file name. This can be used to edit a filename that starts with a '-'. πŸ’…
  • --clean β€” do not use any personal configuration (vimrc, plugins, etc.). Useful to see if a problem reproduces with a clean Vim setup. 🌸
  • --cmd {command} β€” like using "-c", but the command is executed just before processing any vimrc file. You can use up to 10 of these commands, independently from "-c" commands. 🫢
  • --echo-wid β€” GTK GUI only: echo the Window ID on stdout. πŸ‘‘
  • --gui-dialog-file {name} β€” when using the GUI, instead of showing a dialog, write the title and message of the dialog to file {name}. The file is created or appended to. Only useful for testing, to avoid that the test gets stuck on a dialog that can't be seen. Without the GUI the argument is ignored. 🧚
  • --help, -h, -? β€” give a bit of help about the command line arguments and options. After this Vim exits. πŸ’–
  • --literal β€” take file name arguments literally, do not expand wildcards. This has no effect on Unix where the shell expands wildcards. 🌈
  • --log {filename} β€” if Vim has been compiled with eval and channel feature, start logging and write entries to {filename}. This works like calling ch_logfile({filename}, 'ao') very early during startup. πŸ”₯
  • --nofork β€” foreground. For the GUI version, Vim will not fork and detach from the shell it was started in. πŸ’…
  • --noplugin β€” skip loading plugins. Implied by -u NONE. πŸŽ€
  • --not-a-term β€” tells Vim that the user knows that the input and/or output is not connected to a terminal. This will avoid the warning and the two second delay that would happen. 😭
  • --remote β€” connect to a Vim server and make it edit the files given in the rest of the arguments. If no server is found a warning is given and the files are edited in the current Vim. ✨
  • --remote-expr {expr} β€” connect to a Vim server, evaluate {expr} in it and print the result on stdout. πŸ¦‹
  • --remote-send {keys} β€” connect to a Vim server and send {keys} to it. 🫢
  • --remote-silent β€” as --remote, but without the warning when no server is found. πŸ’…
  • --remote-wait β€” as --remote, but Vim does not exit until the files have been edited. ⭐
  • --remote-wait-silent β€” as --remote-wait, but without the warning when no server is found. 🌸
  • --serverlist β€” list the names of all Vim servers that can be found. πŸ‘‘
  • --servername {name} β€” use {name} as the server name. Used for the current Vim, unless used with a --remote argument, then it's the name of the server to connect to. If the socketserver backend is being used, if the name starts with "/", "./", or "../", it is taken as either an absolute, relative or relative path to the socket. 🫢
  • --clientserver {backend} β€” use {backend} as the backend for clientserver functionality, either "socket", "x11", or "mswin" respectively. Only available when compiled with both socketserver and X11 features present, or if compiled with socketserver on MS-Windows. The $VIM_CLIENTSERVER environment variable may also be set which will be interpreted in the same way, but the --clientserver argument will always take priority. πŸ”₯
  • --socketid {id} β€” GTK GUI only: use the GtkPlug mechanism to run gVim in another window. πŸŽ€
  • --startuptime {file} β€” during startup write timing messages to the file {fname}. πŸ‘‘
  • --ttyfail β€” when stdin or stdout is not a terminal (tty) then exit right away. πŸ’€
  • --version β€” print version information and exit. ⭐
  • --windowid {id} β€” Win32 GUI only: make gVim try to use the window {id} as a parent, so that it runs inside that window. πŸ’…

πŸ’¬ ON-LINE HELP πŸ’¬

Type ":help" in Vim to get started, bestie. Type ":help subject" to get help on a specific subject. For example: ":help ZZ" to get help for the "ZZ" command. Use Tab and CTRL-D to complete subjects (":help cmdline-completion"). Tags are present to jump from one place to another (sort of hypertext links, see ":help"). All documentation files can be viewed in this way, for example ":help syntax.txt". 🌈

πŸ“ FILES πŸ“

Okay, here's where everything lives, no cap:

  • /usr/share/vim/vim92/doc/*.txt β€” the Vim documentation files. Use ":help doc-file-list" to get the complete list. (vim?? is short version number, like vim91 for Vim 9.1) πŸ“š
  • /usr/share/vim/vim92/doc/tags β€” the tags file used for finding information in the documentation files. πŸŽ€
  • /usr/share/vim/vim92/syntax/syntax.vim β€” system wide syntax initializations. ✨
  • /usr/share/vim/vim92/syntax/*.vim β€” syntax files for various languages. 🌈
  • /usr/share/vim/vimrc β€” system wide Vim initializations. πŸ’–
  • ~/.vimrc, ~/.vim/vimrc, $XDG_CONFIG_HOME/vim/vimrc β€” your personal Vim initializations (first one found is used). 🫢
  • /usr/share/vim/gvimrc β€” system wide gvim initializations. πŸŽ€
  • ~/.gvimrc, ~/.vim/gvimrc, $XDG_CONFIG_HOME/vim/gvimrc β€” your personal gVim initializations (first one found is used). πŸ’…
  • /usr/share/vim/vim92/optwin.vim β€” script used for the ":options" command, a nice way to view and set options. πŸ‘‘
  • /usr/share/vim/vim92/menu.vim β€” system wide menu initializations for gVim. πŸ“
  • /usr/share/vim/vim92/bugreport.vim β€” script to generate a bug report. See ":help bugs". πŸ’€
  • /usr/share/vim/vim92/filetype.vim β€” script to detect the type of a file by its name. See ":help 'filetype'". πŸ¦‹
  • /usr/share/vim/vim92/scripts.vim β€” script to detect the type of a file by its contents. See ":help 'filetype'". 🧚
  • /usr/share/vim/vim92/print/*.ps β€” files used for PostScript printing. 🌸

For recent info read the VIM home page: <URL:http://www.vim.org/> πŸ’œ

πŸ‘€ SEE ALSO πŸ‘€

Also peep vimtutor(1), bestie. πŸ’–

πŸ‘‘ AUTHOR πŸ‘‘

Most of Vim was made by Bram Moolenaar, with a lot of help from others. See ":help credits" in Vim. Vim is based on Stevie, worked on by: Tim Thompson, Tony Andrews and G.R. (Fred) Walter. Although hardly any of the original code remains. πŸ’œ

πŸ’€ BUGS πŸ’€

Probably. 😭 See ":help todo" for a list of known problems.

Note that a number of things that may be regarded as bugs by some, are in fact caused by a too-faithful reproduction of Vi's behaviour. And if you think other things are bugs "because Vi does it differently", you should take a closer look at the vi_diff.txt file (or type :help vi_diff.txt when in Vim). Also have a look at the 'compatible' and 'cpoptions' options. 🫢

mwah πŸ’‹ β€” that's a wrap on the VIM(1) man page, dated 2026 Jun 05. Catch you in the group chat, bestie. πŸ’–

πŸ“¦ where this page comes from