aziz / SublimeFileBrowser

Ditch sidebar and browse your files in a normal tab with keyboard, like a pro!
MIT License
395 stars 45 forks source link

Dired open in multiple panes #135

Open chrispeterson3 opened 7 years ago

chrispeterson3 commented 7 years ago

Is there the ability to have dired open in multiple panes but each pane be it's own instance?

At the moment, if I have a side-by-side pane both with dired mode, they mirror each others activities.

vovkkk commented 7 years ago

side-by-side pane both with dired mode, they mirror each others activities.

Could you elaborate? hard to believe to this, or even imagine it.

Every tab of FileBrowser is a separate instance, there might be quirks related to search of existing tab when you initiate browse command (e.g. single_pane argument); or if you open two tabs with same path and you change something in one (rename, delete, create file) then another will be refreshed (you can toggle auto-refresh with context menu of a view).

chrispeterson3 commented 7 years ago

Sorry it's a bit hard to explain. If you see the gif below, notice how activity in every instance is the same.

feb-15-2017 09-42-39

vovkkk commented 7 years ago

Haha, wow! do you open new view into file? I did not think about it ever, hm, maybe we can do something with it, I’m not sure.

Anyway, for now you have to initiate a browse command (i.e. dired) to create a separate instance.

vovkkk commented 7 years ago

Or you can open some directory in separate view with ⌘+enter

chrispeterson3 commented 7 years ago

That command definitely helps a bit. Here is how I'm opening dired:

{
    "keys": ["ctrl+;"],
    "command": "dired",
    "args": {
      "immediate": true,
      "project": true,
      "single_pane": true
    }
  }
vovkkk commented 7 years ago

It seems this entire topic is debatable. I assume you are using Origami (or sth similar) which not only opens a new view into file but also does additional stuff (create group(s), switch focus) which add complexity and uncertainty. Moreover, the very idea of cloned view spawns at least several questions and problems, e.g. https://github.com/SublimeTextIssues/Core/issues/731 because cloned view shares with primary one not only settings but also underlying buffer (and this is an actual reason for the issue you reported @chrispeterson3 ).

The best fix, I think, would be an argument(s) for clone_file command, e.g. share_buffer: true/false or sth.

So all in all, I’m not sure if we must to try fix this issue in SFB, because taking all concerns into account such fix may cause other unexpected problems. Creating our own clone command is questionable too, because it will only increase entropy for no good.

So I think we must recommend to use ⌘+enter or write your own commands which will do exactly what you need (e.g. keep expanded directories).

Also you can try a general workaround (which may not work due to switching focus or other circumstances): save following code in Package/User as py fille:

import sublime
import sublime_plugin
from FileBrowser.show import show

class DiredIgnoreClonedViews(sublime_plugin.EventListener):
    def on_post_window_command(self, window, command_name, args):
        if command_name != 'clone_file':
            return

        clone_view = window.active_view()
        if clone_view.settings().get('syntax') != 'Packages/FileBrowser/dired.sublime-syntax':
            return

        path = clone_view.settings().get('dired_path')
        if not path:
            return

        show(window, path, ignore_existing=True)
        clone_view.close()
chrispeterson3 commented 7 years ago

Thanks for the feedback!