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

Don't open new windows #140

Open
reagle opened this issue Jun 19, 2017 · 9 comments
Open

Don't open new windows #140

reagle opened this issue Jun 19, 2017 · 9 comments
Labels

Comments

@reagle
Copy link

reagle commented Jun 19, 2017

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.

@vovkkk
Copy link
Collaborator

vovkkk commented Jun 20, 2017

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

Jumping does not support panels.

@reagle
Copy link
Author

reagle commented Jun 20, 2017

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 }
  ]
},

@vovkkk
Copy link
Collaborator

vovkkk commented Jun 20, 2017

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" }
  ]
},

@reagle
Copy link
Author

reagle commented Jun 20, 2017

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 }
  ]
},

@vovkkk
Copy link
Collaborator

vovkkk commented Jun 20, 2017

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.

@reagle
Copy link
Author

reagle commented Jun 20, 2017

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

@vovkkk
Copy link
Collaborator

vovkkk commented Jun 21, 2017

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 }
  ]
},

@reagle
Copy link
Author

reagle commented Jun 21, 2017

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
Copy link
Author

reagle commented Jun 21, 2017

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 }
  ]
},

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

No branches or pull requests

2 participants