Hot answers tagged

30

Set the guifont option in your .gvimrc. See :help guifont and :help setting-guifont. Specifically, you can do something like: set guifont=Consolas:h11 to use 11-point Consolas in gvim on Windows. There are a few other options you can use (each separated with a :), such as :b for bold, although some of these are only available on certain platforms. The :h ...


28

If you want to simply change the font size in a running GVim instance, type: :set guifont=* A window should pop up letting you set font size as well as pick a new font if desired. You can then ask Vim to print the line you would need to add to your ~/.gvimrc to make the change permanent: :set guifont? Produces something like the following in the status ...


25

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 ...


13

I have the following in my .vimrc to change font size quickly without changing the font. Works on Windows and GTK. I haven't tested other GUIs. I'm sure I originally copied it from somebody else, but it's been in my rc file so long I don't remember where it came from. if has("unix") function! FontSizePlus () let l:gf_size_whole = matchstr(&...


12

The basic idea could be something like: " Define a list of the fonts you want to use, and the index in the " list of the default font. See :help Lists let g:fc_list = [ \ "DejaVu Sans Mono 9", \ "Source Code Pro 12", \ "GohuFont 11" \ ] let g:fc_current = 0 " Set default font let &guifont = g:fc_list[g:fc_current] function! FontCycle() " ...


11

If you are using vim in a terminal you can simply use its zoom shortcuts. For Gnome-Terminal this is Ctrl++. In others it may be Ctrl+Shift++. Also there are several plugins out there for this purpose. e.x: https://github.com/drmikehenry/vim-fontsize As an alternative you can define your own functions like this one from vim.wika.com let s:pattern = '^\(.* ...


10

PuTTY, like other high-color terminals, only supports a fixed color palette of 256 colors. GVIM can use the full 24-bit RGB color space; that's why you see "finer" nuances there. As for attributes, GVIM offers undercurl, which is not present in any terminal, and free mixture of bold (depending on configuration shown with lighter color instead) and italic (...


9

First off, Vim can only display a file in a single font, you can't use multiple fonts at the same time. For gVim, you can use guifont to set this to Font Awesome: set guifont=Font\ Awesome\ 14 Which seems to work fine. For Terminal Vim, you will need to configure your terminal emulator to use Font Awesome. For xterm, this doesn't seem to work, for gnome-...


8

The problem is probably that you don't have the Consolas font installed and that Vim defaults to an ugly default font. Try using a different font, for example this should work on most Linux systems: set guifont=Dejavu\ Sans\ Mono\ 12 If you want it to work on both Windows and Linux you can use something like: if has('gui_gtk') set guifont=Dejavu\ ...


7

It's definitely not supported in GUI Vim, and I'd be surprised if there were more than handful of terminal emulators that support proportional fonts in the way that you're hoping for: it would break too many of the standard things for which terminals are used. As so many parts of Unix and other command-line environments presume monospaced fonts, this type of ...


7

I have the following defined in my .vimrc file. set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10 So you can set that up as a mapping like this... nmap <Leader>f :set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10<CR> Add additional mappings for other fonts.


6

Instead of printing from Vim, you could instead generate an HTML file using :TOhtml. Then you can use CSS to set the font used for the HTML and print that.


6

I think something along the following lines should work: amenu ToolBar.Builtin#31 :let &guifont=substitute(&guifont, '\(\d\+\)', '\=submatch(1)+1', '')<cr> amenu ToolBar.Builtin#32 :let &guifont=substitute(&guifont, '\(\d\+\)', '\=submatch(1)-1', '')<cr> Now, to include nice icons, you simply need to add the icon argument.


6

If you have a recent Vim, you may try to enable DirectX rendering. It should improve "wide" font rendering, among other things. Here's an example vimrc snip: if has("gui_running") set guioptions=icpM if has('win32') || has('win64') if (v:version == 704 && has("patch393")) || v:version > 704 set renderoptions=type:...


5

Apparently, the way to write the font settings are quite platform-dependent. What worked for me (gvim in MX Linux 17, (a Debian-based Linux distribution with an XFCE desktop)): Determine the current font settings in an open gvim instance using : set guifont? Example: guifont=DejaVu Sans Mono 12 Use this information to write the settings (modifying the ...


4

Based on Drew's answer this setup worked better for me. It increases or decreases font-size using \+ or \- (assuming \ is your leader), and cycles through the predefined fonts using cot. I often swap between these fonts depending on whether I am working with source code or text. let g:fnt_types = ['SourceCode\ Pro', 'monofur' ] let g:fnt_sizes = [ 10, 13 ] ...


3

The answer was posted in the comments by @DJ McMayhem. :set enc? latin-1 So by changing it to utf-8 the text becomes readable. :set enc=utf-8


3

Reading the 'guifont' option is useful here. I do understand your frustrations with this option however. It seems that how you set the 'guifont' setting, is dependent on the OS. On macOS, you set 'guifont' the following way (which is noted in :help 'guifont'): set guifont=Monaco:h14 On other OSes (Linux, etc) you use the backslash instead to specify the ...


3

Proportional fonts are supported in Oni, Neovim GUI. Use the "webgl" renderer for best results. "editor.renderer": "webgl" See also https://github.com/onivim/oni/issues/2359


3

So it looks like if no guifont is specified in your vimrc, gVim will use some built in default font and it would not be reflected in guifont -- set guifont is empty. But it turns out it is possible to change the size of your default font -- use guifont without name, just size: set guifont=:h10 set guifont=:h16 ... whatever your default bitmap font supports


2

Apparat's answer works for gVim; if you're using Vim from within a Terminal, you will need to configure the terminal to change the font size. For Xterm, I like to use: XTerm*VT100.translations: #override \n\ Ctrl <KeyPress> =:larger-vt-font() \n\ Ctrl <KeyPress> -:smaller-vt-font() In my ~/.Xdefaults to change the font size with CTRL + ...


2

You can only change the font face and the font size in GVim/MacVim. If you use Vim in a terminal emulator you will have to do that in your terminal emulator.


2

You can try this plugin:vim-fontzoom. map <m-o> :Fontzoom!<cr> map <m--> <Plug>(fontzoom-smaller) map <m-=> <Plug>(fontzoom-larger)


2

Looks like there is no easy way to change font/encoding for menu rendering. Maybe it's somewhere in the code files, and you need to change and compile it in order to be able to decode menu in another encoding. I have the same issue (in Russian localization), I think it appears after adding in vimrc this: set termencoding=utf-8 set encoding=utf-8 set ...


2

My TextTransform plugin will handle the setup of a mapping; this will support normal mode command for lines and {motion}, as well as visual mode. Here's an example that only works with A; you need to expand the tr() accordingly. function! BoldToggle( text ) return tr(a:text, "A\U0001D400", "\U0001D400A") endfunction call TextTransform#MakeMappings('', '&...


2

Sorry, it's because I set :set ambiwidth=double. It makes some characters twice as wide as usual. I set :set ambiwidth=single, and all is fine. This line, I must have copied from some stranger's vimrc and did not examine closely. It's my fault, not Vim's fault. I have no idea what ambiwidth is for. Maybe there is some font that need it to display right (see ...


2

See: :help guifont: [...] The font name depends on the GUI used. [...] For the Win32 GUI takes these options in the font name:> hXX - height is XX (points, can be floating-point) wXX - width is XX (points, can be floating-point) b - bold i - italic u - underline s - strikeout cXX - character set XX. ...


2

There are several ways to install the elements such as the solid right arrows in your screenshot. Two are described here: Powerline fonts installation. One approach involves installing symbol fonts but these tend to have alignment problems such as you've seen. Similarly, pasting in Unicode characters into your configuration doesn't always work well. The ...


2

I don't have a Linux machine with graphical interface here to test it, but I'd say the correct syntax for that line would be something like: set guifont=Ubuntu\ Mono\ 15


1

As it turns out the fonts that :set guifont=* show are not installed. No idea why gvim decides to show them. Might be a bug. Also the suggestion here doesn't work. I believe that the font suggested is also not installed. So a friend found: :set guifont=Courier\ 10\ Pitch\ 13 Which works.


Only top voted, non community-wiki answers of a minimum length are eligible