The source for this site is available on GitHub.

All this is vim built-in and requires no plugin. This is a sidenote

This is a test.revisions

  • %: jump to the matching { .. } or ( .. ) etc.
  • =: indent visual selection (<: shift block to the left, >: shift block to the right)
  • ~: change case
  • ctrl-x + : vim ‘context aware’ complete mode (based on set complete list) in insert mode
    • ctrl-n/ctrl-p: next/previous word matching prefix (the difference with ctrl-p/ctrl-n is the context awareness)
    • ctrl-f: file names
    • ctrl-l: whole lines
    • ctrl-d: macro definitions (also in included files)
    • ctrl-i: current and included files
    • ctrl-k: words from a dictionary
    • ctrl-t: words from a thesaurus
    • ctrl-]: tags
    • ctrl-v: Vim command line
    • ctrl-o: language aware completion
  • :set spell [spelllang=fr_fr]/:set nospell: activate/deactivate spell checking
  • :!<command>: execute <command> in a shell without leaving vim (e.g. :!make)
  • :read !<command>: insert result of <command> on next line (e.g. read !ls .)
  • ctrl-O, ctrl-I: navigate through “jump locations” locations, both within current and other opened documents; :jumps to list all jump locations.
  • .: repeat last command
  • macro recording:
    1. q<key>: start recording
    2. (do commands)
    3. q: stop recording
    4. @<key>: replay macro
  • command mode (ex/ed):
    • general syntax: :[[start_line],[end_line]]<verb>/<pattern>/<action>
      • lines shortcuts:
        • :%:1,$: all the lines
        • .: current line
        • $: last line
      • verbs:
        • g: match line with pattern
        • v: reverse match lines
        • s: substitute
      • action:
        • d: delete
        • y: yank
        • <position>j: join (-1j go up one line and join)
        • m<position>: move lines (e.g. m$ to move at the end of file)
    • examples:
      • :%g/foo/s/bar/zzz/g: for every line containing foo substitute all bar with zzz.
      • :%g/bar/m/baz/+1: moves next bar occurrence 1 line after next baz occurrence
      • :%g/bar(/ normal nmaf(ldi(`aPa.:
        1. g/bar(/ executes the following command on every line that contains “bar(“
        2. normal execute the following text as if it was typed in in normal mode
        3. n goes to the next match of “bar(“ (since the :g command leaves the cursor position at the start of the line)
        4. ma saves the cursor position in mark a
        5. f( moves forward to the next opening bracket
        6. l moves right one character, so the cursor is now inside the brackets
        7. di( delete all the text inside the brackets
        8. `a go back to the position saved as mark a (i.e. the first character of “bar”)
        9. P paste the deleted text before the current cursor position
        10. a. go into insert mode and add a “.”
      • vim convert.csv "+:v/^\"oai:/-1j" "+wq" : concatenate lines starting by "oai: with previous line using a non-interactive script