# Vim
Vim (Vi IMproved) is a highly configurable text editor built to make text editing efficient. Created by Bram Moolenaar in 1991 as an extended clone of [[Vi]], it adds features like multi-level undo, syntax highlighting, plugin support, and visual mode while retaining Vi's modal editing philosophy.
Vim is pre-installed on most [[Linux]] and [[Unix]] systems and remains one of the most popular terminal-based editors.
## Key improvements over Vi
- **Multi-level undo/redo**
- **Syntax highlighting** for hundreds of languages
- **Visual mode** for block selection
- **Split windows and tabs**
- **Plugin system** (Vimscript, later Vim9 script)
- **Command-line completion**
- **Integrated help system** (`:help`)
- **Registers** for multiple clipboards
- **Macros** for recording and replaying keystrokes
## Modes
| Mode | Purpose | Enter with |
|------|---------|-----------|
| Normal | Navigation, commands | `Esc` |
| Insert | Typing text | `i`, `a`, `o` |
| Visual | Selecting text | `v`, `V`, `Ctrl+v` |
| Command | Ex commands | `:` |
| Replace | Overwrite text | `R` |
## Essential commands
```vim
" Movement
w/b " Word forward/back
gg/G " File start/end
0/$ " Line start/end
Ctrl+d/Ctrl+u " Half-page down/up
" Editing
ciw " Change inner word
diw " Delete inner word
yiw " Yank inner word
. " Repeat last change
" Search
/pattern " Search forward
?pattern " Search backward
n/N " Next/previous match
:%s/old/new/g " Replace all
" Files & buffers
:e file " Open file
:bn/:bp " Next/previous buffer
:split/:vsplit " Split window
```
## Configuration
Vim is configured via `~/.vimrc`:
```vim
set number " Show line numbers
set relativenumber " Relative line numbers
set expandtab " Spaces instead of tabs
set shiftwidth=4 " Indent width
set tabstop=4 " Tab display width
set hlsearch " Highlight search
set incsearch " Incremental search
syntax on " Syntax highlighting
```
## Plugin ecosystem
Vim has a large plugin ecosystem managed via tools like vim-plug, Vundle, or Pathogen. Popular plugins include:
- **NERDTree**: File explorer
- **fzf.vim**: Fuzzy finding via [[fzf]]
- **vim-fugitive**: [[Git]] integration
- **ALE**: Asynchronous linting
## References
- https://www.vim.org/
- https://github.com/vim/vim
- https://en.wikipedia.org/wiki/Vim_(text_editor)
## Related
- [[Vi]]
- [[Neovim]]
- [[Nano]]
- [[fzf]]
- [[ripgrep]]
- [[TMux]]
- [[Git]]
- [[Command Line Interface (CLI)]]
- [[Shell]]
- [[Linux]]
- [[Unix]]
- [[Language Server Protocol (LSP)]]
- [[Visual Studio Code (VSCode)]]