diff options
author | Bram Moolenaar <bram@vim.org> | 2015-01-27 15:19:24 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2015-01-27 15:19:24 +0100 |
commit | 49d88a964b54255205877406d4e37e19c0597b7e (patch) | |
tree | 55319d4428a8e921409fe63178849857cbb00b81 | |
parent | 3cddfbc8f573e7a535d7ef0b1265a961c8640beb (diff) | |
download | vim-49d88a964b54255205877406d4e37e19c0597b7e.tar.gz |
Problem: It is not possible to have feedkeys() insert characters.
Solution: Add the 'i' flag.
-rw-r--r-- | runtime/doc/eval.txt | 12 | ||||
-rw-r--r-- | src/eval.c | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b778e345..0fb31512 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Dec 07 +*eval.txt* For Vim version 7.4. Last change: 2015 Jan 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2965,9 +2965,12 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* feedkeys({string} [, {mode}]) *feedkeys()* Characters in {string} are queued for processing as if they - come from a mapping or were typed by the user. They are added - to the end of the typeahead buffer, thus if a mapping is still - being executed these characters come after them. + come from a mapping or were typed by the user. + By default the string is added to the end of the typeahead + buffer, thus if a mapping is still being executed the + characters come after them. Use the 'i' flag to insert before + other characters, they will be executed next, before any + characters from a mapping. The function does not wait for processing of keys contained in {string}. To include special keys into {string}, use double-quotes @@ -2981,6 +2984,7 @@ feedkeys({string} [, {mode}]) *feedkeys()* 't' Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, opening folds, etc. + 'i' Insert the string instead of appending (see above). Return value is always 0. filereadable({file}) *filereadable()* @@ -10500,6 +10500,7 @@ f_feedkeys(argvars, rettv) typval_T *rettv UNUSED; { int remap = TRUE; + int insert = FALSE; char_u *keys, *flags; char_u nbuf[NUMBUFLEN]; int typed = FALSE; @@ -10524,6 +10525,7 @@ f_feedkeys(argvars, rettv) case 'n': remap = FALSE; break; case 'm': remap = TRUE; break; case 't': typed = TRUE; break; + case 'i': insert = TRUE; break; } } } @@ -10534,7 +10536,7 @@ f_feedkeys(argvars, rettv) if (keys_esc != NULL) { ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), - typebuf.tb_len, !typed, FALSE); + insert ? 0 : typebuf.tb_len, !typed, FALSE); vim_free(keys_esc); if (vgetc_busy) typebuf_was_filled = TRUE; diff --git a/src/version.c b/src/version.c index 6b98aca6..20291a78 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 601, +/**/ 600, /**/ 599, |