Overview
This lecture introduces Vim's modal editing approach, focusing on Normal mode, key movement commands, and how to switch between modes in VSCodeVim.
Vim Modes Overview
- Vim uses different modes for different tasks: Normal, Insert, and Visual.
- Each mode assigns different actions to the same keys; for example,
w types, moves, or selects text depending on mode.
- Modal editing allows for efficient workflow and reduces reliance on complex key combinations.
Normal Mode Basics
- Normal mode is the default in Vim; you cannot insert text here.
- Normal mode focuses on navigation and editing rather than text entry.
- The cursor looks like a rectangle in Normal mode, and "--NORMAL--" shows in the status bar.
Basic Vim Motions
- Use
h, j, k, l keys to move the cursor left, down, up, and right, respectively.
- These motions are fundamental for navigating text in Normal mode.
j and k are also useful in file explorers, command palettes, and selection panes.
Switching Between Modes
- Press
i to enter Insert mode, where you type text as in standard editors.
- Press
<ESC>, <CTRL-C>, or <CTRL-[> to return to Normal mode.
- Spend more time in Normal mode as you become proficient, only using Insert mode for targeted changes.](streamdown:incomplete-link)
VSCodeVim Key Remappings
<CTRL-C> no longer copies; it now returns you to Normal mode.
<CTRL-V> enters Visual-block mode instead of pasting; use p to paste.
<CTRL-F> scrolls forward instead of finding; use / to search.
- Adjust remappings with
vim.useCtrlKeys (global) or vim.handleKeys (per-key) settings.
Key Terms & Definitions
- Normal mode — Default Vim mode for navigation and editing (not for inserting text).
- Insert mode — Mode for typing and inserting text, like in other editors.
- Visual mode — Mode for selecting blocks of text.
- Modal editor — An editor where keys perform different actions based on the current mode.
Action Items / Next Steps
- Practice using
hjkl for movement in Normal mode.
- Use
i to enter, and <ESC>/<CTRL-C> to exit Insert mode.
- Explore
vim.useCtrlKeys or vim.handleKeys settings if remappings interfere with your workflow.