Hi Bram and list,
I add a special key name "\<CursorHold>" for K_CURSORHOLD.
How to reproduce:
- Create ~/test.vim of the contents of the following.
augroup hogehoge
autocmd!
autocmd CursorHold,CursorHoldI,WinEnter * setlocal cursorline
augroup END
function! s:foo()
echomsg getchar()
return ''
endfunction
nnoremap <expr>f <SID>foo()
- Start Vim.
$ vim -N -u ~/test.vim
- Into Insertmode and Escape. (Do not reproduce and do not do this)
i<Esc>
- push f key and wait a few seconds.
Actual behavior:
Display "<80><fd>`" at command line.
Investigation result:
- "<80><fd>`" (0x80 0xfd 0x60) is a special key K_CURSORHOLD.
- But can't reference this in vim script such like "\<Left>".
- I want to add a special key name "\<CursorHold>" for K_CURSORHOLD.
Patch included Vim and below script works fine.
-------- ~/test.vim --------
augroup hogehoge
autocmd!
autocmd CursorHold,CursorHoldI,WinEnter * setlocal cursorline
augroup END
function! s:foo()
let c = 0
while c == "\<CursorHold>"
let c = getchar()
endwhile
echomsg c
return ''
endfunction
nnoremap <expr>f <SID>foo()
----------------
Attached a patch. Please include this.
Thanks.
--
Best regards,
Hirohito Higashi
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r 913d16b4904c src/misc2.c
--- a/src/misc2.c Thu Aug 07 13:55:10 2014 +0200
+++ b/src/misc2.c Sun Aug 10 23:32:29 2014 +0900
@@ -2470,6 +2470,7 @@
{K_SNR, (char_u *)"SNR"},
#endif
{K_PLUG, (char_u *)"Plug"},
+ {K_CURSORHOLD, (char_u *)"CursorHold"},
{0, NULL}
};