J
J
juffinhalli2015-05-15 14:02:55
vim
juffinhalli, 2015-05-15 14:02:55

How to adjust scaling in Gvim?

Good afternoon!
I am mastering gvim, but I lack the ability to quickly change the scale (font size) using Ctrl + scroll (as in geany).
Please tell me if this is possible in gvim

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xaizek, 2015-05-16
@juffinhalli

Most likely, there is no built-in one, but it is not difficult to make your own version. Below is a rather crude version, parsing the font specification from the option 'guifont'using a regular expression and increasing/decreasing the size specified there.
Paste the following snippet into .vimrca file, or create one plugin/mouse-font.vimspecifically for this:

" change font size on Ctrl + mouse wheel
if has('gui_running')
    function! s:ChangeFont(delta)
        let l:expr = '\=submatch(1)+' . a:delta
        let l:font = substitute(&guifont, '\v(\d+)', l:expr, '')
        let &guifont = l:font
    endfunction

    nnoremap <silent> <C-ScrollWheelUp> :call <SID>ChangeFont(+1)<cr>
    nnoremap <silent> <C-ScrollWheelDown> :call <SID>ChangeFont(-1)<cr>
endif

I don’t particularly comment on the code, it is quite small, the actions are simple, and the details can be viewed at :help <что-нибудь>.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question