May not be the desired behavior for some, but it works for me. I've included a bit of rudimentary logic to ensure the project shortname you're passing actually matches a project file in the current directory, and if no match is found, the -p flag and project "shortname" are dropped from the command arguments (while the rest of the options remain) and ST2 is opened with an empty window (or new file, however you have configured ST2). One caveat to this is that, because getopts isn't being used to parse the options passed to bash, the -p flag and the project file "shortname" must be the first and second option passed to the shell function - basically, you can't do st -b -p lig, you have to do st -p lig -b. You can also supply additional ST2 options, such as the -b flag to open ST2 in the background, in the arguments list. In the case where you have an existing ST2 window open, the project will always be opened in a new ST2 window. With this this helper function you can open a Sublime Text 2.0 project file (ex: foobar.sublime-project) from the command-line by simply typing st -p foobar instead of subl -project foobar.sublime-project. #echo "only 1 argument passed, execute: subl $*" #echo "project argument not passed, execute: subl $*" Subl $* # open sublime and pass args as usual ] & projectfile= " $2.sublime-project " # detect if arg2 already includes the ext # bash function, usage: $ st -p -opt2 -opt3 Alias subl= '/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl ' It helped me form the knowledge I was able to share in this article. I really appreciate the answers on this stack overflow thread.
I hope with this hack you will be able to setup an alias for Sublime Text. That's because we added a wildcard to the command.
I will navigate into a code base now and show the difference in the next screenshot:įrom the screenshot above, Sublime doesn't just launch a blank workspace – it launches with all project folders associated with that project. I also figured out that if you have a working directory you can force Sublime to open that directory. Yes, it works! And you can see Sublime Text launch itself.
Once we are done with that we can head back to our bash to check if our configuration worked by doing subl as shown below: Once we've included that, we can press esc to exit insert mode and then :wq to save and exit. So we can add our alias there now, like this: alias subl='C:/Program\ Files/Sublime\ Text\ 3/sublime_text.exe' Now you have access and can type into the prompt. Then you need to press i to enter the insert mode. When we click on enter we will see an interface that looks somewhat like what we have below. bashrc file to include the alias we'll need to launch Sublime text: I have created the bash file within the specified directory, so mine looks like C:\Users\larry\.bashrc. There are super easy 5 steps to add terminal or command line access in the sublime. This will help you on Windows and Linux/Ubuntu as well.
In this article, we will see how to use the terminal in a sublime text editor.
It's important that the file be created within the C:\Users\username\ directory – otherwise you will get a permission denied error. Sublime is Simple and free to use, Light on memory, and can easily work with multiple projects. Then we can proceed to explore various Linux commands in order to complete the configuration process. To begin configuring Git bash, we first need to open the bash terminal. How to Configure Git Bash with Sublime Alias Then when we type the alias into Git bash it auto launches the text editor. What we want to do is create an alias for the sublime_text.exe found within the Sublime Text 3 folder. Once you've downloaded and installed Sublime, it will be located within the program files as shown below: All these features help make it easier and more comfortable to work with and contribute to a wide variety of programming language code bases.
It has amazing features such as syntax highlighting, indentation, plugins and packages.
Sublime text is a source code editor that helps software developers code and edit text or markup.
If you have been trying to figure out how to open the Sublime Text editor from your Git bash, then you're in luck.