-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux Vim Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to Vim text editor on Linux, covering Arch Linux, CachyOS, and other distributions including installation, modes, commands, and configuration.
Arch/CachyOS:
# Install Vim
sudo pacman -S vim
# Or Neovim
sudo pacman -S neovimDebian/Ubuntu:
sudo apt install vimFedora:
sudo dnf install vimStart Vim:
# Open file
vim filename.txt
# Or
vi filename.txtDefault mode:
- Navigation: Move cursor
- Commands: Execute commands
-
Enter: Press
Escto return
Edit text:
-
Enter: Press
i,a, oro - Type: Edit text normally
-
Exit: Press
Esc
Select text:
-
Enter: Press
v - Select: Use arrow keys
-
Exit: Press
Esc
Move cursor:
- h, j, k, l: Left, down, up, right
- w: Next word
- b: Previous word
- 0: Beginning of line
- $: End of line
Edit text:
- i: Insert before cursor
- a: Insert after cursor
- o: New line below
- O: New line above
- x: Delete character
- dd: Delete line
File operations:
- :w: Save
- :q: Quit
- :wq: Save and quit
- :q!: Quit without saving
Find text:
- /pattern: Search forward
- ?pattern: Search backward
- n: Next match
- N: Previous match
Replace:
- :%s/old/new/g: Replace all
- :%s/old/new/gc: Replace with confirm
Yank and paste:
- yy: Copy line
- yw: Copy word
- p: Paste after
- P: Paste before
Edit config:
# Edit vimrc
vim ~/.vimrc
# Or Neovim
vim ~/.config/nvim/init.vimConfiguration:
" Enable line numbers
set number
" Enable syntax highlighting
syntax on
" Set tab size
set tabstop=4
set shiftwidth=4
" Enable mouse
set mouse=a
Check installation:
# Check Vim
which vim
vim --version
# Install if missing
sudo pacman -S vimExit Vim:
# Press Esc
# Then type:
:q!
# Press Enter
This guide covered Vim installation, modes, commands, and configuration for Arch Linux, CachyOS, and other distributions.
- Text Editors - Text editors
- nano Guide - nano editor
-
Vim Documentation:
man vim
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.