Vim terminals use tlmenu to specify menu items and the normal `amenu`
doesn't work. This causes functionality such as toggling full screen and
going to next/prev tab to not work in terminal mode. Fix that by adding
the proper tlmenu mapping to the appropriate items.
Fix#1045
Problem: Buffer menu does not handle special buffers properly.
Solution: Keep a dictionary with buffer names to reliably keep track of
entries.
Also trigger BufFilePre and BufFilePost for command-line and
terminal buffers when the name changes.
Currently, when using special buffers like terminals / command-line
window / quickfix / location list, these buffers will get added to the
"Buffers" menu, but they don't get removed when the buffers are gone,
leaving stale menu items. Fix buffer menu to be more robust.
1. Currently the buffer menu works by using the buffer name to
add/remove the entries, but it's error-prone because the buffer could
have been renamed under-the-hood. While it uses BufFilePre/Post
autocommands to handle normal buffer renames, it doesn't work for the
command-line window (accessible via `q:`) which gets renamed without
sending the autocommand. Instead, change the menus to cached a
dictionary a bufnum -> menu name, so it will always know how to
remove a buffer from itself.
2. Add BufFilePre/Post autocommands to command-line windows when it
changes the buffer name to "[Command Line]".
3. Add BufFilePre/Post autocommands to terminal windows when it
changes the buffer name to the command, e.g. "!/bin/zsh".
Either (1) or (2)+(3) will fix the issue, but just doing all of them as
this seems like the right thing to do (2 + 3) also means the menu items
show the correct names instead of just saying "[No Name]".
This doesn't fix the following which needs to be fixed later:
1. Quickfix and Location List don't send BufDeleted autocmds. This leads
to them also leaving stale buffer menu items as there's no way for
the script to know that those buffers are gone.
Also add unit tests for cmdline-win / terminal buffer menus
Note: This fix misc test_cmdline failures in MacVim due to the menu item
not being able to be removed.
This is a duplicate of vim/vim#5787
Cmd-E (Edit -> Use Selection for Find") in most macOS apps follow the
convention that it shares to the system Find Pasteboard, while Cmd-G
uses the Find Pasteboard to find the next item. Make Cmd-E always do
that even if MMShareFindPboard is set to NO. This way, normal searches
in Vim wouldn't pollute the system find pasteboard, but could still have
a way to share to it by using this action.
MMShareFindPboard is supposed to prevent MacVim from updating the system
find pasteboard when searching, but the previous behavior was that it
would only set the Vim-specific format to the find pasteboard so you
could still share search patterns across Vim windows but it has the
effect of clearing the global find pasteboard. Just fix that by making
MacVim not touch the system find pasteboard at all when
MMShareFindPboard is set to NO to respect user's wish. Cmd-G will still
use the system find pasteboard to make it easy to search in another
macOS program and jump to Vim. The user can always use `n` instead if
that's not desired.
Also update docs to make this clear, and rename all "OS X" to "macOS" to
keep up with the times.
Close#773
Enabled states now work. E.g. a mapped Touch Bar button using "vmenu
TouchBar.DoStuff <nop>" will not show up in normal mode.
Also support specifying default Apple template icons. E.g. "an
icon=NSTouchBarListViewTemplate TouchBar.ShowList <Nop>"
Remove default TouchBar buttons as there were too many of them and most
of them are unlikely to be heavily used as there are direct Vim command
equivalent. Instead just add a single fullscreen toggle button. This can
be changed later.
Problem: Initializing menus can be slow, especially when there are many
keymaps, color schemes, etc.
Solution: Do the globbing for runtime files lazlily. (Ken Takata)
Added three window level functions to MMAppController. These allow the
window to float on top, stay on bottom or revert back to normal status.
I have also added the commands to the Actions.plist. The commands were
added using the menu.vim file.
Currently, in order to populate the Edit > Color Scheme menu, MacVim searches
for color schemes only in the paths defined in `runtimepath`. Since MacVim is
compiled with `+packages`, it makes sense to also look for color schemes under
`packpath`. This commit addresses this deficiency.
Note that color schemes may be found below `pack/*/opt` or
`pack/*/start` (see `:h pack-add`): `:colorscheme` searches both
locations.