Closed jbyler closed 1 year ago
You mean this dialog box right?
The dialog box is technically navigable using the keyboard:
:h macvim-dialogs
, but the docs is slightly outdated by suggesting you toggle "Full keyboard access" instead)
a. Also, the "Don't Save" button in other dialog boxes can be accessed by doing Cmd-Delete or Cmd-D (this is common in macOS apps). For (2) I have been experimenting with different options to show the key associated with a button, either by manually displaying it as "(E)dit anyway", or find some other ways to show it. I'm still debating different options (since they also need to work with localized texts).
Don't use a macOS dialog at all; just make it work like Vim does, with the focus staying inside the main window, waiting for a key press.
There is already an option to do that: set guioption+=c
.
Hah, thanks so much @ychin, apologies for wasting your time!
System Settings full keyboard access: yes, this worked. (I had this on previously, but somehow it got switched off. Should have confirmed before filing a feature request. Oops!)
Each key is bound to a shortcut key: yes, this worked also. I really thought I had tried doing exactly this right before I filed the feature request, but I must have tried with the ⌘ key or something. I do think there's a discoverability problem with this feature, but it sounds like you're aware of and working on that. I think the difficulty comes from the fact that it's a native macOS dialog, but it's behaving in a vim-like but un-Mac-like way. You could make it look more like a menu: left-justified names, with right-justified keyboard shortcuts?
Open Read-Only ⏎
Edit anyway ⌘E
Recover ⌘R
Quit ⌘Q
Abort ⌘A
This one is my preferred option, and I'm going to use this going forward. I like how it doesn't mix Vim and macOS metaphors, so it feels natural and easy to understand. One correction: there's a typo in your message (guioptions
not guioption
). Here's what I'm putting in my ~/.vimrc
in case others find this issue and want to use it:
if has('gui_running')
set guioptions+=c
else
Thanks so much for your response, and again my apologies, since this is all there and documented!
You could make it look more like a menu: left-justified names, with right-justified keyboard shortcuts?
It's not that easy to do because it would look quite weird on a button. macOS just doesn't give you a good spot to show the "key equivalent" (which is their technical term for the shortcut key) on a button. On the menu it just shows it on the right like you suggested though (e.g. Edit->Copy menu shows "⌘C" on the right). But I'll think about how to surface it more.
if has('gui_running') set guioptions+=c else
I think it's better to do has('gui')
if you want this applied for all GUIs (e.g. GVim on Windows) or has('gui_macvim')
if only for MacVim.
Reason this is better than has('gui_running')
is that sometimes you could launch MacVim GUI from terminal by running the :gui
command. If you do this, your guioptions
wouldn't be set correctly because "gui_running" will be 0 when Vim first parsed the config files.
Summary
I mostly love how MacVim integrates vim into the macOS environment, but one rough edge is how I can't interact with the "VIM - ATTENTION // Swap file "ABC.swp" already exists!" dialog using the keyboard. The request is pretty general: I just want some way to make a choice in the dialog without using the mouse.
Options I can think of:
I personally have a slight preference for #3 (it's vim, after all) but any way to make a choice without using the mouse with make me happy.
How to reproduce:
MacVim.app/Contents/bin/mvim
Alternate reproduction steps:
:e
ex command.Expected:
Actual:
Workaround
Don't use the
MacVim.app/Contents/bin/mvim
script. Instead, open files in MacVim by usingopen -a MacVim
.