VIM

  • 0 (Move cursor to the beginning of current line)
  • :10,25w temp (Write lines 10 through 25 into file named temp)
  • :1,10m$ (move lines to end of file)
  • :1,10w !command (write lines to shell)
  • :13,14j (join lines 13 and 14)
  • :1,9d (delete lines 1 through 9)
  • :1,$/<b>//g (replace <b> with null)
  • :1,$co$ (copy all lines and put at end of file)
  • :1,$d (delete all lines in file)
  • :1,$l (show tabs and end of lines)
  • :1,$s/<\/b>//g (Replace <\/b> globally)
  • :1,$s/<b>//g (Replace <b> globally)
  • :1,$s/<\/b>//g (replace </b> with null>
  • :1,$!sort (sort file)
  • “2p paste from buffer 2 (there are 9)
  • 2p (paste twice)
  • :50,100s/old/new/gc (replace with confirm)
  • :50,100s/old/new/g (replace old with new in range)
  • 56| (go to column 56)
  • 5>> (indent paragraph)
  • 5yy (Yank 5 lines)
  • a (Append text after the cursor [count] times)
  • A (Append text at the end of the line [count] times)
  • A (Append to end of current line)
  • :ab abbr phrase (create abbreviation)
  • [address]y[a-z][count] (yank line)
  • `{A-Z0-9} To the mark {A-Z0-9} in the correct file)
  • b (Back one word)
  • ^B (Back screenful)
  • ^b (One page backward)
  • c (change)
  • :cq[uit] (Quit always, without writing)
  • CTRL-v (Visual block, by characters)
  • CTRL-V (Visual block, by lines)
  • cw (Change current word to a new word)
  • d5d (Delete five lines)
  • db (Delete word backward)
  • d^ (d caret, not CTRL d – Delete to beginning of line)
  • dd (delete [count] lines)
  • d (delete)
  • :%d (delete all lines)
  • :.,$d (delete from current line to end of file)
  • D (delete the characters under the cursor until the end of the line)
  • d$ (Delete to end of line)
  • ^D (Down half screenful)
  • <Del> or Delete [count] characters under and after the cursor)
  • dw (Delete word from cursor on)
  • :e[dit] (Edit {file})
  • :e[dit]! Edit {file} always. Discard any changes to the current buffer)
  • :e file (Start editing a new file)
  • <Esc> exit Visual mode without making any change)
  • :Explore (directory list)
  • ^F (CTRl F) Forward screenful)
  • = (filter through ‘equalprg’ option command)
  • ! (filter through external command)
  • ^f (One page forward)
  • /foo (find match, ahead)
  • ?foo (find match, behind)
  • :g/a/s///g (Replace a by nothing)
  • :g/a/s// /g (Replace the letter a, by blank)
  • gf (Edit the file whose name is under or after the cursor)
  • gg (Go to file beginning)
  • G (Go to file end)
  • + (Go to next line)
  • – (Go to previous line)
  • gq (format lines to ‘textwidth’ length)
  • H (go to screen top)
  • h (Moves the cursor one character to the left)
  • i (Insert)
  • I (Insert text at the beginning of the cursor line)
  • i (Insert text before the cursor [count] times)
  • >> (indent line)
  • J (Join next line to the end of the current line)
  • j (Moves the cursor down one line)
  • k (Moves the cursor up one line)
  • L (go to screen bottom)
  • l (Moves the cursor one character to the right)
  • :!ls (display file list)
  • :marks {arg}List the marks that are mentioned in {arg} (not a motion command)
  • :marks (List all the current marks not a motion command)
  • M (Go to screen middle)
  • $ (Move cursor to the end of current line)
  • N (Find previous)
  • nG or :n (Cursor goes to the specified line (example 10G goes to line 10)
  • n Repeat the latest “/” or “?” [count] times)
  • N (Repeat the latest “/” or “?” [count] times in opposite direction)
  • o (Open up a new line following the current line and add text there)
  • O (Open up a new line in front of the current line and add text there)
  • !par 40j (Justify selected range to 40 columns wide)
  • : ? (Pattern Search backward for the pattern)
  • /{pattern}[/]Search forward for the [count]’th occurrence of {pattern})
  • : / (Pattern Search forward for the pattern)
  • p (paste after)
  • :q! (Quit, no warning)
  • :q (Quit with warning)
  • :q[uit] (Quit Vim. This fails when changes have been made)
  • :q[uit]! (Quit without writing)
  • :[range]d[elete] Delete {count} lines, starting with [range])
  • :[range]wq[!] [file] Same as above, but only write the lines in [range])
  • R (Begin overstrike or replace mode, use ESC key to exit)
  • r{char} replace the character under the cursor with {char})
  • :r[ead] !{cmd}Execute {cmd} and insert its standard output below the cursor)
  • :r[ead] [name]Insert the file [name] below the cursor)
  • R Enter Insert mode, replacing characters rather than inserting)
  • . (repeat command)
  • :r filename (get file)
  • :r !sort phone.txt (read in sorted file)
  • :set backspace=2 (make backspace standard)
  • :set cmdheight=3 (number of lines for command line)
  • :set colorcolumn=70
  • :set columns=70
  • set fo-=1 (force autowrap)
  • :set hlsearch (highlight matches)
  • :set nomagic (makes . [ ] * searchable)
  • :set nowrap (enable left-right scrolling)
  • :set nu (show line numbers)
  • :set retab (replace tabs with spaces)
  • :set ruler (Turn on ruler)
  • :set ru (show ruler)
  • :set shiftwidth=4
  • :set showtabline=2
  • :set textwidth=20
  • :set wm=60 (70 columns)
  • :set wm=60 (Set 70 columns wide)
  • :set wrap (set wrapping)
  • :%s/foo/^M/g (replace foo with newline)
  • < (shift left)
  • > (shift right)
  • :%s/^/* / (insert “* ” at beginning of every line)
  • :%s/\%u200d//g (delete unicode character)
  • ~ (switch case)
  • :tabc (clost tab)
  • TAB – (Insert tab)
  • :tabl (go to last tab)
  • :tabm n (move tab to position n)
  • :tabnew filename (open new tab)
  • :tabn (go to next tab)
  • una word (unabbreviate a word)
  • << (undent line)
  • U (Restore line)
  • u (Undo last change)
  • ^U (Up half screenful)
  • v (start Visual mode per character)
  • V (Visual mode, by line)
  • :w ++ff=unix (remove line breaks)
  • :w[!][>>] filename (write out)
  • :w file (Write workspace to named file)
  • w (Forward one word)
  • :wq (Write file to disk and quit the editor)
  • :wq! Write the current file and exit always)
  • :w (Write workspace to original file)
  • :w !xclip -selection clipboard (write visual block to clipboard)
  • x (Delete character)
  • X Delete [count] characters before the cursor)
  • x,yd (delete lines x through y)
  • yw (Yank from cursor to end of current word)
  • y (yank)
  • Y (Yank current line)
  • y$ (Yank to end of current line from cursor)
  • yy (Yank current line)
  • zb Scroll the screen so the cursor is at the bottom)
  • :ZQ Quit current file and exit (same as “:q!)
  • zt Scroll the screen so the cursor is at the top)
  • :ZZ Write current file, if modified, and exit)