sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
272 stars 14 forks source link

Add a `$select_ref` selector for custom commands #1916

Open FichteFoll opened 1 month ago

FichteFoll commented 1 month ago

Problem description

The currently available selectors for custom commands are a bit too special-purpose and allow for selecting either a tag, a branch or a commit, but only that specifically. What I'm missing is a $select_ref selector that I can use for a command like git rebase, where I'd like to rebase onto a tag, a branch, or a commit, depending on the situation. In fact, many git commands take a "ref". Currently, I'd need to create a separate command for each variation. When creating a custom command for e.g. git rebase --onto, I want to select two refs, meaning I'd need to create 3*3 different commands and I'd need to know ahead of time what exactly it is I want to select in each position (which I generally do but I don't want to think about that when invoking this kind of operation).

Preferred solution

A $select_ref selector that allows me to select any git ref, i.e. a branch, a tag, or a commit. Branch and tag names should be prioritized over a commit's summary line (usually displayed on the right side).

Example .sublime-command entry:

    {
        "caption": "Rebase onto…",
        "command": "git",
        "args": {"argv": ["rebase", "$select_ref", "--onto", "$select_ref"]},
    },

Alternatives

Create a separate command for each option combination (already possible but not desired).