0

I need your help! I am trying to set up a specific font and font size in my ~/.vimrc file using set guifont=Monospace:h15, but nothing is changing no matter if I put 12 or 20 in the size column. I've tried several fonts also, but it seems like changes just not apply - after writing the file and reopening it, size of the font and the font itself stays the same. Also :set guifont=* command doesn't show me anything. Here is my .vimrc file:

set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'nyngwang/nvimgelion' syntax on set termguicolors set guifont=Monospace:h20 call vundle#end() filetype plugin indent on au BufNewFile, BufRead *.py \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set expandtab \ set autoindent \ set fileformat=unix set laststatus=2 set wrap set encoding=utf-8 vnoremap <C-c> :w !xclip -i -sel c<CR><CR> 

How to set up a specific font in my Vim configuration file? Thank you for your help.

1 Answer 1

0

Try:

set guifont=monospace\ 20 

AFAIK, that monospace:h20 font specification format only works in vim on windows and mac, not on linux.


BTW, you are trying this in gvim, not vim, right?

vim (without the g prefix) will use whatever font the terminal is configured to use. The guifont setting does nothing.

gvim, being a GUI application, allows you to choose the font.

Finally, you should wrap your GUI settings in a conditional, to prevent them from being executed when running plain vim in a terminal. e.g. here's what I have in my ~/.vimrc:

if has("gui_running") colorscheme torte set guifont=Monospace\ 18 set lines=49 columns=96 " https://vim.fandom.com/wiki/Configuring_the_cursor " Disable all blinking: set guicursor+=a:blinkon0 endif 
2
  • one more thing: stackexchange has a site for asking vi/vim specific questions: vi.stackexchange.com Commented Jun 10 at 6:08
  • Hi cas, thank you for your answer. I use plain Vim and now understand why guifont is not working. I changed the font in my terminal config and it applied to the Vim as well. Also thanks for sharing a part of your .vimrc file. Commented Jun 10 at 8:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.