Yakov Lerner wrote:
> In the example below, the 'cabbrev <silent>' doesn't work,
> while identical cabbrev without <silent> works ok (vim70d02)
> -----------------------------------------------
> vim -u cab.vim # where cab.vim is below
> :GG<space> # this works, produces expected :GG *
> :BB<space> # doesn't work, does not produce :BB *
> :BB<space><space> # cursor jumps to column 9, why?
> :BB<space><space><bs> # finally produces :BB * ...
>
> ------------------------------------------------
> " cab.vim
> set nocp
> cabbrev GG GG *<C-R>=Eatchar('\s')<CR>
> cabbrev <silent> BB BB *<C-R>=Eatchar('\s')<CR>
>
> func! Eatchar(pat) "
> let c = nr2char(getchar(0))
> return (c =~ a:pat) ? '' : c
> endfunc
> --------------------------------------------------
You can see that pressing <BS> shows the text you expected, thus it's a
redrawing problem. This actually is documented below ":map-silent":
Using "<silent>" for an abbreviation is possible, but will cause
redrawing of the command line to fail.
--
>From "know your smileys":
@:-() Elvis Presley
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://www.ICCF.nl ///