Mercurial > vim
diff runtime/doc/map.txt @ 3153:37ecb8ff4560
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 20 Oct 2011 22:22:38 +0200 |
parents | 3502a7f991fc |
children | 8b8ef1fed009 |
line wrap: on
line diff
--- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.3. Last change: 2011 Aug 19 +*map.txt* For Vim version 7.3. Last change: 2011 Oct 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -237,11 +237,18 @@ For this reason the following is blocked - Editing another buffer. - The |:normal| command. - Moving the cursor is allowed, but it is restored afterwards. -- You can use getchar(), but the existing typeahead isn't seen and new - typeahead is discarded. If you want the mapping to do any of these let the returned characters do that. +You can use getchar(), it consumes typeahead if there is any. E.g., if you +have these mappings: > + inoremap <expr> <C-L> nr2char(getchar()) + inoremap <expr> <C-L>x "foo" +If you now type CTRL-L nothing happens yet, Vim needs the next character to +decide what mapping to use. If you type 'x' the second mapping is used and +"foo" is inserted. If you type 'a' the first mapping is used, getchar() gets +the 'a' and returns it. + Here is an example that inserts a list number that increases: > let counter = 0 inoremap <expr> <C-L> ListItem()