Vim Commands
Vim Commands
Command Description
:w Save
:q Quit
2. Editing Commands
Command Description
1/12
Command Description
r Replace character ( nr )
3. Cursor Movement
Command Description
:n Go to line number n
:1 Go to top of file
:$ Go to end of file
$ Go end of line
0 or ^ Go start of line
2/12
Command Description
Ctrl + b or Pg Up Page up
gg Go to first line
G Go to last line
Command Description
:n Next file
Command Description
n Next occurrence
3/12
Command Description
N Previous occurrence
Command Description
Pattern Description
^ Beginning of line
$ End of line
4/12
Pattern Description
Command Description
Sample .vimrc :
vim
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set nu " Line numbers
set nobackup " No backup files
set ts=5 " Tabstop spaces
set ai " Auto-indent
set ic " Ignore case search
syntax on " Syntax highlighting
set showmatch " Matching brackets highlighting
5/12
set hlsearch " Highlight search results
set ruler " Display cursor position
set smartindent " Intelligent indenting
set expandtab " Convert tabs to spaces
set background=dark " Dark theme
Open .vimrc :
:scriptnames – Lists loaded config files.
Command Description
Complex Examples:
Remove first 5 characters from all lines:
6/12
vim
:%s/^.....//
vim
:%s/.....$//
vim
vim
:vsplit file2.txt
:split file3.txt
✅ Pro Tips:
Macros: Record macros ( qa ... commands ... q ) and replay ( @a ).
This comprehensive guide combines clarity, detailed examples, organized structure, and
extensive additions of useful commands and Vim configurations. It’s designed to support
7/12
practical use and enhance productivity for all levels of users, from beginners to experienced
developers.
0/2
Here are 50 more powerful Vim commands & features to add to your guide:
🚩 Advanced Navigation
Command Description
🎯 Advanced Editing
Command Description
8/12
Command Description
= Auto-indent line(s)
gt Go to next tab
gT Go to previous tab
📌 Buffers Management
Command Description
9/12
Command Description
Command Description
10/12
Command Description
📡 Miscellaneous Utilities
Command Description
11/12
Command Description
These additional 50 commands and features further elevate your Vim skills, enabling greater
efficiency, automation, and powerful editing capabilities.
12/12