Vim - Extra space inserted after accented letters

2019-07-02 12:35发布

问题:

I have a question about Vim. I'm on a Mac OS X Snow Leopard and compiled vim to start using the editor. Occasionally I type in other languages.

I found that when typing in accented letters an extra space is added after each letter. I'm also using the Macs spanish keyboard to do my typing, in spanish at least.

So this is what happens, I'll type the accent key by using the left bracket key (1), [ , and then vim will highlight the current position in yellow. Then I'll type in my vowel(2). The vowel then has the accent on it but now vim has inserted an extra space after the letter. Anything I type afterwards is a space away already and I'm forced to backspace to delete the extra space that was inserted.(3)

---------------VIM---------------

  1. coraz´
  2. corazó
  3. corazó n

---------------VIM---------------

The same thing happens with the ñ. Right after hitting the 'ñ' key, the semi-colon key on a regular qwerty keyboard, an extra space is inserted.

---------------VIM---------------

  1. Mañ
  2. Mañ ana

---------------VIM---------------

Does anyone know why this happens?

回答1:

Try adding set encoding=utf-8 to your .vimrc (or just test it out at the : prompt)