jisaacks / MaxPane

Sublime Text plugin to quickly maximize a pane in a multi pane layout without resetting the layout.
MIT License
78 stars 9 forks source link

Default key-combo overwrites 'new line above' #9

Closed benfrain closed 4 years ago

benfrain commented 10 years ago

On OS X Sublime Text 3, here are the default key combination for super shift and enter:

{ "keys": ["super+shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line Before.sublime-macro"} },

Having installed MaxPane, it obviously overrides this. I've tried setting a user keymap:

{ "keys": ["ctrl+shift+enter"], "command": "max_pane" }

But now I get either of those key combos taking the pane to full screen.

How should I be setting the key combo to invoke Max Pane so it doesn't interfere with existing key mappings?

jisaacks commented 10 years ago

Well a couple of things here.

MaxPane sets default key bindings, but it should also expose a way to overwrite them. I guess I forget to add that part. You can see how I did that in GitGutter here by just added a sublime menu file to the repo. I would accept a pull request with this.

Also, I did not know that there was already key binding with these keys. MaxPane should probably not overwrite default key bindings. I picked those, because it is the same keys you use to do the same thing in iTerm. Not sure what I would want to change the default to, would have to put some consideration in it. Would be open to suggestions.

benfrain commented 10 years ago

I honestly wouldn't worry too much about defaults as everyone will have their own preference (and various other plugins may have already set something the same) but obviously some easy way for a user to set there own.

An avoidance of Sublime default keys is all I think one could reasonably expect. As long as an override is possible I think it will be fine :)

jisaacks commented 10 years ago

Yeah, the more I think about it, I don't want to change the default bindings because that would appear to break any instances out in the wild that are using the defaults.

As far as some way for the user to set there own. I believe all you would need to do it add a file called Main.sublime-menu to the repo with these contents:

[
    {
        "id": "view",
        "children":
        [
            {
                "caption": "MaxPane",
                "children":
                [
                    {
                        "caption": "Toggle", 
                        "command": "max_pane"
                    },
                    { 
                        "caption": "Maximize", 
                        "command": "maximize_pane"
                    },
                    { 
                        "caption": "Minimize",     
                        "command": "minimize_pane"
                    }
                ]
            }
        ]
    },
    {
        "caption": "Preferences",
        "mnemonic": "n",
        "id": "preferences",
        "children":
        [
            {
                "caption": "Package Settings",
                "mnemonic": "P",
                "id": "package-settings",
                "children":
                [
                    {
                        "caption": "MaxPane",
                        "children":
                        [
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/MaxPane/Default (OSX).sublime-keymap",
                                    "platform": "OSX"
                                },
                                "caption": "Key Bindings – Default"
                            },
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/MaxPane/Default (Linux).sublime-keymap",
                                    "platform": "Linux"
                                },
                                "caption": "Key Bindings – Default"
                            },
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/MaxPane/Default (Windows).sublime-keymap",
                                    "platform": "Windows"
                                },
                                "caption": "Key Bindings – Default"
                            },
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/User/Default (OSX).sublime-keymap",
                                    "platform": "OSX"
                                },
                                "caption": "Key Bindings – User"
                            },
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/User/Default (Linux).sublime-keymap",
                                    "platform": "Linux"
                                },
                                "caption": "Key Bindings – User"
                            },
                            {
                                "command": "open_file",
                                "args": {
                                    "file": "${packages}/User/Default (Windows).sublime-keymap",
                                    "platform": "Windows"
                                },
                                "caption": "Key Bindings – User"
                            }
                        ]
                    }
                ]
            }
        ]
    }
]

I don't have time to test that it works right now, or I would just add it, I may have time this weekend.

ctf0 commented 9 years ago

as a temp solution ,u need to have both cmnds in the user keymap now assign a diff key for maxpane and the default will be working as expected.

aicioara commented 6 years ago

I solved my issue by adding these to my keymap

// Max Pane
{ "keys": ["alt+w"], "command": "max_pane" }, // Obviously add your own
{ "keys": ["ctrl+shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line Before.sublime-macro"} },
deathaxe commented 4 years ago

All public releases of Sublime Text 3 beginning with build 3013 provide the following key bindings

    { "keys": ["ctrl+k", "ctrl+left"], "command": "focus_neighboring_group", "args": {"forward": false} },
    { "keys": ["ctrl+k", "ctrl+right"], "command": "focus_neighboring_group" },
    { "keys": ["ctrl+k", "ctrl+shift+left"], "command": "move_to_neighboring_group", "args": {"forward": false} },
    { "keys": ["ctrl+k", "ctrl+shift+right"], "command": "move_to_neighboring_group" },

The command focus_neighboring_group is equal to MaxPane's shift_pane and unshift_pane commands.

We should therefore change the key binding to ST's default ones for ST2 and disable shift_pane and unshift_pane for ST3.

asumaran commented 4 years ago

ctrl + shift + enter stopped working for me on Sublime Text 3. Did anything changed recently?

Edit: I see the PR above did this. Never mind restoring it back to the old

 { "keys": ["super+shift+enter"], "command": "max_pane" }

works for me.