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