Bram Moolenaar | bb76f24 | 2016-09-12 14:24:39 +0200 | [diff] [blame] | 1 | *gui_w32.txt* For Vim version 8.0. Last change: 2014 Dec 20 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
| 5 | |
| 6 | |
| 7 | Vim's Win32 Graphical User Interface *gui-w32* *win32-gui* |
| 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. Command line arguments |gui-w32-cmdargs| |
| 16 | 8. Various |gui-w32-various| |
| 17 | |
| 18 | Other relevant documentation: |
| 19 | |gui.txt| For generic items of the GUI. |
Bram Moolenaar | fa13eef | 2013-02-06 17:34:04 +0100 | [diff] [blame] | 20 | |os_win32.txt| For Win32 specific items. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 21 | |
| 22 | {Vi does not have a Windows GUI} |
| 23 | |
| 24 | ============================================================================== |
| 25 | 1. Starting the GUI *gui-w32-start* |
| 26 | |
| 27 | The Win32 GUI version of Vim will always start the GUI, no matter how you |
| 28 | start it or what it's called. |
| 29 | |
| 30 | The GUI will always run in the Windows subsystem. Mostly shells automatically |
| 31 | return with a command prompt after starting gvim. If not, you should use the |
| 32 | "start" command: > |
| 33 | start gvim [options] file .. |
| 34 | |
| 35 | Note: All fonts (bold, italic) must be of the same size!!! If you don't do |
| 36 | this, text will disappear or mess up the display. Vim does not check the font |
| 37 | sizes. It's the size in screen pixels that must be the same. Note that some |
| 38 | fonts that have the same point size don't have the same pixel size! |
| 39 | Additionally, the positioning of the fonts must be the same (ascent and |
| 40 | descent). |
| 41 | |
| 42 | The Win32 GUI has an extra menu item: "Edit/Select Font". It brings up the |
| 43 | standard Windows font selector. |
| 44 | |
| 45 | Setting the menu height doesn't work for the Win32 GUI. |
| 46 | |
| 47 | *gui-win32-maximized* |
| 48 | If you want Vim to start with a maximized window, add this command to your |
| 49 | vimrc or gvimrc file: > |
| 50 | au GUIEnter * simalt ~x |
| 51 | < |
Bram Moolenaar | 78e1762 | 2007-08-30 10:26:19 +0000 | [diff] [blame] | 52 | |
| 53 | Using Vim as a plugin *gui-w32-windowid* |
| 54 | |
| 55 | When gvim starts up normally, it creates its own top level window. If you |
| 56 | pass Vim the command-line option |--windowid| with a decimal or hexadecimal |
| 57 | value, Vim will create a window that is a child of the window with the given |
| 58 | ID. This enables Vim to act as a plugin in another application. This really |
| 59 | is a programmer's interface, and is of no use without a supporting application |
| 60 | to spawn Vim correctly. |
| 61 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | ============================================================================== |
| 63 | 2. Vim as default editor *vim-default-editor* |
| 64 | |
| 65 | To set Vim as the default editor for a file type: |
| 66 | 1. Start a Windows Explorer |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 67 | 2. Choose View/Options -> File Types |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 68 | 3. Select the path to gvim for every file type that you want to use it for. |
| 69 | (you can also use three spaces in the file type field, for files without an |
| 70 | extension). |
| 71 | In the "open" action, use: > |
| 72 | gvim "%1" |
| 73 | < The quotes are required for using file names with embedded spaces. |
| 74 | You can also use this: > |
| 75 | gvim "%L" |
| 76 | < This should avoid short (8.3 character) file names in some situations. But |
| 77 | I'm not sure if this works everywhere. |
| 78 | |
| 79 | When you open a file in Vim by double clicking it, Vim changes to that |
| 80 | file's directory. |
| 81 | |
| 82 | If you want Vim to start full-screen, use this for the Open action: > |
| 83 | gvim -c "simalt ~x" "%1" |
| 84 | |
| 85 | Another method, which also works when you put Vim in another directory (e.g., |
| 86 | when you have got a new version): |
| 87 | 1. select a file you want to use Vim with |
| 88 | 2. <Shift-F10> |
| 89 | 3. select "Open With..." menu entry |
| 90 | 4. click "Other..." |
| 91 | 5. browse to the (new) location of Vim and click "Open" |
| 92 | 6. make "Always Use this program..." checked |
| 93 | 7. <OK> |
| 94 | |
| 95 | *send-to-menu* *sendto* |
| 96 | You can also install Vim in the "Send To" menu: |
| 97 | 1. Start a Windows Explorer |
| 98 | 2. Navigate to your sendto directory: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 99 | Windows NT: %windir%\profiles\%user%\sendto (e.g. |
Bram Moolenaar | cea912a | 2016-10-12 14:20:24 +0200 | [diff] [blame] | 100 | "c:\winnt\profiles\mattha\sendto") |
| 101 | Windows XP: C:\Documents and Settings\%user%\SendTo |
| 102 | Windows Vista: C:\Users\%user%\AppData\Roaming\Microsoft\Windows\SendTo . |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 103 | 3. Right-click in the file pane and select New->Shortcut |
| 104 | 4. Follow the shortcut wizard, using the full path to VIM/GVIM. |
| 105 | |
| 106 | When you 'send a file to Vim', Vim changes to that file's directory. Note, |
| 107 | however, that any long directory names will appear in their short (MS-DOS) |
| 108 | form. This is a limitation of the Windows "Send To" mechanism. |
| 109 | |
| 110 | *notepad* |
| 111 | You could replace notepad.exe with gvim.exe, but that has a few side effects. |
| 112 | Some programs rely on notepad arguments, which are not recognized by Vim. For |
| 113 | example "notepad -p" is used by some applications to print a file. It's |
| 114 | better to leave notepad where it is and use another way to start Vim. |
| 115 | |
| 116 | *win32-popup-menu* |
| 117 | A more drastic approach is to install an "Edit with Vim" entry in the popup |
| 118 | menu for the right mouse button. With this you can edit any file with Vim. |
| 119 | |
| 120 | This can co-exist with the file associations mentioned above. The difference |
| 121 | is that the file associations will make starting Vim the default action. With |
| 122 | the "Edit with Vim" menu entry you can keep the existing file association for |
| 123 | double clicking on the file, and edit the file with Vim when you want. For |
| 124 | example, you can associate "*.mak" with your make program. You can execute |
| 125 | the makefile by double clicking it and use the "Edit with Vim" entry to edit |
| 126 | the makefile. |
| 127 | |
| 128 | You can select any files and right-click to see a menu option called "Edit |
Bram Moolenaar | c236c16 | 2008-07-13 17:41:49 +0000 | [diff] [blame] | 129 | with gvim". Choosing this menu option will invoke gvim with the file you have |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 130 | selected. If you select multiple files, you will find two gvim-related menu |
| 131 | options: |
| 132 | "Edit with multiple gvims" -- one gvim for each file in the selection |
| 133 | "Edit with single gvim" -- one gvim for all the files in the selection |
| 134 | And if there already is a gvim running: |
| 135 | "Edit with existing gvim" -- edit the file with the running gvim |
| 136 | |
Bram Moolenaar | 5302d9e | 2011-09-14 17:55:08 +0200 | [diff] [blame] | 137 | The "edit with existing Vim" entries can be disabled by adding an entry in the |
| 138 | registry under HKLM\Software\Vim\Gvim, named DisableEditWithExisting, and with |
| 139 | any value. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 140 | *install-registry* |
| 141 | You can add the "Edit with Vim" menu entry in an easy way by using the |
| 142 | "install.exe" program. It will add several registry entries for you. |
| 143 | |
| 144 | You can also do this by hand. This is complicated! Use the install.exe if |
| 145 | you can. |
| 146 | |
| 147 | 1. Start the registry editor with "regedit". |
| 148 | 2. Add these keys: |
| 149 | key value name value ~ |
| 150 | HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99} |
| 151 | {default} Vim Shell Extension |
| 152 | HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32 |
| 153 | {default} {path}\gvimext.dll |
| 154 | ThreadingModel Apartment |
| 155 | HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim |
| 156 | {default} {51EEE242-AD87-11d3-9C1E-0090278BBD99} |
| 157 | HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved |
| 158 | {51EEE242-AD87-11d3-9C1E-0090278BBD99} |
| 159 | Vim Shell Extension |
| 160 | HKEY_LOCAL_MACHINE\Software\Vim\Gvim |
| 161 | path {path}\gvim.exe |
| 162 | HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6 |
| 163 | DisplayName Vim 5.6: Edit with Vim popup menu entry |
| 164 | UninstallString {path}\uninstal.exe |
| 165 | |
| 166 | Replace {path} with the path that leads to the executable. |
| 167 | Don't type {default}, this is the value for the key itself. |
| 168 | |
| 169 | To remove "Edit with Vim" from the popup menu, just remove the registry |
| 170 | entries mentioned above. The "uninstal.exe" program can do this for you. You |
| 171 | can also use the entry in the Windows standard "Add/Remove Programs" list. |
| 172 | |
| 173 | If you notice that this entry overrules other file type associations, set |
| 174 | those associations again by hand (using Windows Explorer, see above). This |
| 175 | only seems to happen on some Windows NT versions (Windows bug?). Procedure: |
| 176 | 1. Find the name of the file type. This can be done by starting the registry |
| 177 | editor, and searching for the extension in \\HKEY_CLASSES_ROOT |
| 178 | 2. In a Windows Explorer, use View/Options/File Types. Search for the file |
| 179 | type in the list and click "Edit". In the actions list, you can select on |
| 180 | to be used as the default (normally the "open" action) and click on the |
| 181 | "Set Default" button. |
| 182 | |
| 183 | |
| 184 | Vim in the "Open With..." context menu *win32-open-with-menu* |
| 185 | |
| 186 | If you use the Vim install program you have the choice to add Vim to the "Open |
| 187 | With..." menu. This means you can use Vim to edit many files. Not every file |
| 188 | (for unclear reasons...), thus the "Edit with Vim" menu entry is still useful. |
| 189 | |
| 190 | One reason to add this is to be able to edit HTML files directly from Internet |
| 191 | Explorer. To enable this use the "Tools" menu, "Internet Options..." entry. |
| 192 | In the dialog select the "Programs" tab and select Vim in the "HTML editor" |
| 193 | choice. If it's not there than installing didn't work properly. |
| 194 | |
| 195 | Doing this manually can be done with this script: |
| 196 | |
| 197 | ---------------------------------------------------------- |
| 198 | REGEDIT4 |
| 199 | |
| 200 | [HKEY_CLASSES_ROOT\Applications\gvim.exe] |
| 201 | |
| 202 | [HKEY_CLASSES_ROOT\Applications\gvim.exe\shell] |
| 203 | |
| 204 | [HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit] |
| 205 | |
| 206 | [HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command] |
| 207 | @="c:\\vim\\vim62\\gvim.exe \"%1\"" |
| 208 | |
| 209 | [HKEY_CLASSES_ROOT\.htm\OpenWithList\gvim.exe] |
| 210 | |
| 211 | [HKEY_CLASSES_ROOT\*\OpenWithList\gvim.exe] |
| 212 | |
| 213 | ---------------------------------------------------------- |
| 214 | |
| 215 | Change the "c:\\vim\\vim62" bit to where gvim.exe is actually located. |
| 216 | |
| 217 | To uninstall this run the Vim uninstall program or manually delete the |
| 218 | registry entries with "regedit". |
| 219 | |
| 220 | ============================================================================== |
| 221 | 3. Using the clipboard *gui-clipboard* |
| 222 | |
| 223 | Windows has a clipboard, where you can copy text to, and paste text from. Vim |
| 224 | supports this in several ways. For other systems see |gui-selections|. |
| 225 | |
| 226 | The "* register reflects the contents of the clipboard. |quotestar| |
| 227 | |
| 228 | When the "unnamed" string is included in the 'clipboard' option, the unnamed |
| 229 | register is the same. Thus you can yank to and paste from the clipboard |
| 230 | without prepending "* to commands. |
| 231 | |
| 232 | The 'a' flag in 'guioptions' is not included by default. This means that text |
| 233 | is only put on the clipboard when an operation is performed on it. Just |
| 234 | Visually selecting text doesn't put it on the clipboard. When the 'a' flag is |
| 235 | included, the text is copied to the clipboard even when it is not operated |
| 236 | upon. |
| 237 | |
| 238 | *mswin.vim* |
| 239 | To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the |
| 240 | $VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file: > |
| 241 | source $VIMRUNTIME/mswin.vim |
| 242 | |
| 243 | Since CTRL-C is used to copy the text to the clipboard, it can't be used to |
| 244 | cancel an operation. Use CTRL-Break for that. |
| 245 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 246 | CTRL-Z is used for undo. This means you can't suspend Vim with this key, use |
| 247 | |:suspend| instead (if it's supported at all). |
Bram Moolenaar | 6f7926c | 2005-01-07 21:45:22 +0000 | [diff] [blame] | 248 | |
Bram Moolenaar | df177f6 | 2005-02-22 08:39:57 +0000 | [diff] [blame] | 249 | *CTRL-V-alternative* *CTRL-Q* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 250 | Since CTRL-V is used to paste, you can't use it to start a blockwise Visual |
| 251 | selection. You can use CTRL-Q instead. You can also use CTRL-Q in Insert |
| 252 | mode and Command-line mode to get the old meaning of CTRL-V. But CTRL-Q |
| 253 | doesn't work for terminals when it's used for control flow. |
| 254 | |
| 255 | NOTE: The clipboard support still has a number of bugs. See |todo|. |
| 256 | |
| 257 | ============================================================================== |
| 258 | 4. Shell Commands *gui-shell-win32* |
| 259 | |
| 260 | Vim uses another window for external commands, to make it possible to run any |
| 261 | command. The external command gets its own environment for running, just like |
| 262 | it was started from a DOS prompt. |
| 263 | |
| 264 | *win32-vimrun* |
| 265 | Executing an external command is done indirectly by the "vimrun" command. The |
| 266 | "vimrun.exe" must be in the path for this to work. Or it must be in the same |
| 267 | directory as the Vim executable. If "vimrun" cannot be found, the command is |
| 268 | executed directly, but then the DOS window closes immediately after the |
| 269 | external command has finished. |
| 270 | WARNING: If you close this window with the "X" button, and confirm the |
| 271 | question if you really want to kill the application, Vim may be killed too! |
| 272 | (This does not apply to commands run asynchronously with ":!start".) |
| 273 | |
Bram Moolenaar | cea912a | 2016-10-12 14:20:24 +0200 | [diff] [blame] | 274 | The window in which the commands are executed will be the default you have set |
| 275 | up for "Console" in Control Panel. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 276 | |
| 277 | *win32-!start* |
| 278 | Normally, Vim waits for a command to complete before continuing (this makes |
| 279 | sense for most shell commands which produce output for Vim to use). If you |
| 280 | want Vim to start a program and return immediately, you can use the following |
Bram Moolenaar | cea912a | 2016-10-12 14:20:24 +0200 | [diff] [blame] | 281 | syntax: > |
Bram Moolenaar | 2a8a3ec | 2011-01-08 16:06:37 +0100 | [diff] [blame] | 282 | :!start [/min] {command} |
| 283 | The optional "/min" causes the window to be minimized. |
| 284 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 285 | ============================================================================== |
| 286 | 5. Special colors *win32-colors* |
| 287 | |
| 288 | On Win32, the normal DOS colors can be used. See |dos-colors|. |
| 289 | |
| 290 | Additionally the system configured colors can also be used. These are known |
| 291 | by the names Sys_XXX, where XXX is the appropriate system color name, from the |
| 292 | following list (see the Win32 documentation for full descriptions). Case is |
Bram Moolenaar | cea912a | 2016-10-12 14:20:24 +0200 | [diff] [blame] | 293 | ignored. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 294 | |
| 295 | Sys_3DDKShadow Sys_3DFace Sys_BTNFace |
| 296 | Sys_3DHilight Sys_3DHighlight Sys_BTNHilight |
| 297 | Sys_BTNHighlight Sys_3DLight Sys_3DShadow |
| 298 | Sys_BTNShadow Sys_ActiveBorder Sys_ActiveCaption |
| 299 | Sys_AppWorkspace Sys_Background Sys_Desktop |
| 300 | Sys_BTNText Sys_CaptionText Sys_GrayText |
| 301 | Sys_Highlight Sys_HighlightText Sys_InactiveBorder |
| 302 | Sys_InactiveCaption Sys_InactiveCaptionText Sys_InfoBK |
| 303 | Sys_InfoText Sys_Menu Sys_MenuText |
| 304 | Sys_ScrollBar Sys_Window Sys_WindowFrame |
| 305 | Sys_WindowText |
| 306 | |
| 307 | Probably the most useful values are |
| 308 | Sys_Window Normal window background |
| 309 | Sys_WindowText Normal window text |
| 310 | Sys_Highlight Highlighted background |
| 311 | Sys_HighlightText Highlighted text |
| 312 | |
| 313 | These extra colors are also available: |
| 314 | Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet, |
| 315 | |
| 316 | *rgb.txt* |
| 317 | Additionally, colors defined by a "rgb.txt" file can be used. This file is |
| 318 | well known from X11. A few lines from it: > |
| 319 | |
| 320 | 255 218 185 peach puff |
| 321 | 205 133 63 peru |
| 322 | 255 181 197 pink |
| 323 | |
| 324 | This shows the layout of the file: First the R, G and B value as a decimal |
| 325 | number, followed by the name of the color. The four fields are separated by |
| 326 | spaces. |
| 327 | |
| 328 | You can get an rgb.txt file from any X11 distribution. It is located in a |
| 329 | directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the |
| 330 | $VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt". |
| 331 | |
| 332 | ============================================================================== |
| 333 | *gui-w32-dialogs* *dialog* |
| 334 | 6. Windows dialogs & browsers |
| 335 | |
| 336 | The Win32 GUI can use familiar Windows components for some operations, as well |
| 337 | as the traditional interface shared with the console version. |
| 338 | |
| 339 | |
| 340 | 6.1 Dialogs |
| 341 | |
| 342 | The dialogs displayed by the "confirm" family (i.e. the 'confirm' option, |
| 343 | |:confirm| command and |confirm()| function) are GUI-based rather than the |
| 344 | console-based ones used by other versions. The 'c' flag in 'guioptions' |
| 345 | changes this. |
| 346 | |
| 347 | |
| 348 | 6.2 File Browsers |
| 349 | |
| 350 | When prepending ":browse" before file editing commands, a file requester is |
| 351 | used to allow you to select an existing file. See |:browse|. |
| 352 | |
| 353 | |
| 354 | 6.3 Tearoff Menus |
| 355 | |
| 356 | The Win32 GUI emulates Motif's tear-off menus. At the top of each menu you |
| 357 | will see a small graphic "rip here" sign. Selecting it will cause a floating |
| 358 | window to be created with the same menu entries on it. The floating menu can |
| 359 | then be accessed just as if it was the original (including sub-menus), but |
| 360 | without having to go to the menu bar each time. |
| 361 | This is most useful if you find yourself using a command buried in a sub-menu |
| 362 | over and over again. |
| 363 | The tearoff menus can be positioned where you like, and always stay just above |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 364 | the Main Vim window. You can get rid of them by closing them as usual; they |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 365 | also of course close when you exit Vim. |
| 366 | |
| 367 | *:tearoff* *:te* |
| 368 | :te[aroff] {name} Tear-off the menu {name}. The menu named must have at |
| 369 | least one subentry, but need not appear on the |
| 370 | menu-bar (see |win32-hidden-menus|). |
| 371 | |
| 372 | Example: > |
| 373 | :tearoff File |
| 374 | will make the "File" menu (if there is one) appear as a tearoff menu. > |
| 375 | |
| 376 | :amenu ]Toolbar.Make :make<CR> |
| 377 | :tearoff ]Toolbar |
| 378 | This creates a floating menu that doesn't exist on the main menu-bar. |
| 379 | |
| 380 | Note that a menu that starts with ']' will not be displayed. |
| 381 | |
| 382 | ============================================================================== |
| 383 | 7. Command line arguments *gui-w32-cmdargs* |
| 384 | |
| 385 | Analysis of a command line into parameters is not standardised in MS Windows. |
| 386 | Gvim has to provide logic to analyse a command line. This logic is likely to |
| 387 | be different from the default logic provided by a compilation system used to |
| 388 | build vim. The differences relate to unusual double quote (") usage. |
| 389 | The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the |
| 390 | same way. The argument "+/Sch""iller" may be handled different by gvim and |
| 391 | vim, depending what it was compiled with. |
| 392 | |
| 393 | The rules are: |
| 394 | a) A parameter is a sequence of graphic characters. |
| 395 | b) Parameters are separated by white space. |
| 396 | c) A parameter can be enclosed in double quotes to include white space. |
| 397 | d) A sequence of zero or more backslashes (\) and a double quote (") |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 398 | is special. The effective number of backslashes is halved, rounded |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 399 | down. An even number of backslashes reverses the acceptability of |
| 400 | spaces and tabs, an odd number of backslashes produces a literal |
| 401 | double quote. |
| 402 | |
| 403 | So: |
| 404 | " is a special double quote |
| 405 | \" is a literal double quote |
| 406 | \\" is a literal backslash and a special double quote |
| 407 | \\\" is a literal backslash and a literal double quote |
| 408 | \\\\" is 2 literal backslashes and a special double quote |
| 409 | \\\\\" is 2 literal backslashes and a literal double quote |
| 410 | etc. |
| 411 | |
| 412 | Example: > |
| 413 | gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\" |
| 414 | |
| 415 | opens "C:\My Music\freude" and executes the line mode commands: > |
| 416 | set ignorecase; /"foo\ and /bar\" |
| 417 | |
| 418 | ============================================================================== |
| 419 | 8. Various *gui-w32-various* |
| 420 | |
| 421 | *gui-w32-printing* |
| 422 | The "File/Print" menu prints the text with syntax highlighting, see |
| 423 | |:hardcopy|. If you just want to print the raw text and have a default |
| 424 | printer installed this should also work: > |
| 425 | :w >>prn |
| 426 | |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 427 | Vim supports a number of standard MS Windows features. Some of these are |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 428 | detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. |
| 429 | |
| 430 | *drag-n-drop-win32* |
| 431 | You can drag and drop one or more files into the Vim window, where they will |
| 432 | be opened as normal. See |drag-n-drop|. |
| 433 | |
Bram Moolenaar | 8feef4f | 2015-01-07 16:57:10 +0100 | [diff] [blame] | 434 | *:simalt* *:sim* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 435 | :sim[alt] {key} simulate pressing {key} while holding Alt pressed. |
| 436 | {not in Vi} {only for Win32 versions} |
Bram Moolenaar | 8feef4f | 2015-01-07 16:57:10 +0100 | [diff] [blame] | 437 | Note: ":si" means ":s" with the "i" flag. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 438 | |
| 439 | Normally, Vim takes control of all Alt-<Key> combinations, to increase the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 440 | number of possible mappings. This clashes with the standard use of Alt as the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 441 | key for accessing menus. |
| 442 | The quick way of getting standard behavior is to set the 'winaltkeys' option |
| 443 | to "yes". This however prevents you from mapping Alt keys at all. |
| 444 | Another way is to set 'winaltkeys' to "menu". Menu shortcut keys are then |
| 445 | handled by windows, other ALT keys can be mapped. This doesn't allow a |
| 446 | dependency on the current state though. |
| 447 | To get round this, the :simalt command allows Vim (when 'winaltkeys' is not |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 448 | "yes") to fake a Windows-style Alt keypress. You can use this to map Alt key |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 449 | combinations (or anything else for that matter) to produce standard Windows |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 450 | actions. Here are some examples: > |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 451 | |
| 452 | :map <M-f> :simalt f<CR> |
| 453 | This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by |
| 454 | simulating the keystrokes Alt, F. > |
| 455 | :map <M-Space> :simalt ~<CR> |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 456 | This maps Alt-Space to pop down the system menu for the Vim window. Note that |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 457 | ~ is used by simalt to represent the <Space> character. > |
| 458 | :map <C-n> :simalt ~n<CR> |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 459 | Maps Control-N to produce the keys Alt-Space followed by N. This minimizes the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 460 | Vim window via the system menu. |
| 461 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 462 | Note that the key changes depending on the language you are using. |
| 463 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 464 | *intellimouse-wheel-problems* |
| 465 | When using the Intellimouse mouse wheel causes Vim to stop accepting input, go |
| 466 | to: |
| 467 | ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions |
| 468 | |
| 469 | And add gvim to the list of applications. This problem only appears to happen |
| 470 | with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on. |
| 471 | |
Bram Moolenaar | 9b45125 | 2012-08-15 17:43:31 +0200 | [diff] [blame] | 472 | |
| 473 | XPM support *w32-xpm-support* |
| 474 | |
| 475 | Gvim can be build on MS-Windows with support for XPM files. |+xpm_w32| |
| 476 | See the Make_mvc.mak file for instructions, search for XPM. |
| 477 | |
| 478 | To try out if XPM support works do this: > |
| 479 | :help |
| 480 | :exe 'sign define vimxpm icon=' . $VIMRUNTIME . '\\vim16x16.xpm' |
| 481 | :exe 'sign place 1 line=1 name=vimxpm file=' . expand('%:p') |
| 482 | < |
| 483 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 484 | vim:tw=78:sw=4:ts=8:ft=help:norl: |