Ctrl+P again to print, arrows/tab to navigate results, enter to confirm

    For people completely new to vim check out the vimtutor command. It is a 30 minutes hands-on tutorial. It should be available in a terminal if you have vim installed. Also available in other languages e.g. vimtutor fr

    Normal mode

    Normal vim commands can be entered with the norm command. For example, to insert the numbers 1 through 10, you might write:

    norm10O0<Esc>V(g<C-a>
    x
    

    Where <Esc> is a literal escape char (0x1b), and <C-a> is a literal Ctrl-A (0x01).

    Note that a space is not required between a command name and a digit (or any character [^A-Za-z]).

    Macros

    Unfortunately, macros cannot be stored in registers using q as one would expect (the register is instead cleared (after being created if necessary)). However, a number of auto-registers can be used for the same purpose, including:

    For example, to copy a line, paste it below and increment 10 times, you might write this:

    i
    0Yp<C-a>
    .
    norm lD10@-
    x
    

    A few things to note:

    Command Mode

    Variables

    Special Variable _

    You can use _ as a variable name to save space around if, let, for, etc...

    for n in range(10)
    pu=n
    endfo
    x
    

    becomes

    for_ in range(10)
    pu=_
    endfo
    x
    

    Registers

    Registers can also be used as variables, which can save bytes:

    for@0in range(10)
    pu
    endfo
    x
    

    Registers can also be used without being explicitly declared:

    for_ in range(10)
    let@0.=_
    endfo
    pu!
    x
    

    Note that += and -= are not allowed with registers, as they are implicitly strings.

    Useful for code.golf: pu!=args puts all arguments on a new line and leaves a blank line at the end, which does not break the diff.

    Regex

    Vim regex requires a lot of escaping, so just add a \v to the start of your regex to activate 'very magic' parsing mode, where the regex will now act like most other languages.

    Great post about lookarounds for vim regex

    Links

    Quickref for norm mode - https://vim-jp.org/vimdoc-en/quickref.html#quickref

    Builtin list for command mode - https://vimhelp.org/builtin.txt.html#

    Udioica on golfing macros:

    Udioica's blog explains in details some of his vimgolf solutions: http://udioica.blogspot.com/