Vim

1 February 2015

This isn’t a cheatsheet and doesn’t replace one. It’s the useful commands I would personally forget before I wrote them here.

Command
C Replace to end of line
dG Delete to end of file
:sort Sort selected lines
:sort u Sort, keeping unique entries
:sort n Sort by first number seen
:noh Remove highlights from previous search
:set nu Numbers on left (nu! to toggle off)
:set rnu Relative numbers on left (useful to know how much to yy)
:set paste Avoid strange indentation when pasting from clipboard

A good .vimrc (I prefer to keep it as default as possible)

set tags=./tags,tags;
set path+=**

au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=79 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix