Consider the following command:

     vim -u NONE -c 'noremap!<expr>  - "‘"' \
                 -c 'normal i-' \
                 -c 'wq! result.out'

result.out:
     $ cat result.out | hexdump -C
     00000000  c3 a2 c2 80 c2 98 0a                              |.......|
     00000007

Tested on vim-7.3 from gentoo repos and on vim-7.3.94 (revision f987220caa57).
Everything works fine if it is not expr mapping or if I replace «"‘"» with
«"\u2018"». Same issue with opening double english quote (u201C) and second
level opening russian quote (u201E).

I encountered this bug* while trying to map ' and " to insert smart quotes for my notes.vim plug-in. Fortunately I found a simple workaround (for my use case at least): Don't embed the special characters directly in the <expr> mapping but call a function that returns the special characters instead (in my case the function is defined in a different script but I assume this doesn't matter).

 - Peter Odding

* https://github.com/xolox/vim-notes/blob/3e4ec8fe4b2f68cdedc788f7c503308f618d4865/autoload.vim#L396

--
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

Raspunde prin e-mail lui