VIM(1)

VIM(1) โ€” straight out of the General Commands Manual ๐Ÿฆ‹๐Ÿ’…

โœจ NAME โœจ

vim โ€” Vi IMproved, a programmer's text editor. yeah bestie, that's the whole thing, and it's iconic for a reason ๐Ÿ’–


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

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

ex gex
view
gvim gview vimx evim eview
rvim rview rgvim rgview

๐ŸŒธ DESCRIPTION ๐ŸŒธ

So. Vim is a text editor that is upwards compatible to Vi โ€” meaning all your Vi knowledge still slays here. It can edit literally all kinds of plain text, and it is especially useful for editing programs. it's giving "I was born to read your code" energy fr fr ๐Ÿ˜Œ

There are a LOT of enhancements above Vi, and the list is lowkey stacked:

  • multi level undo ๐Ÿ”ฅ
  • multi windows and buffers ๐ŸชŸ
  • syntax highlighting ๐ŸŒˆ
  • command line editing โœ๏ธ
  • filename completion โšก
  • on-line help ๐Ÿซถ
  • visual selection ๐Ÿ‘€
  • etc.. (the "etc.." is doing so much work here, bestie)

See ":help vi_diff.txt" for a summary of the differences between Vim and Vi. iykyk.

While running Vim a lot of help can be obtained from the on-line help system, with the ":help" command. See the ON-LINE HELP section below. it's genuinely there for you, no gatekeeping โœจ

Most often Vim is started to edit a single file with the command

vim file

More generally Vim is started with:

vim [options] [filelist]

If the filelist is missing, the editor will start with an empty buffer. Otherwise exactly one out of the following four may be used to choose one or more files to be edited. pick one, babes, not all four ๐Ÿ’…

  • file .. โ€” A list of filenames. The first one will be the current file and read into the buffer. The cursor will be positioned on the first line of the buffer. You can get to the other files with the ":next" command. To edit a file that starts with a dash, precede the filelist with "--".
  • - โ€” The file to edit is read from stdin. Commands are read from stderr, which should be a TTY.
  • -t {tag} โ€” The file to edit and the initial cursor position depends on a "tag", a sort of goto label. {tag} is looked up in the tags file, the associated file becomes the current file and the associated command is executed. Mostly this is used for C programs, in which case {tag} could be a function name. The effect is that the file containing that function becomes the current file and the cursor is positioned on the start of the function. See ":help tag-commands". โœจ
  • -q [errorfile] โ€” Start in quickFix mode. The file [errorfile] is read and the first error is displayed. If [errorfile] is omitted, the filename is obtained from the 'errorfile' option (defaults to "AztecC.Err" for the Amiga, "errors.err" on other systems). Further errors can be jumped to with the ":cn" command. See ":help quickfix". ๐Ÿ”ฅ

๐Ÿฆ‹ Vim behaves differently, depending on the name of the command ๐Ÿฆ‹

(the executable may still be the same file โ€” it's one binary with a whole wardrobe, main character energy)

  • vim โ€” The "normal" way, everything is default. ๐ŸŽ€
  • ex โ€” Start in Ex mode. Go to Normal mode with the ":vi" command. Can also be done with the "-e" argument.
  • view โ€” Start in read-only mode. You will be protected from writing the files. Can also be done with the "-R" argument. ๐Ÿ›ก๏ธ
  • gvim gview โ€” The GUI version. Starts a new window.
  • gex โ€” Starts a new gvim window in Ex mode. Can also be done with the "-e" argument to gvim
  • vimx โ€” Starts gvim in "Vi" mode similar to "vim", but with additional features like xterm clipboard support
  • 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 suspend Vim. Can also be done with the "-Z" argument.

๐Ÿ’– OPTIONS ๐Ÿ’–

The options may be given in any order, before or after filenames. Options without an argument can be combined after a single dash. slay, freedom of ordering โœจ

  • +[num] โ€” For the first file the cursor will be positioned on line "num". If "num" is missing, the cursor will be positioned on the last line. ๐Ÿ‘‘
  • +/{pat} โ€” For the first file the cursor will be positioned in the line with the first occurrence of {pat}. See ":help search-pattern" for the available search patterns.
  • +{command}, -c {command} โ€” {command} will be executed after the first file has been read. {command} is interpreted as an Ex command. If the {command} contains spaces it must be enclosed in double quotes (this depends on the shell that is used). Example:
vim "+set si" main.c

Note: You can use up to 10 "+" or "-c" commands.

  • -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 makes it possible to edit a binary or executable file.
  • -C โ€” Compatible. Set the 'compatible' option. This will make Vim behave mostly like Vi, even though a .vimrc file exists.
  • -d โ€” Start in diff mode. There should 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 ":sh" and ":!" 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. ๐Ÿ’€ rip
  • -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, by giving the name "NONE". ๐Ÿ™ˆ
  • -l โ€” Lisp mode. Sets the 'lisp' and 'showmatch' options on.
  • -L โ€” Same as -r.
  • -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.
  • -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 ":set uc=0". Can be undone with ":set uc=200".
  • -N โ€” No-compatible mode. Resets the 'compatible' option. This will make Vim behave a bit better, but less Vi compatible, even though a .vimrc file does not exist.
  • -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 ":help recovery". ๐Ÿซถ
  • -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 ":w!". The -R option also implies the -n option (see above). The 'readonly' option can be reset with ":set noro". See ":help 'readonly'".
  • -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 ":source! {scriptin}". If the end of the file is reached before the editor exits, further characters are read from the keyboard. โŒจ๏ธ
  • -S {file} โ€” sources {file} right after the first file has been read, bestie. It's literally the same as doing -c "source {file}". One lil rule tho: {file} can't start with a -. And if you just... don't give a {file} at all? It uses "Session.vim" instead โ€” but only when -S is the very last argument. ๐Ÿ’…
  • -T {terminal} โ€” tells Vim which terminal you're on. You only need this when the automatic detection is being lazy and doesn't work. It should be a terminal Vim knows about (builtin), or one defined in the termcap or terminfo file.
  • -u {vimrc} โ€” use the commands in {vimrc} for initializations, and skip all the other initializations. Perfect for editing a very specific kind of files. You can also skip literally everything by passing the name "NONE". More deets in :help initialization inside Vim. โœจ
  • -U {gvimrc} โ€” same vibe but for the GUI: use the commands in {gvimrc} for GUI initializations, and skip all the other GUI initializations. Give it the name "NONE" to skip every GUI init entirely. See :help gui-init inside Vim for the lore.
  • -v โ€” start Vim in Vi mode, like the executable had been called "vi". Ngl this only does anything when the executable is called "ex".
  • -V[N] โ€” verbose mode, queen. Spills messages about which files are sourced and about reading and writing a viminfo file. The optional number N is the value for 'verbose'. Default is 10.
  • -V[N]{filename} โ€” same as -V but also sets 'verbosefile' to {filename}. So instead of showing you those messages, it writes them into the file {filename}. Heads up: {filename} must not start with a digit. ๐Ÿšซ
  • -w{number} โ€” sets the 'window' option to {number}.
  • -w {scriptout} โ€” records every single character you type into the file {scriptout}, all the way until you exit Vim. Iconic for making a script file to use with "vim -s" or ":source!". If the {scriptout} file already exists, characters get appended.
  • -W {scriptout} โ€” like -w, except an existing file gets overwritten. no cap.
  • -x โ€” if Vim was compiled with encryption support, use encryption when writing files. It'll prompt you 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. Tradeoffs, bestie.
  • -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 act like a click-and-type editor. ๐Ÿ–ฑ๏ธ
  • -Z โ€” restricted mode. Works like the executable starts with "r".
  • -- โ€” this one denotes the end of the options. Anything after it gets handled as a file name. Super useful when you need to edit a filename that starts with a -. โœจ
  • --clean โ€” do not use any personal configuration at all (vimrc, plugins, etc.). Chef's kiss for checking whether a problem still reproduces with a clean Vim setup.
  • --cmd {command} โ€” like using "-c", but the command runs just before any vimrc file is processed. You can stack up to 10 of these, and they're independent from "-c" commands.
  • --echo-wid โ€” GTK GUI only: echoes the Window ID on stdout.
  • --gui-dialog-file {name} โ€” when you're in the GUI, instead of actually showing a dialog, it writes the title and message of the dialog to file {name}. The file gets created or appended to. Only useful for testing, so a test doesn't get stuck on a dialog that nobody can see. Without the GUI, the argument is just ignored. ๐Ÿ™ˆ
  • --help, -h, -? โ€” gives you a bit of help about the command line arguments and options. After this, Vim exits.
  • --literal โ€” take file name arguments literally, don't expand wildcards. Has no effect on Unix, where the shell does the wildcard expansion anyway.
  • --log {filename} โ€” if Vim was compiled with the eval and channel feature, start logging and write entries to {filename}. 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 you, the user, know that the input and/or output is not connected to a terminal. Avoids the warning and the two second delay that would otherwise happen. โฑ๏ธ
  • --prg-name {name} โ€” set the GTK program name. Only for GTK4 GUI.
  • --remote โ€” connect to a Vim server and make it edit the files given in the rest of the arguments. If no server is found, you get a warning and the files are edited in the current Vim instead.
  • --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-tab โ€” as --remote, but open each file in a new tabpage.
  • --remote-tab-silent โ€” as --remote-silent, but open each file in a new tabpage.
  • --remote-tab-wait โ€” as --remote-wait, but open each file in a new tabpage.
  • --remote-tab-wait-silent โ€” as --remote-wait-silent, but open each file in a new tabpage.
  • --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.
  • --remote-tab[-wait][-silent] โ€” as --remote but use a tab page per file.
  • --role โ€” set a unique role to identify the main window.
  • --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 it's used with a --remote argument, in which case it's the name of the server to connect to. And if the socketserver backend is being used, a name starting with "/", "./", or "../" 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. You can also set the $VIM_CLIENTSERVER environment variable, which gets interpreted the same way โ€” but the --clientserver argument always takes 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}.
  • --stdio-channel โ€” use the stdin and stdout of Vim for a channel instead of for a terminal. Implies "-es": nothing is displayed, no Ex commands are read, and the GUI is not started. A script opens the channel with ch_open() and the address "stdio", see :help --stdio-channel. Only available when compiled with the channel feature.
  • --ttyfail โ€” when stdin or stdout is not a terminal (tty), exit right away. bye bestie ๐Ÿ’€
  • --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" gets you help for the "ZZ" command. Use Tab and CTRL-D to complete subjects (":help cmdline-completion"). Tags are there so you can jump from one place to another (sort of like hypertext links, see ":help"). All the documentation files can be viewed this way, for example ":help syntax.txt". โœจ


๐ŸŒธ FILES ๐ŸŒธ

  • /usr/share/vim/vim92/doc/*.txt โ€” the Vim documentation files. Use ":help doc-file-list" to get the complete list. vim?? is the 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 โ€” the 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 ๐ŸŽ€

vimtutor(1)


๐Ÿ‘‘ 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. ๐Ÿ˜ญ Like, yes, bestie, there are bugs. That's just the vibe. Run :help todo and you'll get the whole receipts list of known problems. Go look, it's all there.

Okay but here's the thing, and this is important, so pay attention ๐Ÿซถ โ€” a bunch of stuff that some people wanna call bugs is actually on purpose. Vim is being extremely faithful to how Vi behaves. Like, too faithful. Iconically faithful. It's not a bug, it's a reproduction ๐Ÿ’…

And if you're out here thinking something's a bug "because Vi does it differently"? Ma'am. ๐Ÿšฉ Take a closer look at the vi_diff.txt file first. Or honestly just type this while you're in Vim:

:help vi_diff.txt

That's it. That's the homework. โœจ

Also, while you're at it, go peek at the 'compatible' and 'cpoptions' options โ€” they explain a whole lot of the "wait why is it like this" energy. ๐Ÿฆ‹ iykyk


And that's a wrap on the whole page, bestie ๐ŸŽ€ This one's from the source dated 2026 Sep 28 and it's page VIM(1) โ€” go forth and :q responsibly. Slay ๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • fedora 43: vim-minimal 2:9.2.1202-1.fc43 ยท Vim AND LGPL-2.1-or-later AND MIT AND GPL-1.0-only AND (GPL-2.0-only OR Vim) AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND GPL-2.0-or-later AND GPL-3.0-or-later AND OPUBL-1.0 AND Apache-2.0 WITH Swift-exception
  • fedora 44: vim-minimal 2:9.2.1202-1.fc44 ยท Vim AND LGPL-2.1-or-later AND MIT AND GPL-1.0-only AND (GPL-2.0-only OR Vim) AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND GPL-2.0-or-later AND GPL-3.0-or-later AND OPUBL-1.0 AND Apache-2.0 WITH Swift-exception
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms