sponsor Vim development Vim logo Vim Book Ad

scalefont : Switch between your favourite font/gui settings

 script karma  Rating 7/3, Downloaded by 2394  Comments, bugs, improvements  Vim wiki

created by
Tom Link
script type
Sometimes you want to change the font size without changing the window
geometry. This plugin tries to set the 'guifont', 'columns', and 'lines' to
appropriate values in order to achieve this goal. You can define modes to
quickly switch between your favourite gui configuration: fonts, window
position and size, guioption settings etc.
install details
It is important to correctly configure the plugin because it will set
the font and the window size when being loaded unless the
g:scaleFontDontSetOnStartup variable was defined.

Edit the vba file and type: >

    :so %

<   See :help vimball for details. If you have difficulties or use vim 7.0,
    please make sure, you have the current version of vimball
    (vimscript #1502) installed.

Edit |vimrc|:

    Set g:scaleFontSize, g:scaleFontWidth, and g:scaleFont according to your
    likings. "#{SIZE}" and "#{WIDTH}" will be replaced with the appropriate
    values. On non-Windows systems you also have to define

    Examples: >

        let g:scaleFontSize  = 11
        let g:scaleFontWidth = 8
<   Unix: >

        let g:scaleFont = "-misc-fixed-medium-r-semicondensed-*-#{SIZE}-120-*-*-c-*-iso8859-15"

<   Windows: >

        let g:scaleFont = "Lucida_Console:h#{SIZE}:cANSI""

Check if ScaleFontMaximizeWindow() function is functional on your
system. If not, redefine the function in |vimrc|.

Restart vim.

Also available via git

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
scalefont.vba.gz 1.4 2009-02-21 7.0 Tom Link BufExec & WinExec options
scalefont.vba.gz 1.3 2008-03-07 7.0 Tom Link - Partial rewrite for vim7.0
- Default configuration is now done with a dictionary.
- On mode changes, always evaluate g:scaleFontExec__0 unless g:scaleFontAlwaysResetGuioptions is 0.
- FIX: Error when switching back to Normal.
- g:scaleFontMenuPrefix was replaced with g:scaleFontMenu
- Load only in gui
- s:ScaleFontSetSize(mode, ...): Arguments have changed
scalefont.zip 1.1 2005-04-05 6.0 Tom Link New variable g:scaleFontExec_{MODE}, the content of which will be executed before reconfiguring the window geometry. This can be used to set guioptions as needed (e.g., for a full screen mode without menu bar and all as for NormalFull). If this variable isn't set, the variable g:scaleFontExec_0 will be executed that resets the guioptions to its initial value.  ScaleFontMaximizeWindow() is defined for OS other than Windows too (kind of). Build modes menu (see g:scaleFontMenuPrefix).
scalefont.zip 1.0 2004-12-20 6.0 Tom Link We can now set the window/frame position too (e.g.  NormalNarrowLeft and NormalWideTop); new standard modes: NormalMax, NormalNarrowLeft, NormalWideTop, bigMax; :ScaleFont as an alias to :ScaleFontMode; removed mode "0" from the mode list
scalefont.zip 0.2 2004-10-17 6.0 Tom Link Take care of whether the font size is increased or decreased; command line completion for ScaleFontMode; ability to define the desired lines and cols parameters per mode (if one of these variables is -1, the window will be maximized; on non-Windows systems you have to define ScaleFontMaximizeWindow() first); new standard modes "largeMax" and "LargeMax" (maximize the window)
scalefont.vim 0.1 2004-07-15 6.0 Tom Link Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.