Wednesday, 1 July 2009
VIM: Creating Your Own Commands with a Map or a Recording
Customizing your own commands using a map or recording.
A Map is generally used for stored commands.
A Recording is used for one off jobs.
Recordings are more intuitive ie you simply record a sequence of commands.
Maps require a little more knowledge of map special characters <CR><ESC> etc
While it is possible to "save" a recording for future use it's a little tricky
:let @w="<C-R>q" ie read recording q (same as register q) and store in register w, which if put in your .vimrc will be preserved for future use
With experience you should find yourself preferring to create disposable recordings and relying less and less on maps; one well known Vimmer (Peppe) has a practically empty .vimrc.
A Map is generally used for stored commands.
A Recording is used for one off jobs.
Recordings are more intuitive ie you simply record a sequence of commands.
Maps require a little more knowledge of map special characters <CR><ESC> etc
While it is possible to "save" a recording for future use it's a little tricky
:let @w="<C-R>q" ie read recording q (same as register q) and store in register w, which if put in your .vimrc will be preserved for future use
With experience you should find yourself preferring to create disposable recordings and relying less and less on maps; one well known Vimmer (Peppe) has a practically empty .vimrc.
Labels: map, recording, register, vim
Subscribe to Posts [Atom]
Post a Comment