Sublime Forum

Key bindings for next/prev view

#1

Dear community,

I hope this message finds you all in good spirits.

I have a query regarding the functionality of Sublime Merge. Is it possible to incorporate a feature similar to Sublime Text when managing multiple open tabs? In Sublime Text, I can easily switch between tabs using shortcuts like ctrl+AvPag and ctrl+RePag:

>>> sublime.log_commands(True)
command: prev_view
command: next_view

The reason I bring this up is that when dealing with numerous repositories, efficient navigation without relying on the mouse becomes crucial. Although the introduction of tabs in Sublime Merge was a welcomed addition, it does have its limitations. For example, when working with many repositories, you cannot view the titles of all open repositories simultaneously. Although a popup dialog was added in the top-right corner, it is not a persistent window. Other Git clients like Sourcetree have effectively implemented a solution to this issue. Something akin to Sublime Text’s sidebar would be fantastic :slight_smile:

I understand this might be off-topic and not a quick implementation, but for now, having keybindings for faster repository navigation would be immensely helpful.

Thank you for your attention and consideration.

0 Likes

#2

The Navigate > Tabs submenu has entries for going to the next and previous file tab and next and previous repository tab; the menu items will tell you what keys are bound to them by default, but much like Sublime you can also modify them if you’d like to have them on different keys.

1 Like

#3

Thanks a mill!

For some reason I wasn’t even aware of the existance of that Tabs submenu at all… :smiley:

[
    {
        "keys": ["ctrl+pagedown"],
        "command": "next_tab"
    },
    {
        "keys": ["ctrl+pageup"],
        "command": "prev_tab"
    }
]

Works fantastically, it seems once you edit the User\Default (Windows).sublime-keymap it automatically reloads like its big brother ST and updates accordingly the bindings, ie:

existing_key_bindings = {
    ...
}

new_key_bindings = {
    ...
}

def update_key_bindings(existing_bindings, new_bindings):
    for key, command in existing_bindings.items():
        if key in new_bindings:
            del existing_bindings[key]

    existing_bindings.update(new_bindings)

update_key_bindings(existing_key_bindings, new_key_bindings)

As usual, thanks @OdatNurd!

0 Likes

#4

Indeed; both share a code base behind the scenes, so generally speaking what works in one re: customization will work in the other (except where plugins are concerned because there is no plugin host yet).

In addition, although there is no input, there is a console (openable by the same key) where you can track what it’s doing.

If you add settings to your preferences:

"log_input": true,
"log_commands": true,
"log_control_tree": true,

The same logging will happen in the Merge console (so you can check your input, what commands it’s executing, or where you’re clicking for theme purposes respectively).

Though, for the sake of sanity you may want to leave them set to false until you need them, unless you never look in the console for anything.

1 Like

#5

Thanks for the extra tips!

When you mention about “there is no plugin host yet”, also I guess probably package control in the roadmap? It would indeed be fascinating to delve into the codes behind the scenes of both ST and SM. While it remains uncertain if these codes will ever see the light of day, exploring their similarities in UI and project structuring would undoubtedly make for intriguing reading. I’ve always sensed that both have been meticulously architected, likely built upon the right layers and frameworks.

Both software pieces are undeniably impressive, although, as frequently discussed in these forums, they do lack some horsepower under the hood. I’ve often pondered if, during the creation of VsCode, it would have presented a fair competition in terms of contributors. I wonder how many original ST users might have transitioned to VsCode in such a scenario…

@OdatNurd Anyway, apologies for going off-topic. It’s been a while since I last visited the forums; was there ever a “Close” button introduced? You’ve effectively addressed my query and I’m eager to accept the solution, but I can’t seem to find the option anywhere.

0 Likes

#6

Indeed, a plugin host for Merge has been on the roadmap for a while, but it hasn’t happened yet, possibly related to having a truly compelling reason to do so.

For questions asked in the Technical Support form, there’s an option to mark a specific response as the answer to the question. For other sections there isn’t any way to “close” out the topic; generally speaking, once everyone acknowledges that the problem has been resolved, it just sort of ends there, if you know what I mean.

0 Likes