Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Settings default font in gvim

Tags:

vim

x11

I'm using gvim (vim -g). I want to set default font to be Monaco.

Here is the content of my .vimrc

if has("gui_running")
    if has("gui_gtk2")
         set guifont=Monaco\ New\ 11
       elseif has("gui_photon")
         set guifont=Monaco\ New:s11
       elseif has("gui_kde")
         set guifont=Monaco\ New/11/-1/5/50/0/0/0/1/0
       elseif has("x11")
         "set guifont=-*-courier-medium-r-normal-*-*-180-*-*-m-*-*
         set guifont=Monaco:h11:cDEFAULT

       else
         set guifont=Monaco:h11:cDEFAULT
     endif
  endif

When I start gvim the font is not Monaco

like image 410
dofores Avatar asked Jun 02 '13 12:06

dofores


People also ask

What font does Gvim use?

Lucida appears in both gvim and X11 lists of fonts above.

How do I save settings in Gvim?

You can use :set command to list all settings and put it to ${HOME}/.


2 Answers

The easiest way of setting the 'guifont' is simply not bothering with the exact font string at all.

Use a friendly dialog to set it instead:

:set guifont=*

This pops up a dialog where you can select your preferred font.

Once you have set it, you can query the setting again with

:set guifont?

and put that string in your vimrc. On my machine this returns Monaco:h12 for Monaco at 12pt. Make the change at the appropriate place in your block, or, if you have no idea what you're doing, simply replace the whole block with

if has("gui_running")
  set guifont=Monaco:h12
endif
like image 173
glts Avatar answered Oct 17 '22 16:10

glts


set guifont=Font\ Name\ Size

Replace the spaces by '\ '

like image 24
Adel Kihal Avatar answered Oct 17 '22 17:10

Adel Kihal