ZepMode_Vim) that implements a subset of Vim’s commands and keybindings. This is designed to provide a comfortable editing experience for Vim users without attempting to fully replicate all of Vim’s features.
This is a practical implementation focused on commonly-used Vim commands. The goal is to make editing comfortable, not to perfectly emulate Vim’s behavior.
Overview
Vim mode in Zep supports:- Normal, Insert, and Visual modes
- Command counts and registers
- The dot (
.) command for repeating actions - Word and WORD motions
- Text objects for efficient editing
- Ex commands (
:,/,?) - Undo/redo with proper command grouping
Navigation Commands
Basic Motions
Basic Motions
Word Motions
Word Motions
word motions (lowercase)
w- Move forward to start of next wordb- Move backward to start of previous worde- Move to end of current/next wordge- Move backward to end of previous word
WORD motions (uppercase)
W- Move forward to start of next WORD (whitespace-delimited)B- Move backward to start of previous WORDE- Move to end of current/next WORDgE- Move backward to end of previous WORD
Page and File Motions
Page and File Motions
Split Navigation
Split Navigation
Search and Find
Search Commands
Search Commands
Line Search
f<char>- Find character forward on current lineF<char>- Find character backward on current line;- Repeat last find%- Jump to matching delimiter (parentheses, brackets, braces)
File Search
/[pattern]- Search forward in file?[pattern]- Search backward in filen- Next search resultN- Previous search result
Markers
<F8>- Jump to next marker<S-F8>- Jump to previous marker
Editing Commands
Insert Mode
Insert Mode
Entering Insert Mode
i- Insert before cursorI- Insert at first non-whitespace character of linea- Append after cursorA- Append at end of lineo- Open new line belowO- Open new line above
Exiting Insert Mode
<Escape>- Return to normal modejk- Quick escape sequence (typejthenkquickly)
Delete Commands
Delete Commands
Basic Deletion
x,<Del>- Delete character under cursordd- Delete entire lineD,d$- Delete to end of line
Word Deletion
dw- Delete worddW- Delete WORDdiw- Delete inner word (word under cursor)diW- Delete inner WORDdaw- Delete a word (including surrounding whitespace)daW- Delete a WORD (including surrounding whitespace)
Advanced Deletion
dt<char>- Delete to (but not including) characterdi<delimiter>- Delete inside delimiters:di(,di{,di[,di",di'
Change Commands
Change Commands
Change commands delete text and enter insert mode.
Basic Change
cc- Change entire lineC,c$- Change to end of lines- Substitute characterS- Substitute line
Word Change
cw- Change wordcW- Change WORDciw- Change inner wordciW- Change inner WORDcaw- Change a word (with whitespace)caW- Change a WORD (with whitespace)
Advanced Change
ct<char>- Change to characterci<delimiter>- Change inside delimiters:ci(,ci{,ci[,ci",ci'
Copy and Paste
Copy and Paste
Yanking (Copying)
yy- Yank (copy) entire lineY- Yank line (linewise)y(in visual mode) - Yank selected text
Pasting
p- Paste after cursor/lineP- Paste before cursor/line
Registers
Zep supports registersa-z, A-Z, 0-9, _, and " (default register)."<register>y- Yank to specific register"<register>p- Paste from specific register
"ayy yanks current line to register a, "ap pastes it.Visual Mode
Visual Selection
Visual Selection
Entering Visual Mode
v- Character-wise visual modeV- Line-wise visual mode
Visual Mode Operations
d- Delete selectionc- Change selection (delete and enter insert mode)s- Substitute selectiony- Yank (copy) selectionx- Delete selectionC- Change to end of lines in selection
Visual Mode Text Objects
aw- Select a wordaW- Select a WORDiw- Select inner wordiW- Select inner WORD
Advanced Features
Command Counts
Command Counts
Most commands accept a count prefix:
3j- Move down 3 lines5w- Move forward 5 words2dd- Delete 2 lines4x- Delete 4 characters
Dot Command
Dot Command
The
. command repeats the last change operation:Other Commands
Other Commands
Miscellaneous
J- Join current line with next liner<char>- Replace character under cursoru,<C-z>- Undo<C-r>- Redo
Tab and Window Management
H- Previous tab windowL- Next tab window<C-i><C-o>- Switch to alternate file
Font Size
+,<C-=>- Increase font size-,<C-->- Decrease font size
Ex Commands
Command Line Mode
Command Line Mode
Enter ex command mode with:
:- Ex command/- Forward search?- Backward search
Quick Search
<C-p>,<C-,>- Quick search (fuzzy file finder)
Implementation Notes
Zep’s Vim mode is implemented in
src/mode_vim.cpp:14-65 with a focus on the most commonly used commands. The implementation uses a keymap tree structure for efficient command parsing and supports command composition with counts, registers, and motions.Related
Standard Mode
Learn about the alternative standard editing mode
Keymapping
Customize and extend Vim mode keybindings
