sponsor Vim development Vim logo Vim Book Ad

quickfonts.vim : quickly switch between a list of favorite fonts, manage list of favorite fonts

 script karma  Rating 38/17, Downloaded by 5505  Comments, bugs, improvements  Vim wiki

created by
scott urban
 
script type
utility
 
description
UPDATES
- allow specification of base menu in which to put quickfonts menu (e.g. 'Plugin')
- bug fixes and handling of gtk2 style fonts


This plugin manages a list of favorite fonts, and allows you to swich quickly between those fonts.  This is useful if you normally like to use several fonts, for example, if your eyes get tired looking at a small font, or someone comes to look at code on your monitor, or your vision is blurry from a night of heavy drinking, you can quickly switch to a larger font, and the go back to a smaller font when the conditions allow it.

All functionality is available through an optional menu or through custom vim commands.

Fonts are read from a file specified with the global variable g:quickFontsFile or the default file $HOME/.vimquickfonts if that variable doesn't eists.  At vim start up, the file is read, if it doesn't exist your list will be empty. If the 'quickFontsAutoLoad' global variable is set (i.e. in your .vimrc), the script will load the last used font upon gvim start-up. On vim quit, your list of favorites is written to the file as well as the quickfont used last.

You can switch between the fonts with the mappings Alt-< and Alt->, which I find useful because they also work in some terminal programs (rxvt/xterm on some systems). You can change the mappings in the plugin if those don't suit you or disable them and add your own if you want (see help file).  The same functionality is available with the commands :QuickFontBigger and :QuickFontSmaller.

You can add a font to your favorites list with the command
:QuickFontAdd
which either takes no argument, in which case the value of 'guifont' will be added if available, or if an argument of '*' is given, the guifont selector is called, if you select a font from that (with no errors) that font will be added to the list.  A full font specification string can also be given as an argument. Duplicate fonts are eliminated, and new fonts are inserted sorted by pixel size in the list. UPDATE - sorting is done on font width * height rather than just width (for unix/Xwindows).  You  can disable this with:
"let quickFontsNoXwininfo = 1" in your vimrc.

You can remove a favorite font with the command
:QuickFontDel
which with no argument deletes the current selected font from the list, or if you give it a number, it will delete the font at that index in the list.

You can get info on your favorite font list and the currenlty selected font with the command
:QuickFontInfo

You can reload your font list from your config file (abandoning any changes to the list) with the command
:QuickFontReload

Finally, you can always edit the config file by hand, in which case, an autocommand will re-read your changes when you write the file.

Caveats: should work with non-X style fonts, except the font sorting.  There are stubs for sorting fonts for other systems - just not filled out - let me know if want to help with that.

 
install details
1 - un-gzip, untar in your ~/.vim direcory, or your vimfiles directory, or in $VIMRUNTIME
2 - (optional) build local help files (:help helptags)
3 - (optional) define plugin options in your vimrc - see ':help quickfonts'
 

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
quickfonts-1.29.tar.gz 1.29 2005-03-30 6.0 scott urban email updated
quickfonts.tar.gz 1.27 2004-02-03 6.0 scott urban fix for geometry bug when 'ignorecase' is set - thanks to Stephan  Hegel
quickfonts.tar.gz 1.26 2004-02-02 6.0 scott urban Shell and documentation fixes from Stephan Hegel
quickfonts.1.25.tar.gz 1.25 2003-11-08 6.0 scott urban - allow specification of base menu in which to put quickfonts menu (e.g. 'Plugin')
- fix for error when menus don't exist
- fix for new font style used by GTK
- fix for xwinfo name error - needed redraw!
- other minor fixes
quickfonts-1.21.tar.gz 1.21 2003-01-25 6.0 scott urban Menus added for most functionality - can be disabled - see help document.
quickfonts-1.20.tar.gz 1.20 2003-01-24 6.0 scott urban Made start-up smoother - window no longer does a size jump when using the auto-load-last-used font feature.
quickfonts-1.19.tar.gz 1.19 2003-01-23 6.0 scott urban Added feature to load last font used (from quickfont list) when gvim starts up.  Added flag to disable default mapping creation.  Code clean-up, doc updates, etc.
quickfonts-1.18.tar.gz 1.18 2002-05-28 6.0 scott urban :QuickFontAdd funtion can now take a font name - useful for a motif version I use (no GUI font selector)
quickfont-1.16.tar.gz 1.16 2002-04-19 6.0 scott urban Added QuickFontSet command that allows jumping to font by index number.  Use :QuickFontInfo and :QuickFontSet x in succession.
quickfonts.tar.gz 1.14 2002-02-07 6.0 scott urban Added documentation (run :helptags ~/.vim/doc); Fixed numeric sorting bug; Default config file for Windows changed to $HOME/_vimquickfonts; Fall through when xwininfo fails.
quickfonts.vim 1.13 2002-02-07 6.0 scott urban Fonts can be sorted on area (char width * height) instead of just on width - this gives a bit smoother transition as you go bigger and smaller. Uses xwininfo to do this (X systems only) - you can turn it off by letting the var quickFontsNoXwininfo in your vimrc.
Font sorting separated into different gui systems - only X is implemented now - if you want to help with windows or others, let me know.
QuickFontReload command added - re-reads your font list file - effectively abandoning changes.
Escaping of spaces in font names.
General improvements
quickfonts.vim 1.6 2002-02-04 6.0 scott urban Initial upload
ip used for rating: 54.234.136.147

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.
   
Vim at Github