Home > Article > System Tutorial > I'm running gVim7.3.1 on a GNU/machine
I'm running gVim7.3 on a GNU/machine. I would like to know if there is a way to manually change the font according to the size of the window. I am relatively new to VimLinux system modification command line font size, so I am new to Vim It's not familiar.
My situation is this: I use DejaVuSansMono12 as my default font, but sometimes I want to switch to Terminus9linux system to modify the command line font size, when I want to shrink the Vim window to see on the screen of content as I type. (You know, for those of us with small laptop screens who don’t want to switch between workspaces…!)
So I want to know if I shrink the commands in the .vimrc file, if I shrink the default window size to small enough that Vim will manually adjust the font, will these behaviors happen manually.
Any comments?
When Vim's window size changes, Vim will trigger a VimResized storm. You can compile an autocmd that adapts to the font ('guifont'). This is an autocmd that only considers "columns" (not "rows" ”) and have a hardcoded font name:
function! FontChangeOnResize() if &columns > 80 set guifont=Lucida_Console:h14 elseif &columns > 60 set guifont=Lucida_Console:h12 elseif &columns > 40 set guifont=Lucida_Console:h10 elseif &columns > 20 set guifont=Lucida_Console:h8 else set guifont=Lucida_Console:h6 endif endfunction autocmd VimResized * call FontChangeOnResize()
The above is the detailed content of I'm running gVim7.3.1 on a GNU/machine. For more information, please follow other related articles on the PHP Chinese website!