A vim-lite modal editor. It draws a full-screen VT100 UI sized to your terminal (80×24 by default, and it follows live resizes), so it only runs inside the interactive terminal. The keys are vim's - modes, counts, motions, operators, registers, regex search and substitute, undo/redo, visual mode, dot-repeat, syntax highlighting. Everything documented here is implemented.
vi notes.txtiEsc:w then Enter:wq:q!
You start in normal mode, where keys are commands, not text. Insert commands
(i a o...) drop you into insert mode where keys are typed literally;
Esc returns to normal. v/V enter visual mode
to select a span, and : / ? open the
command line at the bottom. The mode shows in the status bar.
Most normal-mode commands take a leading count: 5j moves down five
lines, 3dd deletes three lines, 3x deletes three characters.
| Keys | Move to |
|---|---|
h j k l / arrows | left, down, up, right (space also moves right; arrows work in every mode, including insert) |
w W | start of next word (W = whitespace-delimited) |
b B | start of previous word |
e E | end of word |
0 ^ $ | first column, first non-blank, end of line |
gg G {N}G | first line, last line, line N |
H M L | top, middle, bottom of the visible screen |
f{c} t{c} | forward to / till char c on this line |
F{c} T{c} | backward to / till char c on this line |
; , | repeat / reverse the last f t F T |
% | jump to the matching () [] {} |
Ctrl-F Ctrl-B | page forward / back |
Ctrl-D Ctrl-U | half page down / up |
Enter insert mode:
| Keys | Action |
|---|---|
i a | insert before / after the cursor |
I A | insert at first non-blank / end of line |
o O | open a new line below / above |
R | replace mode (overtype until Esc) |
Operators combine with any motion, a count, or themselves for linewise:
| Keys | Action |
|---|---|
d{motion} dd | delete over motion / whole line (e.g. dw, d$, 3dd) |
c{motion} cc | change (delete, then insert); cw acts like ce |
y{motion} yy | yank (copy) into a register |
Single-key edits:
| Keys | Action |
|---|---|
x X | delete char under / before cursor |
r{c} | replace the single char under cursor with c |
s S | substitute char / whole line (then insert) |
C D | change / delete from cursor to end of line |
J | join the next line onto this one |
~ | toggle case of the char under cursor |
| Keys | Action |
|---|---|
p P | paste after / before (linewise or charwise, matching the yank) |
"{a-z} | prefix a yank/delete/paste to use named register a-z |
u | undo |
Ctrl-R | redo |
. | repeat the last change (respects a new count) |
Every delete/change/yank also fills the unnamed register, so a bare p pastes the last
thing you cut. Example: "ayy yanks a line into register a, "ap
pastes it back.
v V | start a charwise / linewise selection |
{motion} | extend the selection with any motion |
d x c y | delete, change, or yank the selection |
Esc | cancel the selection |
| Keys | Action |
|---|---|
/{pat} ?{pat} | search forward / backward (wraps around the file) |
n N | next / previous match in the same direction |
* | search for the word under the cursor |
Patterns are basic regular expressions (BRE): . any char,
* zero-or-more of the previous, [abc] / [a-z] /
[^...] classes, ^ and $ anchors, and \ to escape
a literal. Substitute uses the same engine (see below).
:)| Command | Action |
|---|---|
:w :w {file} | write to the current file (or a named one) |
:q :q! | quit - vi never warns about unsaved changes, so :q and :q! are equivalent |
:wq :x | write and quit |
:{N} | jump to line N |
:s/pat/repl/ | substitute first match on the current line |
:s/pat/repl/g | substitute every match on the line |
:%s/pat/repl/g | substitute across the whole file |
:{A},{B}s/.../g | substitute within a line range |
:{A},{B}d | delete a range of lines |
:syntax on :syntax off | toggle syntax highlighting (:syn on / :syn off also work) |
Ranges accept line numbers, . (current line), $ (last line), and
% (whole file). In the replacement, & stands for the whole match and
\{c} inserts a literal character.
Syntax highlighting is on by default. vi colors C
(.c) and shell (.sh, or a #! line naming
sh) files - keywords, strings, numbers, and comments. Toggle it with
:syntax off / :syntax on.
It is deliberately small. Notable gaps versus real vim:
q / @) and no marks (m / `).:g, no visual-block, no windows/splits or multiple buffers.a-z only - no uppercase append.\+ \? \|, no capture groups, no word-boundary \< \>. f t stay within the current line.