Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
3152:3f8227139248 | 3153:37ecb8ff4560 |
---|---|
1 *map.txt* For Vim version 7.3. Last change: 2011 Aug 19 | 1 *map.txt* For Vim version 7.3. Last change: 2011 Oct 12 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
235 For this reason the following is blocked: | 235 For this reason the following is blocked: |
236 - Changing the buffer text |textlock|. | 236 - Changing the buffer text |textlock|. |
237 - Editing another buffer. | 237 - Editing another buffer. |
238 - The |:normal| command. | 238 - The |:normal| command. |
239 - Moving the cursor is allowed, but it is restored afterwards. | 239 - Moving the cursor is allowed, but it is restored afterwards. |
240 - You can use getchar(), but the existing typeahead isn't seen and new | |
241 typeahead is discarded. | |
242 If you want the mapping to do any of these let the returned characters do | 240 If you want the mapping to do any of these let the returned characters do |
243 that. | 241 that. |
242 | |
243 You can use getchar(), it consumes typeahead if there is any. E.g., if you | |
244 have these mappings: > | |
245 inoremap <expr> <C-L> nr2char(getchar()) | |
246 inoremap <expr> <C-L>x "foo" | |
247 If you now type CTRL-L nothing happens yet, Vim needs the next character to | |
248 decide what mapping to use. If you type 'x' the second mapping is used and | |
249 "foo" is inserted. If you type 'a' the first mapping is used, getchar() gets | |
250 the 'a' and returns it. | |
244 | 251 |
245 Here is an example that inserts a list number that increases: > | 252 Here is an example that inserts a list number that increases: > |
246 let counter = 0 | 253 let counter = 0 |
247 inoremap <expr> <C-L> ListItem() | 254 inoremap <expr> <C-L> ListItem() |
248 inoremap <expr> <C-R> ListReset() | 255 inoremap <expr> <C-R> ListReset() |