Pages

Wednesday, April 25, 2018

guifont trouble? It's this easy...

Note to self: An easier way to pick fonts and get their values with VIm, from jsouthwo posting to VIM's GitHub forums:

I'm using Source Code Pro from Adobe on Windows 7 in GVIM 7.4, and prefer the ExtraLight version of the font.

If I do :set guifont=* and select Source Code Pro as the font and ExtraLight as the font style, everything looks fine. The output of :set guifont? is guifont=Source_Code_Pro_ExtraLight:h14:cANSI.

However, if I put guifont=Source_Code_Pro_ExtraLight:h14:cANSI in my vimrc or run it within GVIM, the font displayed is Source Code Pro Regular, not ExtraLight. The output of :set guifont? is still guifont=Source_Code_Pro_ExtraLight:h14:cANSI.

So hit :set guifont=* to get a selection screen like this...

vim font selector

... and then set guifont? to see what's selected.

set guifont? results

... and type that into your vimrc and profit.


Oh, in other news, to move lines up and down easily with alt-j and alt-k, add this to your vimrc:

nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==