vim(1)
A highly configurable text editor that improves upon vi with additional features and modes.
Synopsis
vim [OPTION]... [FILE]...Description
Vim is a modal text editor that operates in different modes: Normal mode for navigation and editing, Insert mode for typing text, and Command-line mode for executing commands. It is renowned for its efficiency through keyboard-driven workflows and powerful text manipulation capabilities.
Vim reads configuration from ~/.vimrc and supports syntax highlighting, plugins, and scripting. It is the de facto standard editor on most Unix-like systems and is known for a steep learning curve but exceptional productivity once mastered.
Common options
| Flag | What it does |
|---|---|
-c {command} | Execute Ex command after loading file (e.g., -c ':set number') |
-R | Open file in read-only mode |
+{num} | Jump to line number {num} when opening file |
-u {file} | Use {file} as vimrc instead of ~/.vimrc |
-N | No-compatible mode; use improved features |
-d | Diff mode; compare multiple files side-by-side |
-n | Disable swap file creation |
+/{pattern} | Jump to first occurrence of {pattern} |
-o | Open all files in horizontal split windows |
-O | Open all files in vertical split windows |
Examples
Open myfile.txt for editing; creates it if it doesn't exist
vim myfile.txtOpen myfile.txt and jump to line 50
vim +50 myfile.txtOpen myfile.txt and jump to first occurrence of 'TODO'
vim +/TODO myfile.txtOpen both files in diff mode to compare changes
vim -d file1.txt file2.txtOpen /etc/passwd in read-only mode to prevent accidental changes
vim -R /etc/passwdOpen myfile.txt with line numbers displayed
vim -c ':set number' myfile.txtOpen three files in horizontal split windows
vim -o file1.txt file2.txt file3.txtStart vim using an alternate configuration file
vim -u ~/.vimrc-minimal