Monday, July 30, 2012

Show special characters in vim properly (Windows 7 with Czech locale)

Learning vim editor, I got a problem with showing special Czech characters properly.
E.g. characters "ě" and "á" occupied twice the space in width then they should. Writing a line of text with these chars looked like there is always a space added after them.

Finally I found solution.

As I am on Windows 7 and my locale cz, system is using natively encoding cp1250.

Adding line


  set encoding=cp1250

made my vim and me happier.
Actually, I had to add this instruction into my vimrc file (and do one correction, as I had there this instruction twice and the later one was setting utf-8).

This also resolved problems with these chars in menu.

Update: Later on I realized, that it was me, who added the line setting wrong encoding. It was at the time, I was trying to resolve problems with some of my files showing as if they would be written in Japanese.
So when I finally removed all lines with

    set encoding=xxxxx
    "remove all these lines to let default work on its own


I got it all working as it should.

No comments:

Post a Comment