Vim手册中文版 VIM(1) 通用命令手册 VIM(1) 名称 vim - Vi 的改进版,程序员用的文本编辑器 概要 vim [选项] [文件 ..] vim [选项] - vim [选项] -t 标签 vim [选项] -q [错误文件] ex view gvim gview evim eview rvim rview rgvim rgview 描述 Vim 是一个向上兼容 Vi 的文本编辑器。可用于编辑各种纯文本文件,尤其适合编辑程序代码。 Vim 在 Vi 的基础上做了大量增强:多级撤销、多窗口与多缓冲区、语法高亮、命令行编辑、文件名补全、在线帮助、可视选择等。详见 ":help vi_diff.txt" 以了解 Vim 与 Vi 之间的差异。 运行 Vim 时,可通过内置的在线帮助系统获得大量帮助,使用 ":help" 命令即可。详见本文档末尾的“在线帮助”部分。 通常使用如下命令启动 Vim 来编辑单个文件: vim 文件 更一般地,Vim 可通过以下方式启动: vim [选项] [文件列表] 如果未指定文件列表,编辑器将以空缓冲区启动。否则,以下四种方式中只能使用一种来选择一个或多个要编辑的文件。 文件 .. 文件名列表。第一个文件将成为当前文件并加载到缓冲区中,光标将定位在缓冲区的第一行。你可以使用 ":next" 命令切换到其他文件。若要编辑以短横线(-)开头的文件,请在文件列表前加上 "--"。 - 要编辑的文件从标准输入(stdin)读取,命令则从标准错误(stderr)读取,而 stderr 应为终端(tty)。 -t {标签} 要编辑的文件和初始光标位置取决于一个“标签”(tag),即一种跳转标记。{标签} 会在标签文件中查找,对应的文件将成为当前文件,并执行关联的命令。这通常用于 C 程序,此时 {标签} 可以是函数名。效果是包含该函数的文件成为当前文件,光标定位在函数开头。详见 ":help tag-commands"。 -q [错误文件] 以快速修复(quickFix)模式启动。读取 [错误文件] 并显示第一个错误。如果省略 [错误文件],则从 'errorfile' 选项获取文件名(Amiga 上默认为 "AztecC.Err",其他系统上为 "errors.err")。可使用 ":cn" 命令跳转到后续错误。详见 ":help quickfix"。 Vim 的行为会根据命令名的不同而有所变化(可执行文件可能仍是同一个)。 vim 正常模式,所有设置均为默认。 ex 以 Ex 模式启动。可用 ":vi" 命令进入普通模式。也可通过 "-e" 参数实现。 view 以只读模式启动。你将受到保护,防止意外写入文件。也可通过 "-R" 参数实现。 gvim gview 图形界面版本(GUI),会打开一个新窗口。也可通过 "-g" 参数实现。 evim eview 图形界面的简易模式,会打开一个新窗口。也可通过 "-y" 参数实现。 rvim rview rgvim rgview 与上述类似,但有使用限制。无法执行 shell 命令或挂起 Vim。也可通过 "-Z" 参数实现。 选项 选项可以任意顺序出现,可在文件名之前或之后。不带参数的选项可以合并写在同一个短横线后。 +[行号] 对于第一个文件,光标将定位在第“行号”行。若省略行号,则光标定位在最后一行。 +/{模式} 对于第一个文件,光标将定位在第一个匹配 {模式} 的行。关于可用的搜索模式,详见 ":help search-pattern"。 +{命令} -c {命令} 在第一个文件读取完成后执行 {命令}。{命令} 被解释为一条 Ex 命令。若 {命令} 包含空格,必须用双引号括起来(取决于所用的 shell)。例如: vim "+set si" main.c 注意:最多可使用 10 个 "+" 或 "-c" 命令。 -A 若 Vim 编译时启用了阿拉伯语支持(用于编辑从右到左的文本和阿拉伯键盘映射),此选项将使 Vim 以阿拉伯语模式启动(即设置 'arabic' 选项)。否则会报错并退出。 -b 二进制模式。设置一些选项,以便编辑二进制或可执行文件。 -C 兼容模式。设置 'compatible' 选项。这会使 Vim 行为更像 Vi,即使存在 .vimrc 文件。 -d 以差异模式(diff mode)启动。应提供 2 到 8 个文件名参数。Vim 将打开所有文件并显示它们之间的差异。功能类似于 vimdiff(1)。 -d {设备}, -dev {设备} 打开 {设备} 作为终端使用。仅适用于 Amiga 系统。例如:"-d con:20/30/600/150"。 -D 调试模式。执行脚本中的第一条命令时进入调试模式。 -e 以 Ex 模式启动 Vim,行为如同执行了名为 "ex" 的程序。 -E 以增强的 Ex 模式启动 Vim,行为如同执行了名为 "exim" 的程序。 -f 前台运行。对于 GUI 版本,Vim 不会 fork 并脱离启动它的 shell。在 Amiga 上,Vim 不会重启以打开新窗口。当 Vim 被某个需要等待编辑会话结束的程序调用时(如邮件程序),应使用此选项。在 Amiga 上,":sh" 和 ":!" 命令将无法使用。 -F 若 Vim 编译时启用了 FKMAP 支持(用于从右到左文本和波斯语键盘映射),此选项将使 Vim 以波斯语模式启动(即设置 'fkmap' 和 'rightleft')。否则会报错并退出。 注意:自 patch 8.1.0932 起,波斯语支持已被移除。 -g 若 Vim 编译时启用了 GUI 支持,此选项将启用图形界面。若未编译 GUI 支持,则报错并退出。 -H 若 Vim 编译时启用了 RIGHTLEFT 支持(用于从右到左文本和希伯来语键盘映射),此选项将使 Vim 以希伯来语模式启动(即设置 'hkmap' 和 'rightleft')。否则会报错并退出。 -i {viminfo} 指定读写 viminfo 文件时使用的文件名,代替默认的 "~/.viminfo"。也可通过指定名称 "NONE" 来跳过使用 .viminfo 文件。 -l Lisp 模式。启用 'lisp' 和 'showmatch' 选项。 -L 与 -r 相同。 -m 禁用修改文件。重置 'write' 选项。你仍可修改缓冲区,但无法保存文件。 -M 不允许修改。'modifiable' 和 'write' 选项将被关闭,因此无法更改内容,也无法保存文件。注意:这些选项仍可通过命令重新启用。 -n 不使用交换文件(swap file)。崩溃后无法恢复。在慢速介质(如软盘)上编辑文件时很有用。也可通过 ":set uc=0" 实现。可通过 ":set uc=200" 恢复。 -N 非兼容模式。重置 'compatible' 选项。这会使 Vim 行为更友好,但与 Vi 的兼容性降低,即使没有 .vimrc 文件也是如此。 -nb 成为 NetBeans 的编辑器服务器。详见文档。 -o[N] 垂直堆叠打开 N 个窗口。若省略 N,则为每个文件打开一个窗口。 -O[N] 水平并排打开 N 个窗口。若省略 N,则为每个文件打开一个窗口。 -p[N] 打开 N 个标签页。若省略 N,则为每个文件打开一个标签页。 -P {父窗口标题} 仅限 Win32 GUI:指定父应用程序的标题。若可能,Vim 将在该应用程序的 MDI 窗口中运行。{父窗口标题} 必须出现在父应用程序的窗口标题中。确保该标题足够唯一。注意:此功能尚不完善,不适用于所有应用程序,菜单也可能无法工作。 -r 列出交换文件,并显示如何使用它们进行恢复。 -r {文件} 恢复模式。使用交换文件恢复之前崩溃的编辑会话。交换文件是与文本文件同名但附加了 ".swp" 的文件。详见 ":help recovery"。 -R 只读模式。设置 'readonly' 选项。你仍可编辑缓冲区,但会防止意外覆盖文件。若确实要覆盖文件,可在 Ex 命令后加感叹号,如 ":w!"。-R 选项还隐含了 -n 选项(见上文)。可通过 ":set noro" 重置 'readonly' 选项。详见 ":help 'readonly'"。 -s 静默模式。仅当以 "Ex" 启动或在 "-s" 之前使用了 "-e" 选项时有效。 -s {脚本输入} 读取脚本文件 {脚本输入}。文件中的字符将被解释为你手动输入的内容。效果等同于执行 ":source! {脚本输入}"。若文件读取完毕后编辑器未退出,则继续从键盘读取输入。 -S {文件} 在第一个文件读取完成后,执行 ":source" 加载 {文件}。这等价于 -c "source {文件}"。{文件} 不能以 '-' 开头。若省略 {文件},则使用 "Session.vim"(仅当 -S 是最后一个参数时有效)。 -T {终端类型} 告诉 Vim 当前使用的终端名称。仅在自动检测失败时需要。应为 Vim 支持的终端(内置)或在 termcap/terminfo 文件中定义的终端。 -u {vimrc} 使用文件 {vimrc} 中的命令进行初始化,跳过其他所有初始化。可用于编辑特定类型的文件。也可通过指定 "NONE" 跳过所有初始化。详见 Vim 内的 ":help initialization"。 -U {gvimrc} 使用文件 {gvimrc} 中的命令进行 GUI 初始化,跳过其他所有 GUI 初始化。也可通过指定 "NONE" 跳过所有 GUI 初始化。详见 Vim 内的 ":help gui-init"。 -v 以 Vi 模式启动 Vim,行为如同执行了名为 "vi" 的程序。仅当可执行文件名为 "ex" 时有效。 -V[N] 详细模式。显示哪些文件被加载,以及 viminfo 文件的读写信息。可选数字 N 用于设置 'verbose' 选项的值,默认为 10。 -V[N]{文件名} 类似 -V,同时设置 'verbosefile' 为 {文件名}。消息将不显示在屏幕上,而是写入 {文件名}。{文件名} 不能以数字开头。 -w{数字} 设置 'window' 选项为 {数字}。 -w {脚本输出} 你输入的所有字符将被记录到文件 {脚本输出} 中,直到退出 Vim。这可用于创建脚本文件,供 "vim -s" 或 ":source!" 使用。若 {脚本输出} 已存在,则内容将被追加。 -W {脚本输出} 类似 -w,但若文件已存在则覆盖。 -x 若 Vim 编译时启用了加密支持,则在写入文件时使用加密,并提示输入密码。 -X 不连接 X 服务器。可缩短终端中的启动时间,但窗口标题和剪贴板将无法使用。 -Y 不连接 Wayland 合成器。 -y 以简易模式启动 Vim,行为如同执行了 "evim" 或 "eview"。使 Vim 行为更像点击即输入的编辑器。 -Z 受限模式。行为如同可执行文件以 "r" 开头。 -- 表示选项结束。其后的参数将被视为文件名。可用于编辑以 '-' 开头的文件。 --clean 不使用任何个人配置(如 vimrc、插件等)。用于测试问题是否在干净的 Vim 环境下仍能复现。 --cmd {命令} 类似 "-c",但命令在处理任何 vimrc 文件之前执行。最多可使用 10 个此类命令,独立于 "-c" 命令。 --echo-wid 仅限 GTK GUI:在标准输出上回显窗口 ID。 --gui-dialog-file {文件名} 使用 GUI 时,不显示对话框,而是将对话框的标题和消息写入文件 {文件名}。文件会被创建或追加。仅用于测试,避免测试因不可见的对话框而卡住。无 GUI 时此参数被忽略。 --help, -h, -? 显示关于命令行参数和选项的帮助信息,然后退出 Vim。 --literal 字面意义处理文件名参数,不展开通配符。在 Unix 系统上无效,因为通配符由 shell 展开。 --log {文件名} 若 Vim 编译时启用了 eval 和 channel 功能,则启动日志记录,并将日志写入 {文件名}。功能类似于在启动早期调用 ch_logfile({文件名}, 'ao')。 --nofork 前台运行。对于 GUI 版本,Vim 不会 fork 并脱离启动它的 shell。 --noplugin 跳过加载插件。-u NONE 时隐含此选项。 --not-a-term 告诉 Vim 用户明确知道输入/输出未连接到终端。这将避免警告和两秒延迟。 --remote 连接到一个 Vim 服务器,并让该服务器编辑后续参数中的文件。若未找到服务器,则发出警告,并在当前 Vim 中编辑文件。 --remote-expr {表达式} 连接到 Vim 服务器,在其中求值 {表达式},并将结果输出到 stdout。 --remote-send {按键} 连接到 Vim 服务器并向其发送 {按键}。 --remote-silent 类似 --remote,但未找到服务器时不发出警告。 --remote-wait 类似 --remote,但 Vim 会等待直到文件编辑完成才退出。 --remote-wait-silent 类似 --remote-wait,但未找到服务器时不发出警告。 --serverlist 列出所有可找到的 Vim 服务器名称。 --servername {名称} 使用 {名称} 作为服务器名。用于当前 Vim,除非与 --remote 参数一起使用,此时表示要连接的服务器名称。 --socketid {ID} 仅限 GTK GUI:使用 GtkPlug 机制将 gVim 嵌入到另一个窗口中。 --startuptime {文件} 启动过程中将时间信息写入文件 {文件}。 --ttyfail 若 stdin 或 stdout 不是终端(tty),则立即退出。 --version 打印版本信息并退出。 --windowid {ID} 仅限 Win32 GUI:让 gVim 尝试使用窗口 {ID} 作为父窗口,从而在该窗口内运行。 在线帮助 在 Vim 中输入 ":help" 可开始使用。输入 ":help 主题" 可获取特定主题的帮助。例如:":help ZZ" 可获取 "ZZ" 命令的帮助。使用 和 Ctrl-D 可补全主题(参见 ":help cmdline-completion")。文档中包含标签(tags),可实现类似超链接的跳转(参见 ":help")。所有文档文件均可通过此方式查看,例如 ":help syntax.txt"。 文件 /usr/local/share/vim/vim??/doc/*.txt Vim 的文档文件。使用 ":help doc-file-list" 可查看完整列表。 _v_i_m_?_? 为版本号缩写,如 Vim 9.1 对应 vim91。 /usr/local/share/vim/vim??/doc/tags 用于在文档中查找信息的标签文件。 /usr/local/share/vim/vim??/syntax/syntax.vim 全局语法初始化文件。 /usr/local/share/vim/vim??/syntax/*.vim 各种编程语言的语法文件。 /usr/local/share/vim/vimrc 全局 Vim 初始化文件。 ~/.vimrc, ~/.vim/vimrc, $XDG_CONFIG_HOME/vim/vimrc 你的个人 Vim 初始化文件(使用第一个找到的)。 /usr/local/share/vim/gvimrc 全局 gvim 初始化文件。 ~/.gvimrc, ~/.vim/gvimrc, $XDG_CONFIG_HOME/vim/gvimrc 你的个人 gVim 初始化文件(使用第一个找到的)。 /usr/local/share/vim/vim??/optwin.vim ":options" 命令使用的脚本,提供一种方便的选项查看和设置方式。 /usr/local/share/vim/vim??/menu.vim gVim 的全局菜单初始化脚本。 /usr/local/share/vim/vim??/bugreport.vim 生成错误报告的脚本。详见 ":help bugs"。 /usr/local/share/vim/vim??/filetype.vim 通过文件名判断文件类型的脚本。详见 ":help 'filetype'"。 /usr/local/share/vim/vim??/scripts.vim 通过文件内容判断文件类型的脚本。详见 ":help 'filetype'"。 /usr/local/share/vim/vim??/print/*.ps 用于 PostScript 打印的文件。 最新信息请访问 Vim 官网: 另见 vimtutor(1) 作者 大部分 Vim 由 Bram Moolenaar 开发,并得到许多人的帮助。详见 Vim 中的 ":help credits"。 Vim 基于 Stevie 开发,贡献者包括:Tim Thompson、Tony Andrews 和 G.R. (Fred) Walter。尽管原始代码几乎已完全重写。 缺陷 很可能有缺陷。详见 ":help todo" 获取已知问题列表。 请注意,某些人认为的“缺陷”,实际上是因为 Vim 忠实复现了 Vi 的行为。如果你认为某些行为是“缺陷”,仅仅因为“Vi 不是这样做的”,建议你仔细阅读 vi_diff.txt 文件(或在 Vim 中输入 :help vi_diff.txt)。也可以查看 'compatible' 和 'cpoptions' 选项。 2025年6月27日 VIM(1) Vim Manual in English. VIM(1) General Commands Manual VIM(1) NAME vim - Vi IMproved, a programmer's text editor SYNOPSIS vim [options] [file ..] vim [options] - vim [options] -t tag vim [options] -q [errorfile] ex view gvim gview evim eview rvim rview rgvim rgview DESCRIPTION Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs. There are a lot of enhancements above Vi: multi level undo, multi windows and buffers, syntax highlighting, command line editing, filename completion, on-line help, visual selection, etc.. See ":help vi_diff.txt" for a summary of the differences between Vim and Vi. 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. 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. 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). 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. 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 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. +[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". -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. -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} {file} will be sourced after the first file has been read. This is equivalent to -c "source {file}". {file} cannot start with '-'. If {file} is omitted "Session.vim" is used (only works when -S is the last argument). -T {terminal} Tells Vim the name of the terminal you are using. Only required when the automatic way doesn't work. 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. It can also be used to 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. It can also be used to 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. 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. --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 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. Type ":help subject" to get help on a specific subject. For example: ":help ZZ" to get help for the "ZZ" command. Use 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 /usr/local/share/vim/vim??/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/local/share/vim/vim??/doc/tags The tags file used for finding information in the documentation files. /usr/local/share/vim/vim??/syntax/syntax.vim System wide syntax initializations. /usr/local/share/vim/vim??/syntax/*.vim Syntax files for various languages. /usr/local/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/local/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/local/share/vim/vim??/optwin.vim Script used for the ":options" command, a nice way to view and set options. /usr/local/share/vim/vim??/menu.vim System wide menu initializations for gvim. /usr/local/share/vim/vim??/bugreport.vim Script to generate a bug report. See ":help bugs". /usr/local/share/vim/vim??/filetype.vim Script to detect the type of a file by its name. See ":help 'filetype'". /usr/local/share/vim/vim??/scripts.vim Script to detect the type of a file by its contents. See ":help 'filetype'". /usr/local/share/vim/vim??/print/*.ps Files used for PostScript printing. For recent info read the VIM home page: 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. 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. 2025 Jun 27 VIM(1)