How do I paste non-ASCII characters into vim?

前端 未结 4 1439
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 11:30

My terminal emulator is configured for Unicode character encoding and my .vimrc contains the line

set encoding=utf-8

but when I try pasting

4条回答
  •  隐瞒了意图╮
    2020-12-29 11:46

    Instead of copying the character from the clipboard and pasting it into the text editor, you can add it to the file using vim's digraph feature.

    So, with default settings, using your example, you could enter insert mode, then hit Control-k, and type e'. The result will be é.

    You can see the list of defined digraphs by running

    :digraphs

    and general help by running

    :help digraph

    which also explains how to customize your mappings.

    If you are truly set on pasting the characters in, Shift-Insert has always worked for me.

提交回复
热议问题