Add /src/vim/release.sh, a script to compile and install vim
[msysgit.git] / share / vim / vim58 / doc / gui_x11.txt
blob317aac888320d762a49101225bb3b5590cf1dc9f
1 *gui_x11.txt*   For Vim version 5.8.  Last change: 2000 Jan 01
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Vim's Graphical User Interface                          *gui-x11* *GUI-X11*
8                                                         *Athena* *Motif*
9 1. Starting the X11 GUI         |gui-x11-start|
10 2. GUI Resources                |gui-resources|
11 3. Shell Commands               |gui-pty|
12 4. Various                      |gui-x11-various|
13 5. GTK version                  |gui-gtk|
14 6. Compiling                    |gui-x11-compiling|
16 Other relevant documentation:
17 |gui.txt|       For generic items of the GUI.
19 {Vi does not have any of these commands}
21 ==============================================================================
22 1. Starting the X11 GUI                                 *gui-x11-start*
24 Then you can run the GUI version of Vim in either of these ways:
25     gvim [options] [files...]
26     vim -g [options] [files...]
28 So if you call the executable "gvim", or make "gvim" a link to the executable,
29 then the GUI version will automatically be used.  Additional characters may be
30 added after "gvim", for example "gvim-5".
32 You may also start up the GUI from within the terminal version by using one of
33 these commands:
34         :gui [+cmd] [-f|-b] [files...]                  *:gu* *:gui*
35         :gvim [+cmd] [-f|-b] [files...]                 *:gv* *:gvim*
36 The "-f" option runs Vim in the foreground.
37 The "-b" option runs Vim in the background (this is the default).
39                                                         *gui-fork*
40 When the GUI is started, it does a fork() and exits the current process.
41 When gvim was started from a shell this makes the shell accept further
42 commands.  If you don't want this (e.g. when using gvim for a mail program
43 that waits for gvim to exit), start gvim with "gvim -f", "vim -gf" or use
44 ":gui -f".  Don't use "vim -fg", because "-fg" specifies the foreground
45 color.
47 When using "gvim -f" and then ":gui", Vim will run in the foreground.  The
48 "-f" argument will be remembered.  To force running Vim in the background use
49 ":gui -b".
51 If you want the GUI to run in the foreground always, include the 'f'
52 flag in 'guioptions'.  |-f|.
54 ==============================================================================
55 2. GUI Resources                        *gui-resources* *.Xdefaults*
57 If using the Motif or Athena version of the GUI (not for the GTK+ or Win32
58 version), a number of X resources are available.  You should use Vim's class
59 "Vim" when setting these.  They are as follows:
61     Resource name       Meaning         ~
63     reverseVideo        Boolean: should reverse video be used?
64     background          Color of background.
65     foreground          Color of normal text.
66     scrollBackground    Color of trough portion of scrollbars.
67     scrollForeground    Color of slider and arrow portions of scrollbars.
68     menuBackground      Color of menu backgrounds.
69     menuForeground      Color of menu foregrounds.
70     font                Name of font used for normal text.
71     boldFont            Name of font used for bold text.
72     italicFont          Name of font used for italic text.
73     boldItalicFont      Name of font used for bold, italic text.
74     geometry            Initial geometry to use for gvim's window (default
75                         is same size as terminal that started it).
76     scrollbarWidth      Thickness of scrollbars.
77     menuHeight          Height of the menu bar.
78     borderWidth         Thickness of border around text area.
80 A special font for italic, bold, and italic-bold text will only be used if
81 the user has specified one via a resource.  No attempt is made to guess what
82 fonts should be used for these based on the normal text font at the moment.
84 Note that the colors can also be set with the ":highlight" command, using the
85 "Normal", "Menu" and "Scrollbar" groups.
87                                                         *font-sizes*
88 Note: All fonts must be of the same size!!!  If you don't do this, text will
89 disappear or mess up the display.  Vim does not check the font sizes.  It's
90 the size in screen pixels that must be the same.  Note that some fonts that
91 have the same point size don't have the same pixel size!  Additionally, the
92 positioning of the fonts must be the same (ascent and descent).  You can check
93 this with "xlsfonts -l {fontname}".
95 If any of these things are also set with Vim commands, eg with
96 ":set guifont=Screen15", then this will override the X resources (currently
97 'guifont' is the only option that is supported).
99 Here is an example of what you might put in your ~/.Xdefaults file:
101 >       Vim*useSchemes:                 all
102 >       Vim*sgiMode:                    true
103 >       Vim*useEnhancedFSB:             true
104 >       Vim.foreground:                 Black
105 >       Vim.background:                 Wheat
106 >       Vim*fontList:                   7x13
108 The first three of these are standard resources on Silicon Graphics machines
109 which make Motif applications look even better, highly recommended!
111 The "Vim*fontList" is to set the menu font for Motif.  Example:
112 >       Vim*menuBar*fontList:        -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
113 With Athena:
114 >       Vim*menuBar*SmeBSB*font:     -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
115 >       Vim*menuBar*MenuButton*font: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
117 Don't use "Vim*geometry" in the defaults.  This will break the menus.  Use
118 "Vim.geometry" instead.
120 If you get an error message "Cannot allocate colormap entry for "gray60",
121 try adding this to your Vim resources (change the colors to your liking):
123 >       Vim*scrollBackground:           Black
124 >       Vim*scrollForeground:           Blue
126 The resources can also be set with arguments to vim:
128     argument            meaning ~
129                                                         *-gui*
130    -display {display}   Run vim on {display}            *-display*
131    -iconic              Start vim iconified             *-iconic*
132    -background {color}  Use {color} for the background  *-background*
133    -bg {color}          idem                            *-bg*
134    -foreground {color}  Use {color} for normal text     *-foreground*
135    -fg {color}          idem                            *-fg*
136    -ul {color}          idem                            *-ul*
137    -font {font}         Use {font} for normal text      *-font*
138    -fn {font}           idem                            *-fn*
139    -boldfont {font}     Use {font} for bold text        *-boldfont*
140    -italicfont {font}   Use {font} for italic text      *-italicfont*
141    -geometry {geom}     Use {geom} for initial geometry *-geometry*
142    -geom {geom}         idem                            *-geom*
143    -borderwidth {width} Use a border width of {width}   *-borderwidth*
144    -bw {width}          idem                            *-bw*
145                                                         *-scrollbarwidth*
146    -scrollbarwidth {width}      Use a scrollbar width of {width}
147    -sw {width}          idem                            *-sw*
148    -menuheight {height} Use a menu bar height of {height} *-menuheight*
149    -mh {height}         idem                            *-mh*
150    -reverse             Use reverse video               *-reverse*
151    -rv                  idem                            *-rv*
152    +reverse             Don't use reverse video         *-+reverse*
153    +rv                  idem                            *-+rv*
154    -xrm {resource}      Set the specified resource      *-xrm*
156 Note about reverse video: Vim checks that the result is actually a light text
157 on a dark background.  The reason is that some X11 versions swap the colors,
158 and some don't.  These two examples will both give yellow text on a blue
159 background:
160     gvim -fg Yellow -bg Blue -reverse
161     gvim -bg Yellow -fg Blue -reverse
163 ==============================================================================
164 3. Shell Commands                                       *gui-pty*
166 WARNING: Executing an external command from the GUI will not always work.
167 "normal" commands like "ls", "grep" and "make" mostly work fine.  Commands
168 that require an intelligent terminal like "less" and "ispell" won't work.
169 Some may even hang and need to be killed from another terminal.  So be
170 careful!
172 There are two ways to do the I/O with a shell command: Pipes and a pseudo-tty.
173 The default is to use a pseudo-tty.  This should work best on most systems.
175 Unfortunately, the implementation of the pseudo-tty is different on every Unix
176 system.  And some systems require root permission.  To avoid running into
177 problems with a pseudo-tty when you least expect it, test it when not editing
178 a file.  Be prepared to "kill" the started command or Vim.  Commands like
179 ":r !cat" may hang!
181 If using a pseudo-tty does not work for you, reset the 'guipty' option:
183 >       :set noguipty
185 Using a pipe should work on any Unix system, but there are disadvantages:
186 - Some shell commands will notice that a pipe is being used and behave
187   differently.  E.g., ":!ls" will list the files in one column.
188 - The ":sh" command won't show a prompt, although it will sort of work.
189 - When using ":make" it's not possible to interrupt with a CTRL-C.
191 Typeahead while the external command is running is often lost.  This happens
192 both with a pipe and a pseudo-tty.  This is a known problem, but it seems it
193 can't be fixed (or at least, it's very difficult).
195                                                         *gui-pty-erase*
196 When your erase character is wrong for an external command, you should fix
197 this in your "~/.cshrc" file, or whatever file your shell uses for
198 initializations.  For example, when you want to use backspace to delete
199 characters, but hitting backspaces produces "^H" instead, try adding this to
200 your "~/.cshrc":
201 >       stty erase ^H
202 The ^H is a real CTRL-H, type it as CTRL-V CTRL-H.
204 ==============================================================================
205 4. Various                                              *gui-x11-various*
207                                                         *gui-x11-printing*
208 The "File/Print" menu simply sends the current buffer to "lpr".  No options or
209 whatever.  If you want something else, you can define your own print command.
210 For example:
212 >  :10amenu File.Print :w !lpr -Php3
213 >  :10vmenu File.Print :w !lpr -Php3
215                                                         *X11-icon*
216 Vim uses a black&white icon by default when compiled with Motif or Athena.  A
217 colored Vim icon is included as $VIMRUNTIME/vim32x32.xpm.  For GTK+, this is
218 the builtin icon used.  Unfortunately, how you should install it depends on
219 your window manager.  When you use this, remove the 'i' flag from
220 'guioptions', to remove the black&white icon:
221 >  :set guioptions-=i
223 If you use one of the fvwm* family of window managers simply add this line to
224 your .fvwm2rc configuration file:
226 > Style "vim"           Icon vim32x32.xpm
228 Make sure the icon file's location is consistent with the window manager's
229 IconPath statement.  Either modify the IconPath from within your .fvwm2rc or
230 drop the icon into one the pre-defined directories:
232 > IconPath /usr/X11R6/include/X11/pixmaps:/usr/X11R6/include/X11/bitmaps
234 For CDE "dtwm" (a derivative of Motif) add this line in the .Xdefaults:
235 >  Dtwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
237 For "mwm" (Motif window manager) the line would be:
238 >  Mwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
240 ==============================================================================
241 5. GTK version                                          *gui-gtk* *GTK+* *GTK*
243 The GTK version of the GUI works a little bit different.
245 GTK does _not_ obey many of the traditional X resource settings (e.g., stuff
246 like -bg, -fg, etc).  The ones that are supported are:
248     command line argument   resource name       meaning ~
249     -fn  or  -font          .font               font name for the text
250     -geom  or  -geometry    .geometry           size of the gvim window
251     -rv  or  -reverse       *reverseVideo       white text on black background
252     -display                                    display to be used
254 To set the font, see |'guifont'|.  For GTK, there's also a menu option that
255 does this.
257 Additionally, there are these command line arguments, which are handled by GTK
258 internally.  Look in the GTK documentation for how they are used:
259         --sync
260         --gdk-debug
261         --gdk-no-debug
262         --no-xshm
263         --xim-preedit
264         --xim-status
265         --gtk-debug
266         --gtk-no-debug
267         --g-fatal-warnings
268         --gtk-module
269         --display       (GTK+ counterpart of -display; works the same way.)
271 As for colors, vim's color settings (for syntax highlighting) is still
272 done the traditional vim way.  See |:highlight| for more help.
274 If you want to set the colors of remaining gui components (e.g., the
275 menubar, scrollbar, whatever), those are GTK specific settings and you
276 need to set those up in some sort of gtkrc file.  you'll have to refer
277 to the GTK documentation, however little there is, on how to do this.
279                                                 *gtk-tooltip-colors*
280 Example, which sets the tooltip colors to black on light-yellow:
282 >       style "tooltips"
283 >       {
284 >               bg[NORMAL] = "#ffffcc"
285 >               fg[NORMAL] = "#000000"
286 >       }
288 >       widget "gtk-tooltips*"          style "tooltips"
290 Write this in the file ~/.gtkrc and it will be used by GTK.  Don't forget to
291 remove the ">" characters from the first column.
293 ==============================================================================
294 6. Compiling                                            *gui-x11-compiling*
296 If using X11, Vim's Makefile will by default first try to find the necessary
297 GTK+ files on your system.  If the GTK+ files cannot be found, then the Motif
298 files will be searched for.  Finally, if this fails, the Athena files will be
299 searched for.  If all three fail, the GUI will be disabled.
301 For GTK+, Vim's configuration process requires that GTK+ be properly
302 installed.  That is, the shell script 'gtk-config' must be in your PATH, and
303 you can already successful compile, build, and execute a GTK+ program.  The
304 reason for this is because the compiler flags (CFLAGS) and link flags
305 (LDFLAGS) are obtained through the 'gtk-config' shell script.
307 Otherwise, if you are using Motif or Athena, when you have the Motif or Athena
308 files in a directory where configure doesn't look, edit the Makefile to enter
309 the names of the directories.  Search for "GUI_INC_LOC" for an example to set
310 the Motif directories, "CONF_OPT_X" for Athena.
312                                                         *gui-x11-gtk*
313 At the time of this writing, you may use either GTK+ version 1.0.6 or 1.2.  It
314 is suggested that you use v1.2 since not all of Vim's GUI features are present
315 if using v1.0.6.  For instance, there are no tearoff menus present in v1.0.6.
316 Using a version from GTK+'s CVS tree may or may not work, and is therefore not
317 supported and not recommended.
319 Lastly, although GTK+ has supposedly been ported to the Win32 platform, this
320 has not been tested with Vim and is also unsupported.
322                                                         *gui-x11-motif*
323 For Motif, you need at least Motif version 1.2 and/or X11R5.  Motif 2.0 and
324 X11R6 are OK.  Motif 1.1 and X11R4 might work, no guarantee (there may be a
325 few problems, but you might make it compile and run with a bit of work, please
326 send me the patches if you do).  The newest releases of LessTif have been
327 reported to work fine too.
329                                                         *gui-x11-athena*
330 The Athena version uses the Xaw widget set by default.  If you have the 3D
331 version, you might want to link with Xaw3d instead.  This will make the
332 menus look a bit better.  Edit the Makefile and look for "XAW_LIB".  The
333 scrollbars will remain the same, because Vim has its own, which are already
334 3D (in fact, they look more like Motif).
336                                                         *gui-x11-misc*
337 In general, do not try to mix files from different GTK+, Motif, Athena and X11
338 versions.  This will cause problems.  For example, using header files for
339 X11R5 with a library for X11R6 probably doesn't work (although the linking
340 won't give an error message, Vim will crash later).
342  vim:tw=78:ts=8:sw=4