home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim53os2.zip / vim-5.3 / doc / gui_x11.txt < prev    next >
Text File  |  1998-08-30  |  11KB  |  252 lines

  1. *gui_x11.txt*   For Vim version 5.3.  Last modification: 1998 Aug 17
  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. Compiling            |gui-x11-compiling|
  14.  
  15. Other relevant documentation:
  16. |gui.txt|    For generic items of the GUI.
  17.  
  18. {Vi does not have any of these commands}
  19.  
  20. ==============================================================================
  21. 1. Starting the X11 GUI                    *gui-x11-start*
  22.  
  23. Then you can run the GUI version of Vim in either of these ways:
  24.     gvim [options] [files...]
  25.     vim -g [options] [files...]
  26.  
  27. So if you call the executable "gvim", or make "gvim" a link to the executable,
  28. then the GUI version will automatically be used.  Additional characters may be
  29. added after "gvim", for example "gvim-5".
  30.  
  31. You may also start up the GUI from within the terminal version by using one of
  32. these commands:
  33.     :gui [+cmd] [-f] [files...]            *:gu* *:gui*
  34.     :gvim [+cmd] [-f] [files...]            *:gv* *:gvim*
  35.  
  36.                             *gui-fork*
  37. When the GUI is started, it does a fork() and exits the current process.
  38. When gvim was started from a shell this makes the shell accept further
  39. commands.  If you don't want this (e.g. when using gvim for a mail program
  40. that waits for gvim to exit), start gvim with "gvim -f", "vim -gf" or use
  41. ":gui -f".  Don't use "vim -fg", because "-fg" specifies the foreground
  42. color.  If you want the GUI to run in the foreground always, include the 'f'
  43. flag in 'guioptions'.  |-f|.
  44.  
  45. ==============================================================================
  46. 2. GUI Resources                    *gui-resources*
  47.  
  48. If using the Motif or Athena version of the GUI (not for the Win32 version), a
  49. number of X resources are available.  You should use Vim's class "Vim" when
  50. setting these.  They are as follows:
  51.  
  52.     Resource name    Meaning        ~
  53.  
  54.     reverseVideo    Boolean: should reverse video be used?
  55.     background        Color of background.
  56.     foreground        Color of normal text.
  57.     scrollBackground    Color of trough portion of scrollbars.
  58.     scrollForeground    Color of slider and arrow portions of scrollbars.
  59.     menuBackground    Color of menu backgrounds.
  60.     menuForeground    Color of menu foregrounds.
  61.     font        Name of font used for normal text.
  62.     boldFont        Name of font used for bold text.
  63.     italicFont        Name of font used for italic text.
  64.     boldItalicFont    Name of font used for bold, italic text.
  65.     geometry        Initial geometry to use for gvim's window (default
  66.             is same size as terminal that started it).
  67.     scrollbarWidth    Thickness of scrollbars.
  68.     menuHeight        Height of the menu bar.
  69.     borderWidth        Thickness of border around text area.
  70.  
  71. A special font for italic, bold, and italic-bold text will only be used if
  72. the user has specified one via a resource.  No attempt is made to guess what
  73. fonts should be used for these based on the normal text font at the moment.
  74.  
  75. Note that the colors can also be set with the ":highlight" command, using the
  76. "Normal", "Menu" and "Scrollbar" groups.
  77.  
  78.                             *font-sizes*
  79. Note: All fonts must be of the same size!!!  If you don't do this, text will
  80. disappear or mess up the display.  Vim does not check the font sizes.  It's
  81. the size in screen pixels that must be the same.  Note that some fonts that
  82. have the same point size don't have the same pixel size!  Additionally, the
  83. positioning of the fonts must be the same (ascent and descent).  You can check
  84. this with "xlsfonts -l <fontname>".
  85.  
  86. If any of these things are also set with Vim commands, eg with
  87. ":set guifont=Screen15", then this will override the X resources (currently
  88. 'guifont' is the only option that is supported).
  89.  
  90. Here is an example of what you might put in your ~/.Xdefaults file:
  91.  
  92. >    Vim*useSchemes:            all
  93. >    Vim*sgiMode:            true
  94. >    Vim*useEnhancedFSB:        true
  95. >    Vim.foreground:            Black
  96. >    Vim.background:            Wheat
  97. >    Vim*menuBar*font:        7x13
  98.  
  99. The first three of these are standard resources on Silicon Graphics machines
  100. which make Motif applications look even better, highly recommended!
  101.  
  102. Don't use "Vim*geometry" in the defaults.  This will break the menus.  Use
  103. "Vim.geometry" instead.
  104.  
  105. If you get an error message "Cannot allocate colormap entry for "gray60",
  106. try adding this to your Vim resources (change the colors to your liking):
  107.  
  108. >    Vim*scrollBackground:        Black
  109. >    Vim*scrollForeground:        Blue
  110.  
  111. The resources can also be set with arguments to vim:
  112.  
  113.     argument        meaning    ~
  114.                             *-gui*
  115.    -display <display>    Run vim on <display>        *-display*
  116.    -iconic        Start vim iconified        *-iconic*
  117.    -background <color>    Use <color> for the background    *-background*
  118.    -bg <color>        idem                *-bg*
  119.    -foreground <color>    Use <color> for normal text    *-foreground*
  120.    -fg <color>        idem                *-fg*
  121.    -ul <color>        idem                *-ul*
  122.    -font <font>        Use <font> for normal text    *-font*
  123.    -fn <font>        idem                *-fn*
  124.    -boldfont <font>    Use <font> for bold text    *-boldfont*
  125.    -italicfont <font>    Use <font> for italic text    *-italicfont*
  126.    -geometry <geom>    Use <geom> for initial geometry    *-geometry*
  127.    -geom <geom>        idem                *-geom*
  128.    -borderwidth <width>    Use a border width of <width>    *-borderwidth*
  129.    -bw <width>        idem                *-bw*
  130.                             *-scrollbarwidth*
  131.    -scrollbarwidth <width>    Use a scrollbar width of <width>
  132.    -sw <width>        idem                *-sw*
  133.    -menuheight <height>    Use a menu bar height of <height> *-menuheight*
  134.    -mh <height>        idem                *-mh*
  135.    -reverse        Use reverse video        *-reverse*
  136.    -rv            idem                *-rv*
  137.    +reverse        Don't use reverse video        *-+reverse*
  138.    +rv            idem                *-+rv*
  139.    -xrm <resource>    Set the specified resource    *-xrm*
  140.  
  141. Note about reverse video: Vim checks that the result is actually a light text
  142. on a dark background.  The reason is that some X11 versions swap the colors,
  143. and some don't.  These two examples will both give yellow text on a blue
  144. background:
  145.     gvim -fg Yellow -bg Blue -reverse
  146.     gvim -bg Yellow -fg Blue -reverse
  147.  
  148. ==============================================================================
  149. 3. Shell Commands                    *gui-pty*
  150.  
  151. WARNING: Executing an external command from the GUI will not always work.
  152. "normal" commands like "ls", "grep" and "make" mostly work fine.  Commands
  153. that require an intelligent terminal like "less" and "ispell" won't work.
  154. Some may even hang and need to be killed from another terminal.  So be
  155. careful!
  156.  
  157. There are two ways to do the I/O with a shell command: Pipes and a pseudo-tty.
  158. The default is to use a pseudo-tty.  This should work best on most systems.
  159.  
  160. Unfortunately, the implementation of the pseudo-tty is different on every Unix
  161. system.  And some systems require root permission.  To avoid running into
  162. problems with a pseudo-tty when you least expect it, test it when not editing
  163. a file.  Be prepared to "kill" the started command or Vim.  Commands like
  164. ":r !cat" may hang!
  165.  
  166. If using a pseudo-tty does not work for you, reset the 'guipty' option:
  167.  
  168. >    :set noguipty
  169.  
  170. Using a pipe should work on any Unix system, but there are disadvantages:
  171. - Some shell commands will notice that a pipe is being used and behave
  172.   differently.  E.g., ":!ls" will list the files in one column.
  173. - The ":sh" command won't show a prompt, although it will sort of work.
  174. - When using ":make" it's not possible to interrupt with a CTRL-C.
  175.  
  176. Typehead while the external command is running is often lost.  This happens
  177. both with a pipe and a pseudo-tty.  This is a known problem, but it seems it
  178. can't be fixed (or at least, it's very difficult).
  179.  
  180.                             *gui-pty-erase*
  181. When your erase character is wrong for an external command, you should fix
  182. this in your "~/.cshrc" file, or whatever file your shell uses for
  183. initializations.  For example, when you want to use backspace to delete
  184. characters, but hitting backspaces produces "^H" instead, try adding this to
  185. your "~/.cshrc":
  186. >    stty erase ^H
  187. The ^H is a real CTRL-H, type it as CTRL-V CTRL-H.
  188.  
  189. ==============================================================================
  190. 4. Various                        *gui-x11-various*
  191.  
  192.                             *gui-x11-printing*
  193. The "File/Print" menu simply sends the current buffer to "lpr".  No options or
  194. whatever.  If you want something else, you can define your own print command.
  195. For example:
  196.  
  197. >  :10amenu File.Print :w !lpr -Php3
  198. >  :10vmenu File.Print :w !lpr -Php3
  199.  
  200.                             *X11-icon*
  201. Vim uses a black&white icon by default.  A colored Vim icon is included as
  202. $VIM/vim32x32.xpm.  Unfortunately, how you should install it depends on your
  203. window manager.  When you use this, remove the 'i' flag from 'guioptions', to
  204. remove the black&white icon:
  205. >  :set guioptions-=i
  206.  
  207. If you use one of the fvwm* family of window managers simply add this line to
  208. your .fvwm2rc configuration file:
  209.  
  210. > Style "vim"        Icon vim32x32.xpm
  211.  
  212. Make sure the icon file's location is consistent with the window manager's
  213. IconPath statement.  Either modify the IconPath from within your .fvwm2rc or
  214. drop the icon into one the pre-defined directories:
  215.  
  216. > IconPath /usr/X11R6/include/X11/pixmaps:/usr/X11R6/include/X11/bitmaps
  217.  
  218. For CDE "dtwm" (a derivative of Motif) add this line in the .Xdefaults:
  219. >  Dtwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
  220.  
  221. For "mwm" (Motif window manager) the line would be:
  222. >  Mwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
  223.  
  224. ==============================================================================
  225. 5. Compiling                        *gui-x11-compiling*
  226.  
  227. You need at least Motif version 1.2 and/or X11R5.  Motif 2.0 and X11R6 are OK.
  228. Motif 1.1 and X11R4 might work, no guarantee (there may be a few problems, but
  229. you might make it compile and run with a bit of work, please send me the
  230. patches if you do).  The newest releases of Lesstif have been reported to
  231. mostly work (e.g., tear-off menus don't work).
  232.  
  233. By default the Makefile tries to compile Vim with the GUI.  When the Motif
  234. files cannot be found the Athena files will be searched for.  When both of
  235. them cannot be found, the GUI will be disabled.  When you have the Motif or
  236. Athena files in a directory where configure doesn't look, edit the Makefile
  237. to enter the names of the directories.  Search for "GUI_INC_LOC" for an
  238. example to set the Motif directories, "CONF_OPT_X" for Athena.
  239.  
  240. Don't try to mix files from different Motif, Athena and X11 versions.  This
  241. will cause problems.  For example, using header files for X11R5 with a
  242. library for X11R6 probably doesn't work (although the linking won't give an
  243. error message, Vim will crash later).
  244.  
  245. The Athena version uses the Xaw widget set by default.  If you have the 3D
  246. version, you might want to link with Xaw3d instead.  This will make the
  247. menus look a bit better.  Edit the Makefile and look for "XAW_LIB".  The
  248. scrollbars will remain the same, because Vim has its own, which are already
  249. 3D (in fact, they look more like Motif).
  250.  
  251.  vim:tw=78:ts=8:sw=4
  252.