diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-30 17:17:27 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-01 10:17:39 +0800 |
commit | 015778a3817178a8fdc1150ef1b0eaa3dde776f1 (patch) | |
tree | 5675fea3870277dd861333ac01dac494d797d7e9 /runtime | |
parent | 5551a29d065d8b6632b61f327f22da9166c8f9c6 (diff) | |
download | rneovim-015778a3817178a8fdc1150ef1b0eaa3dde776f1.tar.gz rneovim-015778a3817178a8fdc1150ef1b0eaa3dde776f1.tar.bz2 rneovim-015778a3817178a8fdc1150ef1b0eaa3dde776f1.zip |
vim-patch:8.1.0487: no menus specifically for the terminal window
Problem: No menus specifically for the terminal window.
Solution: Add :tlmenu. (Yee Cheng Chin, closes vim/vim#3439) Add a menu test.
https://github.com/vim/vim/commit/4c5d815256099b50eca2ec5bf8f9aaa67a890211
ADDR_OHTER comes from patch 8.1.1241, which has already been ported.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/delmenu.vim | 1 | ||||
-rw-r--r-- | runtime/doc/autocmd.txt | 5 | ||||
-rw-r--r-- | runtime/doc/gui.txt | 22 | ||||
-rw-r--r-- | runtime/doc/index.txt | 11 | ||||
-rw-r--r-- | runtime/doc/nvim_terminal_emulator.txt | 3 | ||||
-rw-r--r-- | runtime/doc/usr_42.txt | 3 | ||||
-rw-r--r-- | runtime/menu.vim | 3 | ||||
-rw-r--r-- | runtime/syntax/vim.vim | 2 |
8 files changed, 39 insertions, 11 deletions
diff --git a/runtime/delmenu.vim b/runtime/delmenu.vim index 5c20290152..040cc09aa9 100644 --- a/runtime/delmenu.vim +++ b/runtime/delmenu.vim @@ -5,6 +5,7 @@ " Last Change: 2019 Dec 10 aunmenu * +tlunmenu * unlet! g:did_install_default_menus unlet! g:did_install_syntax_menu diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index bf231044a0..59e5c078a3 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -727,13 +727,14 @@ MenuPopup Just before showing the popup menu (under the right mouse button). Useful for adjusting the menu for what is under the cursor or mouse pointer. - The pattern is matched against a single - character representing the mode: + The pattern is matched against one or two + characters representing the mode: n Normal v Visual o Operator-pending i Insert c Command line + tl Terminal *ModeChanged* ModeChanged After changing the mode. The pattern is matched against `'old_mode:new_mode'`, for diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 4205362484..b3b8b2d2c0 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -195,6 +195,10 @@ the mouse button down on this will pop up a menu containing the item "Big Changes", which is a sub-menu containing the item "Delete All Spaces", which when selected, performs the operation. +To create a menu for terminal mode, use |:tlmenu| instead of |:tmenu| unlike +key mapping (|:tmap|). This is because |:tmenu| is already used for defining +tooltips for menus. See |terminal-input|. + Special characters in a menu name: & The next character is the shortcut key. Make sure each @@ -214,9 +218,9 @@ this menu can be used. The second part is shown as "Open :e". The ":e" is right aligned, and the "O" is underlined, to indicate it is the shortcut. *:am* *:amenu* *:an* *:anoremenu* -The ":amenu" command can be used to define menu entries for all modes at once. -To make the command work correctly, a character is automatically inserted for -some modes: +The ":amenu" command can be used to define menu entries for all modes at once, +expect for Terminal mode. To make the command work correctly, a character is +automatically inserted for some modes: mode inserted appended ~ Normal nothing nothing Visual <C-C> <C-\><C-G> @@ -469,6 +473,16 @@ Executing Menus *execute-menus* insert-mode menu Eg: > :emenu File.Exit +:[range]em[enu] {mode} {menu} Like above, but execute the menu for {mode}: + 'n': |:nmenu| Normal mode + 'v': |:vmenu| Visual mode + 's': |:smenu| Select mode + 'o': |:omenu| Operator-pending mode + 't': |:tlmenu| Terminal mode + 'i': |:imenu| Insert mode + 'c': |:cmenu| Cmdline mode + + You can use :emenu to access useful menu items you may have got used to from GUI mode. See 'wildmenu' for an option that works well with this. See |console-menus| for an example. @@ -547,6 +561,8 @@ See section |42.4| in the user manual. :tu[nmenu] {menupath} Remove a tip for a menu or tool. {only in X11 and Win32 GUI} +Note: To create menus for terminal mode, use |:tlmenu| instead. + When a tip is defined for a menu item, it appears in the command-line area when the mouse is over that item, much like a standard Windows menu hint in the status bar. (Except when Vim is in Command-line mode, when of course diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 279645009b..25b98ae4ab 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1622,17 +1622,20 @@ tag command action ~ |:tjump| :tj[ump] like ":tselect", but jump directly when there is only one match |:tlast| :tl[ast] jump to last matching tag -|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode -|:tmap| :tma[p] like ":map" but for Terminal-Job mode +|:tlmenu| :tlm[enu] add menu for |Terminal-mode| +|:tlnoremenu| :tln[oremenu] like ":noremenu" but for |Terminal-mode| +|:tlunmenu| :tlu[nmenu] remove menu for |Terminal-mode| +|:tmapclear| :tmapc[lear] remove all mappings for |Terminal-mode| +|:tmap| :tma[p] like ":map" but for |Terminal-mode| |:tmenu| :tm[enu] define menu tooltip |:tnext| :tn[ext] jump to next matching tag -|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode +|:tnoremap| :tno[remap] like ":noremap" but for |Terminal-mode| |:topleft| :to[pleft] make split window appear at top or far left |:tprevious| :tp[revious] jump to previous matching tag |:trewind| :tr[ewind] jump to first matching tag |:try| :try execute commands, abort on error or exception |:tselect| :ts[elect] list matching tags and select one -|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode +|:tunmap| :tunma[p] like ":unmap" but for |Terminal-mode| |:tunmenu| :tu[nmenu] remove menu tooltip |:undo| :u[ndo] undo last change(s) |:undojoin| :undoj[oin] join next change with previous undo block diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index a4c25009a9..487ccdb0c5 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -80,6 +80,9 @@ To use `ALT+{h,j,k,l}` to navigate windows from any mode: > :nnoremap <A-k> <C-w>k :nnoremap <A-l> <C-w>l +You can also create menus similar to terminal mode mappings, but you have to +use |:tlmenu| instead of |:tmenu|. + Mouse input has the following behavior: - If the program has enabled mouse events, the corresponding events will be diff --git a/runtime/doc/usr_42.txt b/runtime/doc/usr_42.txt index ff3ae7057a..470f4e0fe5 100644 --- a/runtime/doc/usr_42.txt +++ b/runtime/doc/usr_42.txt @@ -150,7 +150,8 @@ like the variations on the ":map" command: :menu! Insert and Command-line mode :imenu Insert mode :cmenu Command-line mode - :amenu All modes + :tlmenu Terminal mode + :amenu All modes (except for Terminal mode) To avoid that the commands of a menu item are being mapped, use the command ":noremenu", ":nnoremenu", ":anoremenu", etc. diff --git a/runtime/menu.vim b/runtime/menu.vim index 956b941971..e20720dbd2 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -164,6 +164,9 @@ if exists(':tlmenu') endif nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+ +if exists(':tlmenu') + tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+ +endif exe 'vnoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['v'] exe 'inoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['i'] nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 3a5b6b6418..6353a40d6a 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -411,7 +411,7 @@ syn case match " Menus: {{{2 " ===== syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod -syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList +syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName syn match vimMenuNameMore "\c\\\s\|<tab>\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation |