Sublime Forum

How to create command open sublime from terminal

#1

I want to do something like type sub then enter, the current directory will open in terminal.

I saw some solution for something like this, but they require typing the dot character after the keyword, which is still long :slightly_smiling:

0 Likes

#2

use alias

i am word-counting patch.

2 Likes

#3

sorry, but how to use alias

0 Likes

#4

Assuming you are using bash as shell: open/create the file .bashrc in your home folder and insert a line with the content alias sub="subl ." and restart your terminal.

1 Like

#5

Or you can type . ~/.bashrc … I found that out some weeks ago. Saves the time restarting the terminal (and maybe losing the actual working path).

:slightly_smiling:

0 Likes

#6

sorry, how to create .bashrc in home folder? Like open terminal, type cd home then enter? then in create a file name .bashrc ?

0 Likes

#7

ah i find out. My mac does have bash_profile file. I can write alias in it. Thanks :slight_smile:

0 Likes

#8

You can just write subl ~/.bashrc, but as you already noticed OSX seems to use login shells by default. Therefore you should use .bash_profile instead of .bashrc on your system.

1 Like