jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.09k stars 373 forks source link

Fails for multi-byte characters #374

Open ei14 opened 7 months ago

ei14 commented 7 months ago

Unicode characters that exceed one byte are not treated correctly.

Minimal example

.vimrc

let g:AutoPairs = {"X": "Y", "《": "》"}
imap ABC 《

The characters "《" and "》" are Unicode U+300A and U+300B respectively. They can be typed natively in Vim by typing <C-k><LT>+ and <C-k>>+ respectively. Other multi-byte characters will also present the bug.

Reproduction steps

Tested on a fresh vim install in a newly-made Debian VM.

LunarWatcher commented 7 months ago

https://github.com/jiangmiao/auto-pairs/issues/280