Friday, December 28, 2007

Stupid VIM tricks, part 1

To insert a GUID into your document simply by typing 'guid', toss this into your .vimrc:


imap guid <esc>:r! C:\path\to\uuidgen.exe<cr>k$Jx40la


The k$Jx40la does as follows:

k -> move up one line
$ -> go to end of line
J -> concatenate line below with this one
x -> delete the space that concatenation created
40l -> move cursor right 40 spaces (length of a guid)
a -> return to insert mode, with cursor positioned where it was before we started

Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?