display soft hyphen character in vim in Mac OS X Terminal

954 Views Asked by At

vim is totally confused with soft hyphen characters (0xAD) in the Mac OS X Terminal. It is not displayed, although the "virtual column" number is right, the insertion is messed up.

So if I have a line with a-b, where - is the soft hyphen, it shows as ab in vim, and when I try to replace the character b by c, I obtain instead acb. Quite confusing.

The same happens with pico, but not with emacs.

Is there a way to fix this?

I'm using vim in the Terminal of Mac OS X.

2

There are 2 best solutions below

0
On

iTerm2 does not have this issue with soft hyphens.

@Kevin Ballard If you turn on the "Experimental Renderer" in MacVim's preferences, MacVim renders the soft hyphens correctly.

0
On

Unicode assigns the U+00AD SOFT HYPHEN character East Asian Width Ambiguous, which means it occupies one or two terminal columns—it should be rendered visibly—but Terminal uses the full Unicode text renderer available in OS X, which doesn't render soft hyphens unless it's performing line breaking.

Interestingly, emacs displays soft hyphens by sending a hyphen to the terminal instead of depending on it to render the soft hyphen. vim just sends the soft hyphen to the terminal and assumes it will be displayed.

As of OS X Mountain Lion 10.8, Terminal displays soft hyphens.