home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / mac / vim54rt.sit / runtime / doc / gui_x11.txt < prev    next >
Encoding:
Text File  |  1999-08-14  |  14.1 KB  |  345 lines  |  [TEXT/ALFA]

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