A listing of vi commands currently implemented in Code Editor.
Table 1. Cursor movement Keystrokes Description hlkj character left, right; line up, down bw word/token left, right ge e end of word/token left, right 0^$ beginning, first, last character of line nG/:n ngg line n, default the last, first BW space-separated word left, right gE E end of space-separated word left, right HML Top, middle, bottom of screen g0 gm beginning, middle of screen line g^ g$ first, last character of screen line fc Fc next, previous occurrence of character c tc Tc before next, previous occurrence of c Table 2. Insertion and Replace (insert mode) Keystrokes Description ia insert before, after cursor IA insert at beginning of first character, end of line gI (g + Capital I) insert text in first column/go to first column oO open a new line below, above the current line rc replace character under cursor with c R replace characters starting at the cursor cm change text of movement command m cc or S change current line C change to the end of line Table 3. Deletion Keystrokes Description xX delete character under (right), before (left) cursor dm delete text of movement command m dd D delete current line, to the end of line J gJ join current line with next, without space :rd delete range r lines Table 4. Search and Substitution Keystrokes Description /s← ?s← search forward, backward for s n or /← repeat forward last search N or ?← repeat backward last search #* search backward, forward for complete word under cursor g# g* same, but also find partial matches gd gD local, global definition of symbol under cursor :rs/f /t/x substitute f by t in range r; x: g -- all occurrences, c -- confirm changes Table 5. Copying Keystrokes Description ym yank the text of movement command m yy/:y or Y yank current line into register :ry yank r range of lines pP put register after, before cursor position Table 6. Undoing, Repeating and Registers Keystrokes Description uU undo last command, restore last changed line . repeat last changes .n repeat last changes with count replaced by n Table 7. Standard Mode Formatting / Filtering Keystrokes Description ~ switch case and advance cursor g~m gum gUm switch case, lc, uc on movement m Table 8. Insert Mode Keystrokes Description esc or ^] abandon editing → command mode Table 9. Marks, Motions, and Tags Keystrokes Description mc mark current position with mark c ∈ [a Z] 'c 'C go to mark c in current, C in any file Table 10. Misc IO related commands Keystrokes Description :e f edit file f, reload current file if no f :rw f write range r to file f (current file if no f ) (:w, :w f) :q :q! quit and confirm, quit and discard changes :wq or :x or ZZ write to current file and exit :r f insert content of file f below cursor :n next file :p previous file :n,kw >> file1 append lines n-k into another file file1. Table 11. Ranges Keystrokes Description ,; separates two line numbers, set to first line :n,m lines n to m n an absolute line number n .$ the current line, the last line in file %* entire file, visual area (exclude) 't position of mark t /p/ ?p? the next, previous line where p matches +n -n +n, −n to the preceding line number Table 12. Folding Keystrokes Description zo zc zO zC open, close one fold; recursively [z ]z move to start, end of current open fold zj zk move down/up to start/end of next/previous fold zm zM fold more, close all folds zr zR fold less, open all folds