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
--------------------------------------------------

Yakov

Reply via email to