Sublime Forum

Solution: Open repository in terminal (Windows Terminal and others)


Hey guys,

Just wanted to share with you a solution to open current repository in the new Windows Terminal on Windows 10. The solution should work with small modifications on any system. But in Windows 10 there have been a blocker with permission errors for the wt alias until now.

It´s patched together from earlier comments in this forum and git issues so the credit goes to the respective authors. Also, the windows terminal usage was made possible due to this recently resolved issue by the git team.

  1. Install the latest git for windows. 2.31.1 or higher is required (containing the fix for issue 2675).

  2. Configure Sublime merge to use the system git instead of bundled

    Preferences > Advanced > Git binary > Set to System
  3. Add this alias to your ~\.gitconfig

    openterminalatpath = "!f() { wt -d \"$1\" ; }; f"
  4. Add a command to sublime merge to open the alias.

    Browse Packages > Open file: Default.sublime-commands

    add the following command

            "caption": "Open Repository in Terminal", 
            "command": "git", 
            "args": {
                "argv": ["openterminalatpath", "$working_dir"]
  5. Use the command by pressing ctrl+p then searching for Open repository in Terminal


Launch Terminal/Command Line at repo path

Since there is a built in GIT with Sublime Merge, isn’t there a simple option to open Git Terminal on the current folder?



As far as I know, there is now way yet. I think they are working on it but if you see the links in the text to older forum posts and github issues it has been a requested feature for some time.

This is just a workaround until it´s done.



This. Is. Amazing!

Now I wonder, can it published as a package? Is package management (like Package Control) coming to Sublime Merge as well? It could do some checks and (if needed) >> .gitconfig on startup, and provide this custom command. I mean, adding custom commands (even to the system menu) is not something that absolutely requires modifying Default file.




Once plugins are supported, until then it is manual.

The instructions aren’t exactly clear, you’re not modifying the built-in Default.sublime-commands, you’re modifying the additions in the User folder. (see docs user_entries & packages)



Thanks for this.

True, but for my use case his workaround is better. I use mingit on Windows and have it in Sublime Merge and the Windows Terminal.



Bonus points: Sublime Merge sets up GIT_EDITOR="/opt/sublime_text/sublime_text" --wait environment variable, so your git commits from that terminal session would be edited with cool shiny Sublime Text’s git syntax highlighting.



Improved version which does not hang up Sublime Text waiting for the command to finish. I mean, not like hanging up UI completely — it just kept showing command as running and waiting for something.

	openterminalatpath = "!f() { konsole --new-tab --workdir \"$1\" > /dev/null 2>&1 & disown ; }; f"

The key points here are: (1) redirect all IO to /dev/null, so it does not get blocked on (probably closed or just never read by SM) output stream; (2) disown to remove it away from child process list.