diff options
author | Andy K. Massimino <f8a663@normed.space> | 2021-03-29 19:39:28 -0400 |
---|---|---|
committer | Andy K. Massimino <f8a663@normed.space> | 2021-03-29 19:46:00 -0400 |
commit | b4aea3d1c8db13970f4c2743d20c2df989db6ac0 (patch) | |
tree | 90d09094c363eaf47fb3d055a814e40062ccaa65 /runtime | |
parent | aa6adacd77e59b2cf2ca7bdeae9a24c062b2a9c0 (diff) | |
download | rneovim-b4aea3d1c8db13970f4c2743d20c2df989db6ac0.tar.gz rneovim-b4aea3d1c8db13970f4c2743d20c2df989db6ac0.tar.bz2 rneovim-b4aea3d1c8db13970f4c2743d20c2df989db6ac0.zip |
vim-patch:8.2.2612: col('.') may get outdated column value
Problem: col('.') may get outdated column value.
Solution: Add a note to the help how to make this work and add a test for
it. (closes vim/vim#7971)
https://github.com/vim/vim/commit/18b7d86d7fa997bbb02a069dafacb32a0f73ca1e
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/map.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index edec4a8de7..3ee26b0817 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -224,6 +224,20 @@ text before the cursor and start omni completion when some condition is met. For abbreviations |v:char| is set to the character that was typed to trigger the abbreviation. You can use this to decide how to expand the {lhs}. You should not either insert or change the v:char. + +Also, keep in mind that the expression may be evaluated when looking for +typeahead, before the previous command has been executed. For example: > + func StoreColumn() + let g:column = col('.') + return 'x' + endfunc + nnoremap <expr> x StoreColumn() + nmap ! f!x +You will notice that g:column has the value from before executing "fx", +because "z" is evaluated before "fx" is executed. +This can be solved by inserting <Ignore> before the character that is +expression-mapped: > + nmap ! f!<Ignore>x Be very careful about side effects! The expression is evaluated while obtaining characters, you may very well make the command dysfunctional. |