Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open folder in Git Bash with Sublime Text 2 on Windows

Tags:

sublimetext2

I'm looking for a solution to be able to right-click on any folder in the side bar, of Sublime Text 2 on Windows, and select "Open with Git Bash" so that Git Bash opens with that folder, ready for my git commands.

I've tried the Open With functionality with the Side Bar Enhancements plugin, but no luck.

Oh, and I've tried the "Git" plugin for ST2. It's not what I need.

like image 321
user2479930 Avatar asked Nov 24 '25 01:11

user2479930


1 Answers

This worked for me on Windows 7

Create the following files under Packages/User

git_bash.py

import sublime
import sublime_plugin

class GitBashCommand(sublime_plugin.WindowCommand):
    def run(self, **args):
        dir = args["dirs"][0]
        self.window.run_command("exec", {"cmd": ["start", "sh", "--login", "-i"], "shell": True, "working_dir": dir})
        self.window.run_command("hide_panel", {"panel": "output.exec"})

    def is_visible(self, **args):
        return len(args["dirs"]) > 0

Side Bar.sublime-menu

[
    { "caption": "Git bash...", "command": "git_bash", "args": { "dirs": []} }
]

Make sure to add you Git Bash bin folder avaiable in the Windows PATH, on windows 8 its per default ;C:\Program Files (x86)\Git\bin\

http://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/

like image 116
urraka Avatar answered Nov 28 '25 07:11

urraka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!