neovim-dot-app
neovim-dot-app copied to clipboard
Add preference to open files in new tabs
Fixes #182. Adds a "MacSetOpenFilePreference" vim function, which sends a "neovim.app.setOpenFilePreference" message to the GUI. If the argument to the function is "new-tab", files dragged to the app/used via "open with" or gnvim will open in new tabs; if it's "new window", a new window will open and the files will be opened in tabs in that window.
Hi, thanks for this. It's a substantial PR so I'm going to give it some testing before merging.
Code all looks good — one thing I did notice is your use of NSUserDefaults
. Is this necessary? (Haven't tested yet, so it might be). Usually these MacDoWhatever()
functions which change app state only do so for the current session; to make the change permanent a user just puts the call in their .vimrc.
Right now in the code, user-defaults are only used for a couple of things:
- Font choices made through the GUI font picker
- Window size in character cells
These are both things that the app needs to be able to write to, and, for consistency, I'd prefer the tab preference not to use user-defaults unless it needs to. Happy to be convinced otherwise.
I don't have a preference either way about how to keep track of this kind of setting. Is there an existing application-level data store that would be better, or would you rather just use an instance variable in AppDelegate?
+1 for this feature
@rolandcrosby I'd rather have the instance variable if your code would still work, just for consistency because most app state is in instance vars right now (see view.mm) though of course this var would need to be app-level.
+1 for this feature as well, and a request: MacVim lets you add the file to the arglist and make it the current buffer. That would be my preference, I don't like having too many tabs open.
Any updates on this?
It just needs that NSUserDefaults change and it can go in.