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

  1. *gui_w32.txt*   For Vim version 5.3.  Last modification: 1998 Aug 30
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Vim's Graphical User Interface                *gui-w32*
  8.  
  9. 1. Starting the GUI        |gui-w32-start|
  10. 2. Vim as default editor    |vim-default-editor|
  11. 3. Using the clipboard        |gui-clipboard|
  12. 4. Shell Commands        |gui-shell-win32|
  13. 5. Special colors        |win32-colors|
  14. 6. Windows dialogs & browsers    |gui-w32-dialogs|
  15. 7. Various            |gui-w32-various|
  16.  
  17. Other relevant documentation:
  18. |gui.txt|    For generic items of the GUI.
  19. |os_win32.txt|  For Win32 specific items.
  20.  
  21. {Vi does not have a Windows GUI}
  22.  
  23. ==============================================================================
  24. 1. Starting the GUI                    *gui-w32-start*
  25.  
  26. The Win32 GUI version of Vim will always start the GUI, no matter how you
  27. start it or what it's called.
  28.  
  29. The GUI will always run in the Windows subsystem.  Mostly shells automatically
  30. return with a command prompt after starting gvim.  If not, you should use the
  31. "start" command:
  32. >    start gvim [options] file ..
  33.  
  34. Note: All fonts (bold, italic) must be of the same size!!!  If you don't do
  35. this, text will disappear or mess up the display.  Vim does not check the font
  36. sizes.  It's the size in screen pixels that must be the same.  Note that some
  37. fonts that have the same point size don't have the same pixel size!
  38. Additionally, the positioning of the fonts must be the same (ascent and
  39. descent).
  40.  
  41. The Win32 GUI has an extra menu item:  "Window/Select Font".  It brings up the
  42. standard Windows font selector.
  43.  
  44. Setting the menu height doesn't work for the Win32 GUI.
  45.  
  46.                                 *gui-w32s*
  47. There is a specific version of gvim.exe that runs under the Win32s subsystem
  48. of Windows 3.1 or 3.11.  See |win32s|.
  49.  
  50. ==============================================================================
  51. 2. Vim as default editor                *vim-default-editor*
  52.  
  53. To set Vim as the default editor for a file type:
  54. 1. Start a Windows Explorer
  55. 2. Chose View/Options -> File Types
  56. 3. Select the path to gvim for every file type that you want to use it for.
  57.    (you can also use three spaces in the file type field, for files without an
  58.    extension).
  59.    In the "open" action, use
  60. >    gvim "%1"
  61.    The quotes are required for using file names with embedded spaces.
  62.  
  63. When you open a file in Vim by double clicking it, Vim changes to that
  64. file's directory.
  65.  
  66. If you want Vim to start full-screen, use this for the Open action:
  67. >    gvim -c"simalt ~x" "%1"
  68.  
  69. Another method, which also works When you put Vim in another directory (e.g.,
  70. when you have got a new version):
  71. 1. Put focus on a file you want Vim to use with
  72. 2. <Shift-F10>
  73. 3. <Open With...>
  74. 4. <Other...>
  75. 5. Browse to the (new) location of Vim and click <Open>
  76. 6. <Always Use this program...> checked
  77. 7. <OK>
  78.  
  79.                             *send-to-menu*
  80. You can also install Vim in the "Send To" menu:
  81. 1. Start a Windows Explorer
  82. 2. Navigate to your sendto directory:
  83.    Windows 95: %windir%\sendto (e.g. "c:\windows\sendto")
  84.    Windows NT: %windir%\profiles\%user%\sendto (e.g.
  85.            "c:\winnt\profiles\mattha\sendto").
  86. 3. Right-click in the file pane and select New->Shortcut
  87. 4. Follow the shortcut wizard, using the full path to VIM/GVIM.
  88.  
  89. When you 'send a file to Vim', Vim changes to that file's directory.  Note,
  90. however, that any long directory names will appear in their short (MS-DOS)
  91. form.  This is a limitation of the Windows "Send To" mechanism.
  92.  
  93. ==============================================================================
  94. 3. Using the clipboard                    *gui-clipboard*
  95.  
  96. Windows has a clipboard, where you can copy text to, and paste text from.  Vim
  97. supports this in several ways.
  98.  
  99. The "* register reflects the contents of the clipboard.  |quotestar|
  100.  
  101. The 'a' flag in 'guioptions' is not included by default.  This means that text
  102. is only put on the clipboard when an operation is performed on it.  Just
  103. Visually selecting text doesn't put it on the clipboard.  When the 'a' flag is
  104. included, the text is copied to the clipboard even when it is not operated
  105. upon.
  106.  
  107. To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the
  108. $VIM/mswin.vim script.  You could add this line to your _vimrc file:
  109. >    source $VIM/mswin.vim
  110.  
  111. Since CTRL-C is used to copy the text to the clipboard, it can't be used to
  112. cancel an operation.  Use CTRL-Break for that.
  113.  
  114. Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
  115. selection.  You can use g<C-H><C-G> instead (g CTRL-H CTRL-G).  If that's too
  116. complicated for you, map CTRL-K to the old meaning of CTRL-V:
  117. >  :nnoremap <C-K> <C-V>
  118.  
  119. NOTE: The clipboard support still has a number of bugs.  See |todo|.
  120.  
  121. ==============================================================================
  122. 4. Shell Commands                    *gui-shell-win32*
  123.  
  124. Vim uses another window for external commands, to make it possible to run any
  125. command.  The external command gets its own environment for running, just like
  126. it was started from a DOS prompt.
  127.  
  128.                             *win32-vimrun*
  129. Executing an external command is done indirectly by the "vimrun" command.  The
  130. "vimrun.exe" must be in the path for this to work.  Or it must be in the same
  131. directory as the Vim executable.  If "vimrun" cannot be found, the command is
  132. executed directly, but then the DOS window closes immediately after the
  133. external command has finished.
  134. WARNING: If you close this window with the "X" button, and confirm the
  135. question if you really want to kill the application, Vim may be killed too!
  136. (This does not apply to commands run asynchronously with ":!start".)
  137.  
  138. In Windows 95, the window in which the commands are executed is always 25x80
  139. characters, to be as DOS compatible as possible (this matters!).  The default
  140. system font is used. On NT, the window will be the default you have set up for
  141. "Console" in Control Panel. On Win32s, the properties of the DOS box are
  142. determined by _default.pif in the windows directory.
  143.  
  144.                             *msdos-mode*
  145. If you get a dialog that says "This program is set to run in MS-DOS mode..."
  146. when you run an external program, you can solve this by changing the
  147. properties of the associated shortcut:
  148. - Use a Windows Explorer to find the command.com that is used.  It can be
  149.   c:\command.com, c:\dos\command.com, c:\windows\command.com, etc.
  150. - With the right mouse button, select properties of this command.com.
  151. - In the Program tab select "Advanced".
  152. - Unselect "MS-DOS mode".
  153. - Click "OK" twice.
  154.  
  155.                             *win32-!start*
  156. Normally, Vim waits for a command to complete before continuing (this makes
  157. sense for most shell commands which produce output for Vim to use).  If you
  158. want Vim to start a program and return immediately, you can use the following
  159. syntax on W95 & NT:
  160. >    :!start <command>
  161. On Win32s, you will have to go to another window instead. Don't forget that
  162. you must tell Windows 3.1x to keep executing a DOS command in the background
  163. while you switch back to Vim.
  164.  
  165. ==============================================================================
  166. 5. Special colors                    *win32-colors*
  167.  
  168. On Win32, the normal DOS colors can be used.  See |dos-colors|.
  169.  
  170. Additionally the system configured colors can also be used.  These are known
  171. by the names Sys_XXX, where XXX is the appropriate system color name, from the
  172. following list (see the Win32 documentation for full descriptions).  Case is
  173. ignored. note: On Win32s not all of these colours are supported.
  174.  
  175. Sys_3DDKShadow        Sys_3DFace            Sys_BTNFace
  176. Sys_3DHilight        Sys_3DHighlight            Sys_BTNHilight
  177. Sys_BTNHighlight    Sys_3DLight            Sys_3DShadow
  178. Sys_BTNShadow        Sys_ActiveBorder        Sys_ActiveCaption
  179. Sys_AppWorkspace    Sys_Background            Sys_Desktop
  180. Sys_BTNText        Sys_CaptionText            Sys_GrayText
  181. Sys_Highlight        Sys_HighlightText        Sys_InactiveBorder
  182. Sys_InactiveCaption    Sys_InactiveCaptionText        Sys_InfoBK
  183. Sys_InfoText        Sys_Menu            Sys_MenuText
  184. Sys_ScrollBar        Sys_Window            Sys_WindowFrame
  185. Sys_WindowText
  186.  
  187. Probably the most useful values are
  188.     Sys_Window        Normal window background
  189.     Sys_WindowText      Normal window text
  190.     Sys_Highlight       Highlighted background
  191.     Sys_HighlightText   Highlighted text
  192.  
  193. These extra colors are also available:
  194. Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
  195.  
  196.                                 *rgb.txt*
  197. Additionally, colors defined by a "rgb.txt" file can be used.  This file is
  198. well known from X11.  A few lines from it:
  199.  
  200. >  255 218 185           peach puff
  201. >  205 133  63           peru
  202. >  255 181 197           pink
  203.  
  204. This shows the layout of the file:  First the R, G and B value as a decimal
  205. number, followed by the name of the color.  The four fields are separated by
  206. spaces.
  207.  
  208. You can get an rgb.txt file from any X11 distribution.  It is located in a
  209. directory like "/usr/X11R6/lib/X11/".  For Vim it must be located in the $VIM
  210. directory.  Thus the file can be found with "$VIM/rgb.txt".
  211.  
  212. ==============================================================================
  213.                         *gui-w32-dialogs* *dialog*
  214. 6. Windows dialogs & browsers
  215.  
  216. The Win32 GUI can use familiar Windows components for some operations, as well
  217. as the traditional interface shared with the console version.
  218.  
  219.  
  220. 6.1 Dialogs
  221.  
  222. The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
  223. |:confirm| command and |confirm()| function are GUI-based rather than the
  224. console-based ones used by other versions.  There is no option to change this.
  225.  
  226.  
  227. 6.2 File Browsers
  228.  
  229. When prepending ":browse" before file editing commands, a file requester is
  230. used to allow you to select an existing file.  See |:browse|.
  231.  
  232.  
  233. 6.3 Tearoff Menus
  234.  
  235. The Win32 GUI emulates Motif's tear-off menus.  At the top of each menu you
  236. will see a small graphic "rip here" sign.  Selecting it will cause a floating
  237. window to be created with the same menu entries on it.  The floating menu can
  238. then be accessed just as if it was the original (including sub-menus), but
  239. without having to go to the menu bar each time.
  240. This is most useful if you find yourself using a command buried in a sub-menu
  241. over and over again.
  242. The tearoff menus can be positioned where you like, and always stay just above
  243. the Main Vim window. You can get rid of them by closing them as usual; they
  244. also of course close when you exit Vim.
  245.  
  246.                             *:tearoff* *:te*
  247. :te[aroff] {name}    Tear-off the menu {name}.  The menu named must have at
  248.             least one subentry, but need not appear on the
  249.             menu-bar (see |win32-hidden-menus|).
  250.  
  251. Example:
  252. >    :tearoff File
  253. will make the "File" menu (if there is one) appear as a tearoff menu.
  254.  
  255. >    :amenu ]Toolbar.Make    :make<CR>
  256. >    :tearoff ]Toolbar
  257. This creates a floating menu that doesn't exist on the main menu-bar.
  258.  
  259. Note that a menu that starts with ']' will not be displayed.
  260.  
  261. ==============================================================================
  262. 7. Various                        *gui-w32-various*
  263.  
  264.                             *gui-w32-printing*
  265. The "File/Print" menu uses Notepad to print the current buffer.  This is a bit
  266. clumsy, but it's portable.  If you want something else, you can define your
  267. own print command.  For example, you could replace Notepad with Editpad
  268. (www.tornado.be/~johnfg).  See $VIM/menu.vim for how it works by default.
  269.  
  270. Vim supports a number of standard MS Windows features. Some of these are
  271. detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
  272.  
  273. You can drag and drop one or more files into the vim window, where they will
  274. be opened as normal. If you hold down Shift while doing this, Vim changes to
  275. the (first) dropped file's directory.
  276. You can also drop a directory's icon, but rather than open all files in the
  277. directory (which wouldn't usually be what you want) Vim instead changes to
  278. that directory and begins a new file.
  279.  
  280.                             *:simalt* *:si*
  281. :si[malt] {key}        simulate pressing {key} while holding Alt pressed.
  282.             {not in Vi} {only for Win32 versions}
  283.  
  284. Normally, Vim takes control of all Alt-<Key> combinations, to increase the
  285. number of possible mappings. This clashes with the standard use of Alt as the
  286. key for accessing menus.
  287. The quick way of getting standard behaviour is to set the 'winaltkeys' option
  288. to "yes".  This however prevents you from mapping Alt keys at all.
  289. Another way is to set 'winaltkeys' to "menu".  Menu shortcut keys are then
  290. handled by windows, other ALT keys can be mapped.  This doesn't allow a
  291. dependency on the current state though.
  292. To get round this, the :simalt command allows Vim (when 'winaltkeys' is not
  293. "yes") to fake a Windows-style Alt keypress. You can use this to map Alt key
  294. combinations (or anything else for that matter) to produce standard Windows
  295. actions. Here are some examples:
  296.  
  297. >    :map <M-f> :simalt f<CR>
  298. This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by
  299. simulating the keystrokes Alt, F.
  300. >    :map <M-Space> :simalt ~<CR>
  301. This maps Alt-Space to pop down the system menu for the Vim window. Note that
  302. ~ is used by simalt to represent the <Space> character.
  303. >    :map <C-n> :simalt ~n<CR>
  304. Maps Control-N to produce the keys Alt-Space followed by N. This minimises the
  305. Vim window via the system menu.
  306.  
  307.  vim:tw=78:ts=8:sw=4
  308.