π§ Vim Training Guide π Sessions 1 & 2 β Core Navigation & Editing Skills
This guide helps you master Vim step by step with hands-on exercises. Follow actively inside nvim for best results.
π SESSION 1: Basics Modes, Movement, Insert, Save/Quit π Exercise 1: Moving Around
Use:
h β left j β down k β up l β right * * *
* *
π Land on each * without arrow keys.
βοΈ Exercise 2: Insert Mode
Steps:
Move with h/j/k/l Press i Type text Press Esc The capital of India is _____. Neovim is a modern version of _____. The four main modes are Normal, Insert, Visual, and _____. The key 'j' moves the cursor . To save a file, type : in command mode. β¨οΈ Exercise 3: Insert Variants Use 'A' to append text at the END of this line --> <-- Use 'I' to insert text at the START of this line Use 'o' to open a new line BELOW this line Use 'O' to open a new line ABOVE this line Use 'a' to append text AFTER the cursor on this line πΎ Exercise 4: Save & Quit Command Action :w Save :q Quit :wq Save & Quit :q! Force Quit ZZ Save & Quit ZQ Quit without saving nvim session1_practice.txt π Exercise 5: Modes Mode Indicator Insert -- INSERT -- Visual -- VISUAL -- Normal (none)
Practice:
i β Esc β a β Esc β o β Esc β I β Esc β A β Esc β O β Esc π§ Exercise 6: Golden Rule
Always return to NORMAL mode.
Normal = Control Insert = Typing Visual = Selecting Command = Executing
π― Spend 80% time in Normal mode
π SESSION 2: Movement Mastery Word, Line, Screen Navigation π€ Exercise 1: Word Movement
Commands:
w β next word b β previous word e β end of word The quick brown fox jumps over the lazy dog near the river. π Exercise 2: word vs WORD hello-world foo.bar test_name some-thing else.more stuff w β stops at punctuation W β skips punctuation π Exercise 3: Line Navigation
Commands:
0 β start of line
^ β first non-blank
$ β end of line
g_ β last non-blank
indented line with leading spaces and trailing spaces here
another deeply indented line of code goes here
this line starts at column 1 with no indentation at all here
int x = 42; // notice the difference between 0 and ^
π Practice: 0 β ^ β $ β g_
π’ Exercise 4: Vertical Jumps gg β top G β bottom 50G β line 50 :100 β line 100 π Exercise 5: Counts one two three four five six seven eight nine ten eleven twelve
Examples:
3w 5w 2b 4e π Exercise 6: Paragraph Jumps { β previous paragraph } β next paragraph π Exercise 7: Bracket Matching
Use %:
function example() { if (condition) { return [1, 2, 3]; } }
array = [one, two, [nested, list], four] result = (a + b) * (c - d) π₯οΈ Exercise 8: Screen Movement H β top of screen M β middle L β bottom Ctrl-d β half down Ctrl-u β half up Ctrl-f β full down Ctrl-b β full up zz β center π Exercise 9: Combo Practice apple banana cherry date elderberry fig grape honeydew kiwi lemon
Tasks:
2w β cherry 8w β kiwi 8b β back to apple $ β end 0 β start β‘ Exercise 10: Speed Drill
Navigate WITHOUT h j k l:
The cat [TARGET] sat on the mat. The dog [TARGET] ran in the park. The bird [TARGET] flew over the trees. The fish [TARGET] swam in the pond. The horse [TARGET] galloped across the field with great [TARGET] speed and energy. π Extra Lines (for jumping) line 80 line 81 ... line 100 <-- try :100 or 100G ... line 110 π Progress
β Session 1 Completed β Session 2 Completed