Sublime Forum

Custom selector in Sublime Merge

#1

Hey, guys.
Can someone please give me a clue, if Sublime Merge allows to make a custom selector (say, $branch_at_commit) which could be used in a custom command like this:

{
	"keys": ["ctrl+n"],
	"command": "show_command_palette",
	"args":
	{
		"command": "rename_branch",
		"args": { "prompt": true, "branch": "$branch_at_commit" }
	}
}

, where $branch_at_commit is the result of something like:
git branch --points-at $commit | sed ‘/HEAD/d’ | head -n1

My current variant is ok, but it targets strictly the branch we’re currently at:

{
	"keys": ["ctrl+n"],
	"command": "show_command_palette",
	"args":
	{
		"command": "rename_branch",
		"args": { "prompt": true, "branch": "$head" }
	}
}

, … I wish it could be more versatile, allowing to target any selected branch.

So yeah, the question is whether I can make a custom selector in Sublime Merge. Or maybe there is a neat workaround for that.
Thank you.

0 Likes

#2

It is not possible to create custom selectors in Merge currently.

I’m assuming that what you want here is to choose some arbitrary commit and have it look through the history to see what branch that commit is currently on, or similar?

0 Likes

#3

Yes, excactly.
Well, that might be useful in some hotkey customization scenarios, I would love to see it implemented one day.
Thank you kindly for your response.

0 Likes