Can I use a non-monospaced font in either Vim or gVim?


I found mlterm, which supports this. Aside from Emacs' built-in terminal (M-x term) this is the only terminal I've found that supports this (I've tried about 15-20 different ones).
I've found that mlterm works better than Emacs due to the sceen ratio settings, and you also avoid having to run Vim inside an Emacs session (I'm not even sure that is legally allowed).

Screenshot (it looks ugly unless you open it full size due to scaling in the browser):

enter image description here

It does require some configure love, though. After starting, press Ctrl + middle click anywhere, this will open the configure screen. I set these options

In the Font tab:

  • Check "Anti-alias"
  • Check "Variable column width"; this is the "key feature" missing from most other terminal emulators
  • Set font to "DejaVu Sans Book 16" (or whatever else you prefer)
  • Set "screen ratio against font size" width to 60; this lies to programs about the width of the terminal, of you don't do this, you're only using ~50% of the screen size. The best value for this depends on the font used, so experiment a bit...

The Right-click configure screen seems a bit flaky, I also edited my ~/.mlterm/vaafont since this wasn't updated:

ISO10646_UCS4_1 = 22,DejaVu Sans 18;21,DejaVu Sans 16;16,DejaVu Sans 16

And my ~/.mlterm/main (these are the settings I set above, plus some personal preferences):

type_engine = xft
bel_mode = none
scrollbar_mode = none
fontsize = 22
use_anti_alias = true
use_variable_column_width = true
line_space = 5
use_multi_column_char = true
col_size_of_width_a = 1
screen_width_ratio = 50

There are some artefacts, which are to be expected, but writing emails or posts such as this, it seems to work quite well!

I created an alias in my shell for this:

alias pvim mlterm -e vim

I also created a little function to remove most UI chrome:

fun! WriteMode() " Disable a lot of stuff setlocal nocursorline nocursorcolumn statusline= showtabline=0 laststatus=0 noruler " Hack a right margin with number setlocal number setlocal numberwidth=3 " White text, so it's 'invisible' highlight LineNr ctermfg=15 " If you're using a black background: " highlight LineNr ctermfg=1
endfun

There's also goyo.vim which goes roughly the same, but that didn't work very well for me (too much mucking about with margins). YMMV though.