Quick Reference for Practical Vim Tips

| Categories vim  | Tags vim 

Quick Reference for Practical Vim Tips

Vim is hailed as the “God of Editors” — lightweight, fast, fully keyboard-driven, and capable of evolving into a powerful IDE through its plugin system. This article focuses on practical tips for daily development use without flashy tricks, helping you systematically improve your skills.


Fast Navigation Tips

Command Description
w / b Move forward/backward by word
^ / $ Beginning / End of line
gg / G Jump to start / end of file
Ctrl-d / Ctrl-u Scroll down / up half page
zz Center current line on screen
:5 Go to line 5
fx / Fx Jump forward / backward to character x

Editing Tips

Command Description
ci" Change content inside double quotes
di) Delete content inside parentheses
:sort Sort lines
:!bash Run a shell command
:%s/foo/bar/gc Search and replace with confirmation
. Repeat last action
u / Ctrl-r Undo / Redo

Visual Mode

  • v: character-wise selection
  • V: line-wise selection
  • Ctrl-v: block-wise selection (column editing)

Example: Insert comment column-wise

Ctrl-v select multiple lines column-wise
Shift-i type "// "
ESC

Multi-file / Window Operations

Command Description
:vsp filename Open file in vertical split
:sp filename Open file in horizontal split
Ctrl-w h/j/k/l Switch between splits
:bn / :bp Next / Previous buffer
:tabnew Open a new tab

1. File Navigation

Plug 'preservim/nerdtree'           " File tree explorer
Plug 'nvim-telescope/telescope.nvim' " Fuzzy file/symbol search

2. Code Completion / Highlighting

Plug 'neoclide/coc.nvim', {'branch': 'release'}   " Intelligent completion (VSCode backend)
Plug 'nvim-treesitter/nvim-treesitter'            " Syntax highlighting / AST parsing

3. Git Integration

Plug 'tpope/vim-fugitive'          " Git integration
Plug 'lewis6991/gitsigns.nvim'     " Show git change signs

4. Frontend Support

Plug 'mattn/emmet-vim'             " Emmet abbreviations
Plug 'leafgarland/typescript-vim'  " TypeScript syntax
Plug 'pangloss/vim-javascript'     " JavaScript support

Useful .vimrc Configurations

set number
set relativenumber
set clipboard=unnamedplus
set expandtab
set shiftwidth=2
set tabstop=2
set cursorline
syntax enable
filetype plugin indent on

" Key mappings
nmap <C-n> :NERDTreeToggle<CR>
let g:user_emmet_leader_key=','

Summary of Handy Tips

  • Use . and @: to repeat commands efficiently
  • Leverage system clipboard (set clipboard=unnamedplus)
  • Emmet and snippets speed up HTML coding
  • Manage buffers with :b# and :ls when editing multiple files
  • Vim + tmux make a perfect development duo