在 gvim 中设置默认字体 [英] Settings default font in gvim

查看:86
本文介绍了在 gvim 中设置默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 gvim (vim -g).我想将默认字体设置为 Monaco.

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

这是我的 .vimrc 的内容

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

当我启动 gvim 时,字体不是 Monaco

When I start gvim the font is not Monaco

推荐答案

设置 'guifont' 的最简单方法就是根本不关心确切的字体字符串.

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?

并将 那个 字符串放入您的 vimrc 中.在我的机器上,这会在 12pt 处为摩纳哥返回 Monaco:h12.在块中的适当位置进行更改,或者,如果您不知道自己在做什么,只需将整个块替换为

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

这篇关于在 gvim 中设置默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆