Category Archives: vim

Vim Key Mappings

One of the things I always found awkward about Vim is stretching for the ESC key to get out of insert mode.
Here's a little trick that I like to add into my .vimrc file:
PLAIN TEXT
CODE:

map  <space> i

imap <S-space> <esc>

This will let you escape insert mode by pressing shift and space and enter insert mode [...]

Vim: Search and Replace, Insert new line

Vim has some really useful commands, especially search and replace ones. Unfortunately I'm always forgetting the finer details of how to use them so here's an example:
PLAIN TEXT
CODE:

:%s/$/\rthis is a new line

To break down whats happening above:

: switches Vim into command mode
% means we're going to apply this command to every line in our [...]