Hot answers tagged

38

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


27

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

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 = '^\(.* ...


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


11

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() " ...


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


9

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

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.


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

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

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


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


4

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


4

To specify the font size you need to prefix the size with an "h", so the correct command would be :set guifont=Courier:h14.


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

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


3

If there really isn't a simple query to find the information then we'll have to brute-force it... Two key behaviors are described in :h 'guifonts': [If a list of fonts is given] the first valid font is used. and [If a single font is given and] the font cannot be found you will get an error message. That suggests something like this function: func! ...


3

Since font is specific to the GUI versions of vim (i.e. gvim and macvim), you need to should put the set guifont=... line in your gvimrc. A good place for that is ~/.vim/gvimrc, but you can read help gvimrc for locations. According to setting-guifont: *setting-guifont* When you use the same vimrc ...


3

To change the font used by terminal Vim or Neovim, you need to change the font the your terminal emulator uses. The exact settings vary between different terminal emulators. For example, if you are connecting to your Linux server on Windows via mintty terminal, you can go to Options --> Text to change the font. For other terminal emulators, you can ...


3

First: I have no experience with i3wm. So my observation from "normal" windows manager. Vim is working with monospaced fonts. So every character is displayed in a box with a certain width and height in pixels. If you change the size of the font, the size of this box changes. If the GVim window is not fullscreen, the size of the window will change ...


3

One way to get this feature is by using coc and coc-emoji. Coc is a plugin which allows you to get the same Language Server Protocol (autocompletion, linting, go to definition, etc...) as VSCode because it uses the same extensions as VSCode. This is a pretty powerful tool but installing it just to get emoji support might be a bit overkill. However if you do ...


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

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


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