On Fri, 22 Feb 2008 14:52:01 +0100, "Andy Wokula" <[EMAIL PROTECTED]>
said:
>
> Nick Gravgaard schrieb:
> >>>> And you cannot compare 2d- with 2dd, you have to compare it with 2d+.
> >>> Sure, but 2dd is quicker to type than 2d+, and I'm not sure how many
> >>> people really use 2d-.
> >> I don't. I use 2dj and 2dk, not 2d+ and 2d-.
> >
> > Of course. I'll try training myself to use this instead.
> >
> > Before I do though, is there any way to script Vim so that dd (for
> > instance) counts from zero?
>
> :nnoremap <expr> dd v:count ? "dj" : "dd"
>
> dd -> dd
> 1dd -> 1dj
> 2dd -> 2dj
>
> " map more operators this way:
> " :h operator
> " maps "~" if 'tildeop' set
> for opr in split("c d y g~ gu gU ! = gq gw g? > <lt> zf "." ~"[&top])
> exec "nn <expr>" opr.opr "v:count ? '".opr."j' : '".opr.opr."'"
> echo "nn <expr>" opr.opr "v:count ? '".opr."j' : '".opr.opr."'"
> if strlen(opr) == 2
> exec "nn <expr>" opr.opr[1] "v:count ? '".opr."j' : '".opr.opr."'"
> echo "nn <expr>" opr.opr[1] "v:count ? '".opr."j' : '".opr.opr."'"
> endif
> endfor
> unlet opr
>
> " Side note:
> " "zff" doesn't wait for a character, as long as there is no user omap
> " for f{char}, like "ff", "fa", etc.
Brilliant. Works a treat, thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---