Hi Nikolai, On 4/26/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote: > 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: >
What will be difference between the existing getchar() function and this new readkey() function? - Yegappan > > 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 >
