1- *gui.txt* For Vim version 8.1. Last change: 2019 Jan 06
1+ *gui.txt* For Vim version 8.1. Last change: 2019 Apr 28
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -11,8 +11,9 @@ Vim's Graphical User Interface *gui* *GUI*
11113. Mouse Control | gui-mouse |
12124. Making GUI Selections | gui-selections |
13135. Menus | menus |
14- 6. Extras | gui-extras |
15- 7. Shell Commands | gui-shell |
14+ 6. Font | gui-font |
15+ 7. Extras | gui-extras |
16+ 8. Shell Commands | gui-shell |
1617
1718Other GUI documentation:
1819| gui_x11.txt | For specific items of the X11 GUI.
@@ -1039,7 +1040,153 @@ make a selection.
10391040Note that a menu that starts with ']' will not be displayed.
10401041
10411042==============================================================================
1042- 6. Extras *gui-extras*
1043+ 6. Font
1044+
1045+ This section describes font related options.
1046+
1047+ GUIFONT *gui-font*
1048+
1049+ 'guifont' is the option that tells Vim what font to use. In its simplest form
1050+ the value is just one font name. It can also be a list of font names
1051+ separated with commas. The first valid font is used. When no valid font can
1052+ be found you will get an error message.
1053+
1054+ On systems where 'guifontset' is supported (X11) and 'guifontset' is not
1055+ empty, then 'guifont' is not used. See | xfontset | .
1056+
1057+ Note: As to the GTK GUIs, no error is given against any invalid names, and the
1058+ first element of the list is always picked up and made use of. This is
1059+ because, instead of identifying a given name with a font, the GTK GUIs use it
1060+ to construct a pattern and try to look up a font which best matches the
1061+ pattern among available fonts, and this way, the matching never fails. An
1062+ invalid name doesn't matter because a number of font properties other than
1063+ name will do to get the matching done.
1064+
1065+ Spaces after a comma are ignored. To include a comma in a font name precede
1066+ it with a backslash. Setting an option requires an extra backslash before a
1067+ space and a backslash. See also | option-backslash | . For example: >
1068+ :set guifont=Screen15,\ 7x13,font\\,with\\,commas
1069+ will make Vim try to use the font "Screen15" first, and if it fails it will
1070+ try to use "7x13" and then "font,with,commas" instead.
1071+
1072+ If none of the fonts can be loaded, Vim will keep the current setting. If an
1073+ empty font list is given, Vim will try using other resource settings (for X,
1074+ it will use the Vim.font resource), and finally it will try some builtin
1075+ default which should always be there ("7x13" in the case of X). The font
1076+ names given should be "normal" fonts. Vim will try to find the related bold
1077+ and italic fonts.
1078+
1079+ For Win32, GTK, Motif, Mac OS and Photon: >
1080+ :set guifont=*
1081+ will bring up a font requester, where you can pick the font you want.
1082+
1083+ In MacVim ":set guifont=*" calls: >
1084+ :macaction orderFrontFontPanel:
1085+ which is the same as choosing "Show Fonts..." from the main menu.
1086+
1087+ The font name depends on the GUI used. See | setting-guifont | for a way to set
1088+ 'guifont' for various systems.
1089+
1090+ For the GTK+ 2 and 3 GUIs, the font name looks like this: >
1091+ :set guifont=Andale\ Mono\ 11
1092+ That's all. XLFDs are not used. For Chinese this is reported to work well: >
1093+ if has("gui_gtk2")
1094+ set guifont=Bitstream\ Vera\ Sans\ Mono\ 12,Fixed\ 12
1095+ set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12
1096+ endif
1097+ <
1098+ (Replace gui_gtk2 with gui_gtk3 for the GTK+ 3 GUI)
1099+
1100+ For Mac OSX you can use something like this: >
1101+ :set guifont=Monaco:h10
1102+ Also see 'macatsui' , it can help fix display problems {not in MacVim}.
1103+ In MacVim, fonts with spaces are set like this: >
1104+ :set guifont=DejaVu\ Sans\ Mono:h13
1105+ <
1106+ *E236*
1107+ Note that the fonts must be mono-spaced (all characters have the same width).
1108+ An exception is MacVim and GTK: all fonts are accepted, but mono-spaced fonts
1109+ look best.
1110+
1111+ To preview a font on X11, you might be able to use the "xfontsel" program.
1112+ The "xlsfonts" program gives a list of all available fonts.
1113+
1114+ For the Win32 GUI *E244* *E245*
1115+ - Takes these options in the font name (use a ':' to separate the options):
1116+ hXX - height is XX (points, can be floating-point)
1117+ wXX - width is XX (points, can be floating-point)
1118+ WXX - weight is XX (see Note on Weights below)
1119+ b - bold. This is equivalent to setting the weight to 700.
1120+ i - italic
1121+ u - underline
1122+ s - strikeout
1123+ cXX - character set XX. Valid charsets are: ANSI, ARABIC, BALTIC,
1124+ CHINESEBIG5, DEFAULT, EASTEUROPE, GB2312, GREEK, HANGEUL,
1125+ HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS, SYMBOL, THAI,
1126+ TURKISH, VIETNAMESE ANSI and BALTIC. Normally you would use
1127+ "cDEFAULT".
1128+ qXX - quality XX. Valid quality names are: PROOF, DRAFT, ANTIALIASED,
1129+ NONANTIALIASED, CLEARTYPE, DEFAULT. Normally you would use
1130+ "qDEFAULT".
1131+ Some quality values are not supported in legacy OSs.
1132+ - A '_' can be used in the place of a space, so you don't need to use
1133+ backslashes to escape the spaces.
1134+ Examples: >
1135+ :set guifont=courier_new:h12:w5:b:cRUSSIAN
1136+ :set guifont=Andale_Mono:h7.5:w4.5
1137+
1138+ See also | font-sizes | .
1139+
1140+ Note on Weights: Fonts often come with a variety of weights. "Normal" weights
1141+ in Windows have a value of 400 and, left unspecified, this is the value that
1142+ will be used when attempting to find fonts. Windows will often match fonts
1143+ based on their weight with higher priority than the font name which means a
1144+ Book or Medium variant of a font might be used despite specifying a Light or
1145+ ExtraLight variant. If you are experiencing heavier weight substitution, then
1146+ explicitly setting a lower weight value may mitigate against this unwanted
1147+ substitution.
1148+
1149+
1150+ GUIFONTWIDE *gui-fontwide*
1151+
1152+ When not empty, 'guifontwide' specifies a comma-separated list of fonts to be
1153+ used for double-width characters. The first font that can be loaded is
1154+ used.
1155+
1156+ Note: The size of these fonts must be exactly twice as wide as the one
1157+ specified with 'guifont' and the same height. If there is a mismatch then
1158+ the text will not be drawn correctly.
1159+
1160+ All GUI versions but MacVim and GTK+:
1161+
1162+ 'guifontwide' is only used when 'encoding' is set to "utf-8" and
1163+ 'guifontset' is empty or invalid.
1164+ When 'guifont' is set and a valid font is found in it and
1165+ 'guifontwide' is empty Vim will attempt to find a matching
1166+ double-width font and set 'guifontwide' to it.
1167+
1168+ MacVim only: *guifontwide_macvim*
1169+
1170+ MacVim performs automatic font substitution. If 'guifontwide' is set, that
1171+ font will be used for all wide fonts. However, if a glyph is not available in
1172+ the wide font, then font substitution is still used.
1173+
1174+ GTK+ GUI only: *guifontwide_gtk*
1175+
1176+ If set and valid, 'guifontwide' is always used for double width
1177+ characters, even if 'encoding' is not set to "utf-8".
1178+ Vim does not attempt to find an appropriate value for 'guifontwide'
1179+ automatically. If 'guifontwide' is empty Pango/Xft will choose the
1180+ font for characters not available in 'guifont' . Thus you do not need
1181+ to set 'guifontwide' at all unless you want to override the choice
1182+ made by Pango/Xft.
1183+
1184+ Windows +multibyte only: *guifontwide_win_mbyte*
1185+
1186+ If set and valid, 'guifontwide' is used for IME instead of 'guifont' .
1187+
1188+ ==============================================================================
1189+ 7. Extras *gui-extras*
10431190
10441191This section describes other features which are related to the GUI.
10451192
@@ -1085,7 +1232,7 @@ A recommended Japanese font is MS Mincho. You can find info here:
10851232http://www.lexikan.com/mincho.htm
10861233
10871234==============================================================================
1088- 7 . Shell Commands *gui-shell*
1235+ 8 . Shell Commands *gui-shell*
10891236
10901237For the X11 GUI the external commands are executed inside the gvim window.
10911238See | gui-pty | .
0 commit comments