Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wonky multibyte character display in vim when editing over ssh

If I just open a terminal and edit a file in vim, multibyte characters display fine: source file with greek characters

However, if I ssh into my machine (even just using ssh localhost), multibyte characters start looking a bit wonky. They take up more room on the line (note the extra whitespace at the end of the line with p1 = "αβγβγγ")

phantom spaces

And editing the line tends to display ? characters as placeholders:

after an xp normal mode command on the alpha

I think this is some sort of environment, since :set encoding reports utf-8 when not using ssh and latin1 when using ssh. I suppose I could hardcode it to utf-8 in my .vimrc file, but I'd rather figure out what's causing the issue, and fix it more properly.

like image 409
rampion Avatar asked Dec 26 '12 04:12

rampion


2 Answers

set encoding=utf-8
set termencoding=utf-8

in your ~/.vimrc should take care of your issue.

Make sure that Terminal.app is itself correctly setup for UTF-8 and that the locale of your machine is also set to some form of UTF-8.

like image 134
romainl Avatar answered Oct 17 '22 09:10

romainl


set ambiwidth=double

in your .vimrc might solve this issue.

Did you tick the check-box labeled Unicode East Asian Ambiguous characters are wide? enter image description here

like image 2
ernix Avatar answered Oct 17 '22 09:10

ernix