neovim-dot-app icon indicating copy to clipboard operation
neovim-dot-app copied to clipboard

Add preference to open files in new tabs

Open rolandcrosby opened this issue 9 years ago • 7 comments

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.

rolandcrosby avatar Dec 28 '15 21:12 rolandcrosby

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.

rogual avatar Jan 07 '16 22:01 rogual

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?

rolandcrosby avatar Jan 07 '16 22:01 rolandcrosby

+1 for this feature

james2doyle avatar Jan 11 '16 04:01 james2doyle

@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.

rogual avatar Jan 11 '16 11:01 rogual

+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.

OskarSigvardsson avatar Feb 09 '16 22:02 OskarSigvardsson

Any updates on this?

afshinm avatar Sep 04 '17 14:09 afshinm

It just needs that NSUserDefaults change and it can go in.

rogual avatar Sep 05 '17 15:09 rogual