Saturday, 20 June 2009
vim dat cat with yat or dat
I've been using the following HEAVILY recently as I've been working on some spaghetti html pages with mysql,php,Javascript and HTML sprinkled sometimes on the same line. The following help me to precisely "grab" the code I need to alter. I've been favoring VISUAL MODE as this confirms or otherwise that I've selected just what I intend.
Note how the "a" and "i" inner variants differ the 'i' grabs less than
the outer 'a'
vat,dat,yat,cat (visualize,delete,yank,change) a tag
ie dat will delete a whole table if cursor anywhere over < table>
ie yat will yank a whole table row if cursor over < tr>
vit,dit,yit,cit will empty a tag pair
da< just deletes a single tag
di< empties a tag
:help text-objects
seems to work with XML as well
Also quote based text objects (single line only though for some odd reason)
va"
da"
va'
da'
vi"
di"
vi'
di'
di<
and don't forget
di(
da{
etc
zzapper
Note how the "a" and "i" inner variants differ the 'i' grabs less than
the outer 'a'
vat,dat,yat,cat (visualize,delete,yank,change) a tag
ie dat will delete a whole table if cursor anywhere over < table>
ie yat will yank a whole table row if cursor over < tr>
vit,dit,yit,cit will empty a tag pair
da< just deletes a single tag
di< empties a tag
:help text-objects
seems to work with XML as well
Also quote based text objects (single line only though for some odd reason)
va"
da"
va'
da'
vi"
di"
vi'
di'
di<
and don't forget
di(
da{
etc
zzapper
Labels: html, text objects, vim, xml
Subscribe to Posts [Atom]
Post a Comment