📄 gui_w32.txt
字号:
*gui_w32.txt* For Vim version 5.8. Last change: 2000 Jun 02 VIM REFERENCE MANUAL by Bram MoolenaarVim's Graphical User Interface *gui-w32* *win32-gui*1. Starting the GUI |gui-w32-start|2. Vim as default editor |vim-default-editor|3. Using the clipboard |gui-clipboard|4. Shell Commands |gui-shell-win32|5. Special colors |win32-colors|6. Windows dialogs & browsers |gui-w32-dialogs|7. Various |gui-w32-various|Other relevant documentation:|gui.txt| For generic items of the GUI.|os_win32.txt| For Win32 specific items.{Vi does not have a Windows GUI}==============================================================================1. Starting the GUI *gui-w32-start*The Win32 GUI version of Vim will always start the GUI, no matter how youstart it or what it's called.The GUI will always run in the Windows subsystem. Mostly shells automaticallyreturn with a command prompt after starting gvim. If not, you should use the"start" command:> start gvim [options] file ..Note: All fonts (bold, italic) must be of the same size!!! If you don't dothis, text will disappear or mess up the display. Vim does not check the fontsizes. It's the size in screen pixels that must be the same. Note that somefonts that have the same point size don't have the same pixel size!Additionally, the positioning of the fonts must be the same (ascent anddescent).The Win32 GUI has an extra menu item: "Window/Select Font". It brings up thestandard Windows font selector.Setting the menu height doesn't work for the Win32 GUI. *gui-win32-maximized*If you want Vim to start with a maximized window, add this command to yourvimrc or gvimrc file:> au GUIEnter * simalt ~x *gui-w32s*There is a specific version of gvim.exe that runs under the Win32s subsystemof Windows 3.1 or 3.11. See |win32s|.==============================================================================2. Vim as default editor *vim-default-editor*To set Vim as the default editor for a file type:1. Start a Windows Explorer2. Chose View/Options -> File Types3. Select the path to gvim for every file type that you want to use it for. (you can also use three spaces in the file type field, for files without an extension). In the "open" action, use:> gvim "%1" The quotes are required for using file names with embedded spaces. You can also use this:> gvim "%L" This should avoid short (8.3 character) file names in some situations. But I'm not sure if this works everywhere.When you open a file in Vim by double clicking it, Vim changes to thatfile's directory.If you want Vim to start full-screen, use this for the Open action:> gvim -c "simalt ~x" "%1"Another method, which also works When you put Vim in another directory (e.g.,when you have got a new version):1. select a file you want to use Vim with2. <Shift-F10>3. select "Open With..." menu entry4. click "Other..."5. browse to the (new) location of Vim and click "Open"6. make "Always Use this program..." checked7. <OK> *send-to-menu* *sendto*You can also install Vim in the "Send To" menu:1. Start a Windows Explorer2. Navigate to your sendto directory: Windows 95: %windir%\sendto (e.g. "c:\windows\sendto") Windows NT: %windir%\profiles\%user%\sendto (e.g. "c:\winnt\profiles\mattha\sendto").3. Right-click in the file pane and select New->Shortcut4. Follow the shortcut wizard, using the full path to VIM/GVIM.When you 'send a file to Vim', Vim changes to that file's directory. Note,however, that any long directory names will appear in their short (MS-DOS)form. This is a limitation of the Windows "Send To" mechanism. *notepad*You could replace notepad.exe with gvim.exe, but that has a few side effects.For example, some programs rely on notepad arguments, which are not recognizedby Vim. And Vim uses notepad for printing. You could fix that by adjustingthe File/Print menu item, but if other applications also use notepad forprinting, that will fail. It's better to leave notepad where it is and useanother way to start Vim. *win32-popup-menu*A more drastic approach is to install an "Edit with Vim" entry in the popupmenu for the right mouse button. With this you can edit any file with Vim.This can co-exist with the file associations mentioned above. The differenceis that the file associations will make starting Vim the default action. Withthe "Edit with Vim" menu entry you can keep the existing file association fordouble clicking on the file, and edit the file with Vim when you want. Forexample, you can associate "*.mak" with your make program. You can executethe makefile by double clicking it and use the "Edit with Vim" entry to editthe makefile.You can select any files and right-click to see a menu option called "Editwith gvim". Chosing this menu option will invoke gvim with the file you haveselected. If you select multiple files, you will find two gvim-related menuoptions:"Edit with multiple gvims" -- one gvim for each file in the selection"Edit with single gvim" -- one gvim for all the files in the selection *install-registry*You can add the "Edit with Vim" menu entry in an easy way by using the"install.exe" program. It will add several registry entries for you.You can also do this by hand. This is complicated! Use the install.exe ifyou can.1. Start the registry editor with "regedit".2. Add these keys: key value name value ~ HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99} {default} Vim Shell Extension HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32 {default} {path}\gvimext.dll ThreadingModel Apartment HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim {default} {51EEE242-AD87-11d3-9C1E-0090278BBD99} HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved {51EEE242-AD87-11d3-9C1E-0090278BBD99} Vim Shell Extension HKEY_LOCAL_MACHINE\Software\Vim\Gvim path {path}\gvim.exe HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6 DisplayName Vim 5.6: Edit with Vim popup menu entry UninstallString {path}\uninstal.exe Replace {path} with the path that leads to the executable. Don't type {default}, this is the value for the key itself.To remove "Edit with Vim" from the popup menu, just remove the registryentries mentioned above. The "uninstal.exe" program can do this for you. Youcan also use the entry in the Windows standard "Add/Remove Programs" list.If you notice that this entry overrules other file type associations, setthose associations again by hand (using Windows Explorer, see above). Thisonly seems to happen on some Windows NT versions (Windows bug?). Procedure:1. Find the name of the file type. This can be done by starting the registry editor, and searching for the extension in \\HKEY_CLASSES_ROOT2. In a Windows Explorer, use View/Options/File Types. Search for the file type in the list and click "Edit". In the actions list, you can select on to be used as the default (normally the "open" action) and click on the "Set Default" button.==============================================================================3. Using the clipboard *gui-clipboard*Windows has a clipboard, where you can copy text to, and paste text from. Vimsupports this in several ways. For other systems see |gui-selections|.The "* register reflects the contents of the clipboard. |quotestar|When the "unnamed" string is included in the 'clipboard' option, the unnamedregister is the same. Thus you can yank to and paste from the clipboardwithout prepending "* to commands.The 'a' flag in 'guioptions' is not included by default. This means that textis only put on the clipboard when an operation is performed on it. JustVisually selecting text doesn't put it on the clipboard. When the 'a' flag isincluded, the text is copied to the clipboard even when it is not operatedupon.To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the$VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file:> source $VIMRUNTIME/mswin.vimSince CTRL-C is used to copy the text to the clipboard, it can't be used tocancel an operation. Use CTRL-Break for that. *CTRL-V-alternative*Since CTRL-V is used to paste, you can't use it to start a blockwise Visualselection. You can use CTRL-Q instead. You can also use CTRL-Q in Insertmode and Command-line mode to get the old meaning of CTRL-V.NOTE: The clipboard support still has a number of bugs. See |todo|.==============================================================================4. Shell Commands *gui-shell-win32*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -