Basic Commands
- :q - Quit
- :q! - Quit without saving
- :w - Save changes
- :wq - Save and quit
Navigation
- h, j, k, l - Move cursor left, down, up, right
- gg - Go to beginning of file
- G - Go to end of file
Editing
- i - Insert mode (press Esc to return to normal mode)
- dd - Delete line
- u - Undo
- Ctrl + r - Redo
Configuration
Create or edit your configuration file ~/.vimrc:
set number " Enable line numbers
syntax on " Enable syntax highlighting
set tabstop=2 " Set tab width
set shiftwidth=2 " Set indentation width
set expandtab " Use spaces instead of tabs