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

[Feature Request] Open as new tab instead of new pane #26

Open
DanielPower opened this issue Feb 5, 2018 · 19 comments
Open

[Feature Request] Open as new tab instead of new pane #26

DanielPower opened this issue Feb 5, 2018 · 19 comments

Comments

@DanielPower
Copy link

In many cases, it would be preferrable to open a file in a new tab over the previously selected pane rather than opening a whole new pane. Perhaps by using Shift+Tab instead of just Tab, or some other keyboard shortcut.

@sum01
Copy link
Collaborator

sum01 commented Feb 5, 2018

Shouldn't be too hard, but note that when the file opens it will leave the tree view in the previous tab.

@sum01
Copy link
Collaborator

sum01 commented Feb 15, 2018

I found the potential function to do this, NewTabFromView in tabs.go, but the various methods I've tried to use it all fail. I've asked about it in Micro's Gitter, so until I get an answer this is on hold. Sorry.

@sc0ttj
Copy link

sc0ttj commented Oct 24, 2018

@sum01
Is the OpenFileTab() func in this PR any use? zyedidia/micro#963

@sum01
Copy link
Collaborator

sum01 commented Oct 25, 2018

It might be. Zyedidia's suggestion on how to open a new tab with a prompt could work as well, although have no idea if it requires user input or not.

@franzflasch
Copy link

Please could someone add this feature? This would almost feel like sublime in the console, if it had this feature.

@ghost
Copy link

ghost commented Nov 29, 2018

@franzflasch

      Please could someone add this feature? This would almost feel like sublime in the console, if it had this feature.

check github.com/rvi64/files-plugin

@franzflasch
Copy link

great! will have a look at it!

@karl-gustav
Copy link

I would rather have it as filemanager-openintab rather than a keyboard shortcut. I know of no other editor that opens a split if you click the files in the tree view...

@karl-gustav
Copy link

@ghost

github.com/rvi64/files-plugin

This link is dead (the entire github user is 404), is it moved?

@sum01
Copy link
Collaborator

sum01 commented Sep 9, 2019

@karl-gustav That's what happens when someone deletes their github account. Renames them ghost & all their repos go poof.

@karl-gustav
Copy link

@sum01 oh ಠ_ಠ, thanks for the info!
@franzflasch Did you download a copy of the repo before @rvi64 deleted his account?

@franzflasch
Copy link

@karl-gustav Unfortunately not. Must have been deleted on my last cleanup. :(

@sc0ttj
Copy link

sc0ttj commented Dec 30, 2019

This PR gives plugins access to View: zyedidia/micro#1231

So then if that was merged, then maybe something like this might work?

https://github.com/sc0ttj/filemanager-plugin/pull/1/files?utf8=%E2%9C%93&diff=unified&w=1

@sum01
Copy link
Collaborator

sum01 commented Dec 31, 2019

@sc0ttj Looks good I suppose. One note, however, is that you wouldn't really want to change that function. That would make everything you open go to a new tab, which isn't the desired outcome.

If/when that PR goes through, you'd want to add a new function and a way to trigger it (i.e. with a different keybinding) to open files in a new tab. The original issue poster mentioned using Shift-tab, for example.

Either that, or you'd add a parameter that allows the function to do either, and then detect the keybind in any place where that function is used.

I think the former is the better of the two options, as it's a lot easier.

@simonvanderveldt
Copy link

simonvanderveldt commented Jun 8, 2020

Does anyone know how to do this? The issue linked (zyedidia/micro#1231) has been closed because micro v2 was released but I don't know what's changed in v2 that would allow implementing this functionality.

@sum01 regarding the addition of a new function or a parameter I'd just default to opening in a new tab because that's how AFAIK all editors which have a treeview work.

@sum01
Copy link
Collaborator

sum01 commented Jun 8, 2020

I belive internal/action/tab.go might be the key for what is needed to close this issue in Micro v2. Accessing micro.CurPane():Tab should give access to those functions.

@simonvanderveldt Defaulting to opening on a new tab seems strange. I haven't found that to be the default on any editors I've used. Maybe you're confusing tabs and splits?

@simonvanderveldt
Copy link

simonvanderveldt commented Jun 8, 2020

I belive internal/action/tab.go might be the key for what is needed to close this issue in Micro v2. Accessing micro.CurPane():Tab should give access to those functions.

OK, I'll see if I can get it to work, don't really know how the lua to go mapping works but I can probably figure that out :)

@simonvanderveldt Defaulting to opening on a new tab seems strange. I haven't found that to be the default on any editors I've used. Maybe you're confusing tabs and splits?

Hmm, that's strange, from all of the editors I've used zero open files in a split, all of them open files in a new or existing tab. The editors I'm comparing against are GUI editors, which micro would be a replacement for for me. To be specific: IntelliJ, Sublime, Atom, VS Code.
Which ones have you used that open in a split?

@sum01
Copy link
Collaborator

sum01 commented Jun 8, 2020

Hmm. Maybe it's been too long since I've used those to remember if it's a tab or split. I thought VS opened in splits.

Nerdtree opens in splits or tabs depending on keypressed, which was what I based the features in my rework on. Could do something like that for this plugin, just need to find another key besides tab that works on scratch-type Micro panes.

@simonvanderveldt
Copy link

This works for me for the basic action of opening a file in a new tab

micro.CurPane():NewTabCmd({scanlist[y].abspath})

But it seems like tabs always take up the whole screen? 😕
I expected tabs to be nestable in splits (specifically a vsplit) but I've been unable to get that to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants