The most useful feature that I find in VIM is the "recording" feature (:help recording). I have used this to automatically insert function headers, re-indent lines, and convert some 34 source files into HTML.
This feature is most useful when you want to do some repeated jobs, which you cant do easily using ".". You can set about writing a function, define a mapping, etc, but then these things might take time. By recording, you can try out and find the actual keystrokes that does the job.
To start recording, press "q" in normal mode followed by any of "0-9a-z". This will start recording the keystrokes to the register you choose. You can also see the word "recording" in the status(?) line. You can start the key sequences that you want to record. You can go to insert mode and type if you want.
To stop recording, press "q" in the normal mode.
To playback your keystrokes, press "@" followed by the character you choose. Pressing "@@" will repeat the same again.
Monday, February 11, 2008
vim - recording keystrokes and reusing
http://www.vim.org/tips/tip.php?tip_id=144
Subscribe to:
Post Comments (Atom)
1 comment:
It is useful to try everything in practise anyway and I like that here it's always possible to find something new. :)
Post a Comment