Dynamically Change Font Size in Gvim?

Dynamically Change Font Size in Gvim?

I'd like to be able to dynamically change the font size in gvim.

Essentially, the common zoom-in/zoom-out functionality you find in a lot of software.

So if I press Ctrl+=, the font size gets bigger. If I press Ctrl+-, the font size decreases. And, ideally, if I press Ctrl-0 the font size returns to my default size.

Is it possible?

2 Answers

Sure it is, via zoom.vim

(it is mapped to + and - by default, but I gather you know how to change that to your liking).

2

This works on my AntiX 4.9 using keyboard (not numpad) keys. It is the zoom feature of Vim 8.1 and it provides me more view of text in vertical split screen mode.

[Ctrl][-] decrease font size
[Ctrl][Shift][+] increase font size
[Ctrl][0] restore font size

Some additional info, because I am using a Debianized, small version of vim.
You can compare to your version: vi --version | less
Maybe try building your own version with what you need and drop it in /usr/local/bin, which will override the default version in the /usr/bin location.

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15)
Included patches: 1-875, 878, 884, 948, 1046, 1365-1368, 1382, 1401
Modified by 
Compiled by 
Small version without GUI.  Features included (+) or not (-):
+acl               -extra_search      -mouse_sgr         -tcl
-arabic            -farsi             -mouse_sysmouse    -termguicolors
+autocmd           -file_in_path      -mouse_urxvt       -terminal
-autochdir         -find_in_path      -mouse_xterm       +terminfo
-autoservername    -float             +multi_byte        -termresponse
-balloon_eval      -folding           -multi_lang        -textobjects
-balloon_eval_term -footer            -mzscheme          -textprop
-browse            +fork()            -netbeans_intg     -timers
+builtin_terms     -gettext           -num64             -title
-byte_offset       -hangul_input      -packages          -toolbar
-channel           +iconv             -path_extra        -user_commands
-cindent           -insert_expand     -perl              -vartabs
-clientserver      -job               -persistent_undo   +vertsplit
-clipboard         +jumplist          -printer           +virtualedit
-cmdline_compl     -keymap            -profile           +visual
+cmdline_hist      -lambda            -python            +visualextra
-cmdline_info      -langmap           -python3           -viminfo
-comments          -libcall           -quickfix          +vreplace
-conceal           -linebreak         -reltime           +wildignore
-cryptv            -lispindent        -rightleft         -wildmenu
-cscope            +listcmds          -ruby              +windows
+cursorbind        -localmap          +scrollbind        +writebackup
-cursorshape       -lua               -signs             -X11
-dialog            -menu              -smartindent       +xfontset
-diff              -mksession         -startuptime       -xim
-digraphs          -modify_fname      -statusline        -xpm
-dnd               -mouse             -sun_workshop      -xsmp
-ebcdic            -mouse_dec         -syntax            -xterm_clipboard
-emacs_tags        -mouse_gpm         +tag_binary        -xterm_save
-eval              -mouse_jsbterm     -tag_old_static    
+ex_extra          -mouse_netterm     -tag_any_white     

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.