Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preference to open files in new tabs #197

Closed
wants to merge 1 commit into from
Closed

Add preference to open files in new tabs #197

wants to merge 1 commit into from

Conversation

rolandcrosby
Copy link

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.

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.
@rogual
Copy link
Owner

rogual commented Jan 7, 2016

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.

@rolandcrosby
Copy link
Author

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?

@james2doyle
Copy link
Contributor

+1 for this feature

@rogual
Copy link
Owner

rogual commented Jan 11, 2016

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

@OskarSigvardsson
Copy link

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

@afshinm
Copy link

afshinm commented Sep 4, 2017

Any updates on this?

@rogual
Copy link
Owner

rogual commented Sep 5, 2017

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

@bfulkers bfulkers mentioned this pull request Mar 11, 2019
@rolandcrosby rolandcrosby closed this by deleting the head repository Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants