April 2010

Nailing two annoyances of Win32 gVim

Only just figured this out today… largely because one I didn’t notice until this afternoon, the other has bugged me for quite a while, but I didn’t notice the fix until this afternoon while fixing the first.

Both relate to the default configuration of gVim.

Annoyance 1: UTF-8 Encoding

On my system it defaulted to Latin1 encoding of text files.  Earlier I had written a file in UTF-8 on my netbook, transferred it to my laptop at work to continue editing… only to discover that some UTF-8 chars had been altered.

The fix

As per the suggestions here, stick the following two lines into your $VIM_DIR\_vimrc file (by default; $VIM_DIR = C:\Program Files\Vim):

set fileencoding=utf8
set fileencodings=ucs-bom,utf8,prc

Annoyance 2: Win32 gVim visual mode doesn’t behave like Unix gVim visual mode.

While you’re in the _vimrc file, have a look up the top, you’ll see behave mswin.

The fix

Change this to behave xterm.

… Now if only I could change the crappy keybindings Microsoft assigned to be more like my KDE desktop… *sigh*