Sublime Forum

"New view into file" key binding on Sublime Text 3

#1

I’ve done that

    {
        "key": ["super+shift+x"],
        "command": "clone_file"
    }

but it doesn’t work at all, any idea?

0 Likes

#2

The keybindings should be a JSON list, so, something like this should work:

[
    {"keys": ["super+shift+x"], "command": "clone_file" }
]
1 Like

#3

Sorry, my real settings are:

[
    {
        "keys": ["super+alt+&"],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 1.0],
            "rows": [0.0, 1.0],
            "cells": [[0, 0, 1, 1]]
        }
    },
    {
        "keys": ["super+alt+é"],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 0.5, 1.0],
            "rows": [0.0, 1.0],
            "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
        }
    },
    {
        "keys": ["super+alt+\""],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 0.33, 0.66, 1.0],
            "rows": [0.0, 1.0],
            "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]]
        }
    },
    {
        "keys": ["super+alt+'"],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 0.25, 0.5, 0.75, 1.0],
            "rows": [0.0, 1.0],
            "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]]
        }
    },
    {
        "keys": ["super+alt+2"],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 1.0],
            "rows": [0.0, 0.5, 1.0],
            "cells": [[0, 0, 1, 1], [0, 1, 1, 2]]
        }
    },
    {
        "keys": ["super+alt+3"],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 1.0],
            "rows": [0.0, 0.33, 0.66, 1.0],
            "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]]
        }
    },
    {
        "keys": ["super+alt+("],
        "command": "set_layout",
        "args":
        {
            "cols": [0.0, 0.5, 1.0],
            "rows": [0.0, 0.5, 1.0],
            "cells":
            [
                [0, 0, 1, 1], [1, 0, 2, 1],
                [0, 1, 1, 2], [1, 1, 2, 2]
            ]
        }
    },
    {
        "keys": ["super+shift+c"],
        "command": "show_panel",
        "args": {
            "panel": "replace",
            "reverse": false
        }
    },
    {
        "key": ["super+shift+x"],
        "command": "clone_file"
    }
]
0 Likes

#4

does ST detect that key combination correctly?

open the ST console (View menu -> Show Console) and type/paste sublime.log_input(True) Enter and then press Super+Shift+x and check what gets logged in the console.

0 Likes

#5

I’ve got this: no command for selector: noop:

0 Likes

#6

And:

key evt: shift+super+x
0 Likes

#7

not sure where the noop message is coming from, but looks like it detects the keypress okay…

how about sublime.log_commands(True) Enter and try the keybinding again, I’d expect to see:

key evt: shift+super+x
command: clone_file

0 Likes

#8
key evt: shift+super+x
command: drag_select {"event": {"button": 1, "x": 282.21875, "y": 1035.9140625}}
key evt: shift+super+c
command: show_panel {"panel": "replace", "reverse": false}
key evt: shift+super+c
0 Likes

#9

Drag select happens when I select text with the mouse. Does that command appear when you press shiftsuperX? Does text at the cursor get selected? Have you tried binding it to another key combination?

I get the same output as @kingkeith predicted in the console, and the current view is indeed cloned to a new tab.

0 Likes

#10
  {
    "keys": ["super+alt+x"],
    "command": "clone_file"
  },

works like a charm.

0 Likes