📄 gui.txt
字号:
> :80menu Buffer.next :bn<CR>The default menus have these priorities: File 10 Edit 20 Tools 40 Syntax 50 Buffers 60 Window 70 Help 9999When no or zero priority is given, 500 is used.The priority for the PopUp menu is not used.You can use a priority higher than 9999, to make it go after the Help menu,but that is non-standard and is discouraged. The highest possible priority isabout 32000. The lowest is 1. *sub-menu-priority*The same mechanism can be used to position a sub-menu. The priority is thengiven as a dot-separated list of priorities, before the menu name:> :menu 80.500 Buffer.next :bn<CR>Giving the sub-menu priority is only needed when the item is not to be putin a normal position. For example, to put a sub-menu before the other items:> :menu 80.100 Buffer.first :brew<CR>Or to put a sub-menu after the other items, and further items with defaultpriority will be put before it:> :menu 80.900 Buffer.last :blast<CR>When a number is missing, the default value 500 will be used:> :menu .900 myMenu.test :echo "text"<CR>The menu priority is only used when creating a new menu. When it alreadyexisted, e.g., in another mode, the priority will not change. Thus, thepriority only needs to be given the first time a menu is used.An exception is the PopUp menu. There is a separate menu for each mode(Normal, Op-pending, Visual, Insert, Cmdline). The order in each of thesemenus can be different. This is different from menu-bar menus, which havethe same order for all modes.NOTE: sub-menu priorities currently don't work for all versions of the GUI. *gui-toolbar*Currently, the toolbar is only available in the Win32 and GTK+ (X11) GUI. Itshould turn up in other GUIs in due course. Sample toolbar definitions aregiven in menu.vim. The display of the toolbar is controlled by the'guioptions' letter 'T'. You can thus have menu & toolbar together, or eitheron its own, or neither.The toolbar is defined as a special menu called ToolBar, which only has onelevel. Vim interprets the items in this menu as follows:1) An item called 'BuiltIn##', where ## is a number, is taken as number ## of the built-in bitmaps available in Vim. Currently there are 28, numbered from 0 to 27, which cover most common editing operations |builtin-tools|.2) An item with another name is first searched for in the directory $VIM/bitmaps. If found, the bitmap file is used as the toolbar button image. Note that the exact filename is OS-specific: For example, under Win32 the command> :amenu ToolBar.Hello :echo "hello"<CR> would search for the file 'hello.bmp'. Under GTK+/X11 it is 'Hello.xpm'. Loading a custom bitmap is only supported on W95, NT4, and GTK+. The bitmap is scaled to fit the button in Win32, but not GTK+. For GTK+, the size of the default pixmaps used is 20 by 20 pixels.3) If the bitmap is not found in $VIM/bitmaps, Vim checks for a match against its list of built-in names. Each built-in button image has a name. So the command> :amenu ToolBar.Open :e will show the built in "open a file" button image if no open.bmp exists. All the built-in names can be seen used in menu.vim.4) If all else fails, a blank, but functioning, button is displayed. *builtin-tools*nr Name Normal action ~00 New open new window01 Open browse for file to open in current window02 Save write buffer to file03 Undo undo last change04 Redo redo last undone change05 Cut delete selected text to clipboard06 Copy copy selected text to clipboard07 Paste paste text from clipboard08 Print print current buffer09 Help open a buffer on Vim's builtin help10 Find start a search command11 SaveAll write all modified buffers to file12 SaveSesn write session file for current situation13 NewSesn write new session file14 LoadSesn load session file15 RunScript browse for file to run as a Vim script16 Replace prompt for substitute command17 WinClose close current window18 WinMax make current window use many lines19 WinMin make current window use few lines20 WinSplit split current window21 Shell start a shell22 FindPrev search again, backward23 FindNext search again, forward24 FindHelp prompt for word to search help for25 Make run make and jump to first error26 TagJump jump to tag under the cursor27 RunCtags build tags for files in current directory *win32-hidden-menus*In the Win32 GUI, starting a menu name with ']' excludes that menu from themain menu bar. You must then use the |:tearoff| command to display it. *popup-menu*In the Win32, GTK, Motif and Athena GUI, you can define the special menu"PopUp". This is the menu that is displayed when the right mouse button ispressed, if 'mousemodel' is set to popup or popup_setpos.5.3 Showing What Menus Are Mapped To *showing-menus*To see what an existing menu is mapped to, use just one argument after themenu commands (just like you would with the ":map" commands). If the menuspecified is a submenu, then all menus under that hierarchy will be shown.If no argument is given after :menu at all, then ALL menu items are shownfor the appropriate mode (eg, Command-line mode for :cmenu).Note that hitting <Tab> while entering a menu name after a menu command maybe used to complete the name of the menu item.5.4 Executing Menus *execute-menus* *:eme* *:emenu*To manually execute a menu item from the command line, use the :emenucommand. Eg:> :emenu File.ExitThe normal mode command associated with the menu is executed (since thatis normally the one you want.)If the console-mode vim has been compiled with WANT_MENU defined, you canuse :emenu to access useful menu items you may have got used to from GUImode. See 'wildmenu' for an option that works well with this. See|console-menus| for an example.5.5 Deleting Menus *delete-menus* *:unme* *:unmenu* *:aun* *:aunmenu* *:nunme* *:nunmenu* *:ounme* *:ounmenu* *:vunme* *:vunmenu* *:iunme* *:iunmenu* *:cunme* *:cunmenu*To delete a menu item or a whole submenu, use the unmenu commands, which areanalogous to the unmap commands. Eg: :unmenu! Edit.PasteThis will remove the Paste item from the Edit menu for Insert andCommand-line modes.Note that hitting <Tab> while entering a menu name after an umenu commandmay be used to complete the name of the menu item for the appropriate mode.To remove all menus use: *:unmenu-all*> :unmenu * " remove all menus in Normal and visual mode> :unmenu! * " remove all menus in Insert and Command-line mode5.6 Examples for Menus *menu-examples*Here is an example on how to add menu items with menu's! You can add a menuitem for the keyword under the cursor. The register "z" is used.> :nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR>> :nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR>> :vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR>> :vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR>> :imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a> :imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a(the rhs is in <> notation, you can copy/paste this text to try out themappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" isthe <CR> key. |<>|)Tooltips & Menu tipsThese are currently only supported for the Win32 GUI. However, they shouldappear for the other gui platforms in the not too distant future. *:tmenu* *:tm*:tm[enu] {menupath} {rhs} Define a tip for a menu or tool. {only in GTK+ and Win32 GUI}:tm[enu] [menupath] List menu tips. {only in GTK+ and Win32 GUI}A "tip" can be defined for each menu item. For example, after defining an itemlike this:> :amenu MyMenu.Hello :echo "Hello"<CR>The tip is defined like this:> :tmenu MyMenu.Hello Displays a greeting.When a tip is defined for a menu item, it appears in the command-line areawhen the mouse is over that item, much like a standard Windows menu hint inthe status bar. (Except when Vim is in Command-line mode, when of coursenothing is displayed.)When a tip is defined for a toolbar item, it appears as a tooltip when themouse pauses over that button, in the usual fashion.The ":tmenu" command works just like other menu commands, it uses the samearguments. *:tunmenu* *:tu*:tu[nmenu] {menupath} Remove a tip for a menu or tool. {only in GTK+ and Win32 GUI}:tunmenu deletes an existing menu tip, in the same way as the other unmenucommands. Example:> :tunmenu MyMenu.HelloIf a menu item becomes invalid (i.e. its actions in all modes are deleted) Vimdeletes the menu tip (and the item) for you. This means that :aunmenu deletesa menu item - you don't need to do a :tunmenu as well.==============================================================================6. Extras *gui-extras*This section describes other features which are related to the GUI.- With the GUI, there is no wait for one second after hitting escape, because the key codes don't start with <Esc>.- Typing ^V followed by a special key in the GUI will insert "<Key>", since the internal string used is meaningless. Modifiers may also be held down to get "<Modifiers-Key>".- In the GUI, the modifiers SHIFT, CTRL, and ALT (or META) may be used within mappings of special keys and mouse events. eg: :map <M-LeftDrag> <LeftDrag>- In the GUI, several normal keys may have modifiers in mappings etc, these are <Space>, <Tab>, <NL>, <CR>, <Esc>.==============================================================================7. Shell Commands *gui-shell*For the X11 GUI the external commands are executed inside the gvim window.See |gui-pty|.WARNING: Executing an external command from the X11 GUI will not alwayswork. "normal" commands like "ls", "grep" and "make" mostly work fine.Commands that require an intelligent terminal like "less" and "ispell" won'twork. Some may even hang and need to be killed from another terminal. So becareful!For the Win32 GUI the external commands are executed in a separate window.See |gui-shell-win32|. vim:tw=78:ts=8:sw=4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -