a readkeys() can't be far behind.  Having a readkey() - singular
probably makes more sense - function would allow us (i.e., me) to do
something like this:

function! s:DeleteComment(inclusive)
  " Delete a language-specific comment
  :
  :
endfunction

function! s:Delete()
  let key = readkey()
  let object = ''
  if key == 'a' || key == 'i'
    let object = readkey()
    if object == 'c'
      return s:DeleteComment(key == 'a')
    endif
  endif
  call feedkeys(key . object)
endfunction

map <buffer> <silent> d <Esc>:call <SID>Delete()<CR>

That is, the input sequence "dac" would delete a comment.  Entering
something else would just be fed to Vim as always.

It would also be nice if the keys read by readkey() came up in the
'showcmd' buffer.

And for anyone suggesting I map "dac" directly, consider the fact that
"dd" will be delayed, which is, to me, unacceptable.

One could map 'd' to map 'ac' once pressed, but it would be hard to
make sure that 'ac' was unbound if the user cancelled the command in
any way.

  nikolai

Reply via email to