Tuesday, February 21, 2012

What I learnt playing "vimgolf: replacing each line of a block selection"

The substitute command can use delimiters other than /.

For example, let's say you want to replace the path a/b/c with d/e in the current line.

You could use the usual / as the delimiter and escape the forward slashes in the pattern and replacement like this:

But it would be much easier to another delimiter, say ; and avoid the escaping like this:

See :help E146 for more detail