Modes
- i - Insert mode
- v - Visual mode (character)
- V - Visual mode (line)
- Ctrl+v - Visual mode (block)
- R - Replace mode
- : - Command mode
- Esc - Normal mode (from any mode)
Basic Movement
Character Movement
- h - Left
- j - Down
- k - Up
- l - Right
- 0 - Start of line
- ^ - First non-blank character of line
- $ - End of line
- g_ - Last non-blank character of line
Word Movement
- w - Next word start
- W - Next WORD start (space-separated)
- e - End of word
- E - End of WORD
- b - Previous word start
- B - Previous WORD start
- ge - End of previous word
Line Movement
- gg - First line
- G - Last line
- {number}G - Go to line number
- : - Go to line (command mode)
- % - Matching bracket/parenthesis
- * - Next occurrence of word under cursor
- # - Previous occurrence of word under cursor
Screen Movement
- H - Top of screen
- M - Middle of screen
- L - Bottom of screen
- Ctrl+u - Half page up
- Ctrl+d - Half page down
- Ctrl+b - Full page up
- Ctrl+f - Full page down
- zz - Center cursor on screen
- zt - Top of screen
- zb - Bottom of screen
Configuration
Config File Location
- ~/.config/nvim/init.lua (Lua config, recommended)
- ~/.config/nvim/init.vim (Vimscript config)
- ~/.vimrc (legacy location, still works)
Example Key Bindings
Customize key mappings in your config:
-- Example Lua config
vim.keymap.set('n', '<leader>w', ':w<CR>', { desc = 'Save file' })
vim.keymap.set('n', '<leader>q', ':q<CR>', { desc = 'Quit' })
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Move to left window' })
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Move to bottom window' })
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Move to top window' })
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Move to right window' })
Or in Vimscript:
" Example Vimscript config
nnoremap <leader>w :w<CR>
nnoremap <leader>q :q<CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
Tips
- Use :help <topic> for built-in help
- Use :checkhealth to diagnose issues
- Leader key is space by default (can be changed)
- Use motions with operators (d, c, y) for powerful editing
- Use . to repeat last change
- Use u to undo, Ctrl+r to redo
- Use :w to save, :q to quit, :wq to save and quit
- Use :split or :vsplit for multiple windows
- Use :tabnew for tabs
- Use * and # to search for word under cursor
- Use /pattern to search forward, ?pattern to search backward
- Use n and N to navigate search results
- Use % to jump to matching bracket/parenthesis
- Use gg to go to top, G to go to bottom
- Use :set number to show line numbers
- Use :set relativenumber for relative line numbers
- Lua config (init.lua) is recommended over Vimscript
- Use plugins via plugin managers (lazy.nvim, packer.nvim, etc.)