filemanager-plugin icon indicating copy to clipboard operation
filemanager-plugin copied to clipboard

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

Open DanielPower opened this issue 7 years ago • 19 comments

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.

DanielPower avatar Feb 05 '18 03:02 DanielPower

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

sum01 avatar Feb 05 '18 05:02 sum01

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.

sum01 avatar Feb 15 '18 04:02 sum01

@sum01 Is the OpenFileTab() func in this PR any use? https://github.com/zyedidia/micro/pull/963

sc0ttj avatar Oct 24 '18 19:10 sc0ttj

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.

sum01 avatar Oct 25 '18 00:10 sum01

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

franzflasch avatar Nov 29 '18 09:11 franzflasch

@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

ghost avatar Nov 29 '18 12:11 ghost

great! will have a look at it!

franzflasch avatar Nov 29 '18 14:11 franzflasch

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 avatar Sep 03 '19 11:09 karl-gustav

@ghost

github.com/rvi64/files-plugin

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

karl-gustav avatar Sep 09 '19 17:09 karl-gustav

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

sum01 avatar Sep 09 '19 19:09 sum01

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

karl-gustav avatar Sep 10 '19 08:09 karl-gustav

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

franzflasch avatar Sep 10 '19 08:09 franzflasch

This PR gives plugins access to View: https://github.com/zyedidia/micro/pull/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

sc0ttj avatar Dec 30 '19 23:12 sc0ttj

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

sum01 avatar Dec 31 '19 17:12 sum01

Does anyone know how to do this? The issue linked (https://github.com/zyedidia/micro/pull/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.

simonvanderveldt avatar Jun 08 '20 10:06 simonvanderveldt

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?

sum01 avatar Jun 08 '20 16:06 sum01

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?

simonvanderveldt avatar Jun 08 '20 17:06 simonvanderveldt

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.

sum01 avatar Jun 08 '20 17:06 sum01

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? :confused: I expected tabs to be nestable in splits (specifically a vsplit) but I've been unable to get that to work.

simonvanderveldt avatar Jun 08 '20 21:06 simonvanderveldt