SublimeFileBrowser icon indicating copy to clipboard operation
SublimeFileBrowser copied to clipboard

Don't open new windows

Open reagle opened this issue 8 years ago • 9 comments

Hi, for the life of me I can't configure sensible behavior.

  1. I don't want it to open a new window ever.
  2. I want either a new full screen tab or a left panel to show me a directory. The following gives me a left panel.
{ "keys": ["super+k", "o"], "command": "dired", 
	"args": {
		"immediate": true,
		"single_pane": false, 
		"other_group": "left",
	} },

I then window to select my file(s), open them in the right/main panel and have the left panel close. It looks likes this is supposed to do this, but this opens the selected files in the thin left panel!

{"keys": ["enter"],
  "command": "dired_select", "args": {"and_close": true},
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

If I can figure this much out, then I'll move on to asking the same thing for jumping.

reagle avatar Jun 19 '17 21:06 reagle

"command": "dired_select", "args": {"other_group": true, "and_close": true},

Jumping does not support panels.

vovkkk avatar Jun 20 '17 03:06 vovkkk

I'm sorry, I still don't understand. My keybindings are below.

When I press super+k,j and select the jump directory, my current tab is replaced (hey, where'd my editing go?) by a full tab FileBrowser tab in which I can move around, but pressing enter on a key does nothing, and when I close it I'm prompted that I haven't saved this file?

{ "keys": ["super+k", "o"], "command": "dired", 
	"args": {
		"immediate": true,
		"single_pane": false, 
		"other_group": "left",
	} },
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "args": { "new_window": false}
},
{"keys": ["enter"],
  "command": "dired_select", "args": {"other_group": true, "and_close": true},
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

reagle avatar Jun 20 '17 13:06 reagle

Okay, I figured it (ignore my prev message, I removed it)

"dired_jump" must be restricted to FileBrowser view (just add same context as for "dired_select")

But if you use "new_window": true then "dired_jump" may be unrestricted.

So you can do this:

{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "args": { "new_window": true},
  "context": [
    { "key": "selector", "operator": "not_equal", "operand": "text.dired" }
  ]
},

vovkkk avatar Jun 20 '17 14:06 vovkkk

But I don't want a new window. I prefer to do my tab and pane management in a single ST3 window. The following is working when I open with dired in the current directory, but jumping is eluding me. I want the jump to resemble the open (open thin left pane, let me navigate & select, open file in new tab, then disappear) but with the jump directory rather than the documents current directory.

Maybe what I'm asking isn't possible?

{ "keys": ["super+k", "o"], "command": "dired", 
	"args": {
		"immediate": true,
		"single_pane": false, 
		"other_group": "left",
	} },
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "args": { "new_window": true},
  "context": [
    { "key": "selector", "operator": "not_equal", "operand": "text.dired" }
  ]
},
{"keys": ["enter"],
  "command": "dired_select", "args": {"other_group": true, "and_close": true},
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

reagle avatar Jun 20 '17 14:06 reagle

You can try Chain of Command, to call dired & dired_jump commands with one keybinding.

Or feel free to send a pull request for additional arguments for jumping commands.

vovkkk avatar Jun 20 '17 17:06 vovkkk

Both of those are beyond me at the moment, but thanks for your help.

reagle avatar Jun 20 '17 18:06 reagle

Chain of Command is pretty simple, you just have to understand the syntax, something like this:

{
  "keys": ["super+k", "j"],
  "command": "chain",
  "args": {
    "commands": [
      ["dired", {"immediate": true, "other_group": "left"}],
      ["dired_jump"]
    ]
  },
  "context": [
    { "key": "selector", "operator": "not_equal", "operand": "text.dired" }
  ]
},
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

vovkkk avatar Jun 21 '17 05:06 vovkkk

That doesn't work well: it opens the dired_jump pop-up in a thin left panel and can't be seen properly because it is cut off.

If I remove "other_group": "left" (see below), I get a full tab dired tab, a legible jump pop-up, but when I select something any pre-existing tabs I had are smushed into a left pane.

{ "keys": ["super+k", "o"], "command": "dired", 
	"args": {
		"immediate": true,
		"single_pane": false, 
		"other_group": "left",
	} },
{
  "keys": ["super+k", "j"],
  "command": "chain",
  "args": {
    "commands": [
      ["dired", {"immediate": true}],
      ["dired_jump"]
    ]
  },
  "context": [
    { "key": "selector", "operator": "not_equal", "operand": "text.dired" }
  ]
},
{"keys": ["super+k", "j"],
  "command": "dired_jump",
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

reagle avatar Jun 21 '17 13:06 reagle

This looks to do what I want to do. I thought what I wanted was simple: jump pop-up, navigate, select files to open, open files -- after which there should be no changes to the panes.

{
  "keys": ["super+k", "j"],
  "command": "chain",
    "args": {
      "commands": [
        ["dired", {"immediate": true, "single_pane": true}],
        ["dired_jump"]
        ]
      },
      "context": [
      { "key": "selector", "operator": "not_equal", "operand": "text.dired" }
      ]
},
{"keys": ["super+k", "j"],
  "command": ["dired_jump", {"immediate": true, "single_pane": true}],
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},
{"keys": ["enter"],
  "command": "dired_select", "args": {"other_group": false, "and_close": true},
  "context": [
    { "key": "selector", "operator": "equal", "operand": "text.dired" },
    { "key": "setting.dired_rename_mode", "operand": false }
  ]
},

reagle avatar Jun 21 '17 13:06 reagle