Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2: subl shell command often fails to open files

I have Sublime Text 2 installed on a Mac, and have made a link on the command line as described in the docs.

When opening files from the terminal, as in:

$ subl foo.txt

A Sublime Text window will open, but inside that window foo.txt will only open about one out of every three times or so. I've tried moving the link to a different folder in the path, creating it with sudo, etc., but no luck so far.

Any idea how to fix this?

like image 933
Chris Avatar asked Dec 17 '12 03:12

Chris


People also ask

What is SUBL command?

Sublime Text includes a command-line helper called subl . Using the command-line helper, you can open files and folders and perform other actions from the command line. Before using subl , make sure it is on your PATH . To put subl on your PATH , you may need to add directories to PATH or use symbolic links.

How do I open a Sublime Text file in Terminal?

Just Use the command subl to open sublime text from terminal. if you want to open a specific file use subl path/to/the/file .

Does Sublime Text have a command line tool?

Dev4.03.23.13.0 Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITORfor unix tools, such as git and subversion.

How do I open a file in Sublime Text?

Dev4.03.23.13.0 Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITORfor unix tools, such as git and subversion. Setup Windows Mac Linux Usage Configuring as EDITOR Setup

How do I install sublime_textexecutable in Linux?

If Sublime Text is installed via one of the Linux Package Manager Repositoriesor a package, a sublsymlink will automatically be installed into the /usr/bin/directory. If installing from a tarball, the sublime_textexecutable should be symlinked to subl, with a command such as:

How do I install Sublime Text on a 64 bit system?

64bit installs are typically in C:\Program Files\Sublime Text\ 32bit installs on a 64bit version of Windows will be in C:\Program Files (x86)\Sublime Text\ 32bit installs on a 32bit version of Windows will be in C:\Program Files\Sublime Text\ Mac To use subl, the Sublime Text binfolder needs to be added to the path.


1 Answers

Had the same problem for a while now. Add the following line to your .bash_profile:

alias subl='subl && sleep 0.1 && subl'

Now you can use subl filename_to_edit to open it.

If you are not sure if you configured subl command correctly, do the following. Run the first command for ST3 or the second for ST2:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Make sure that ~/bin is in your $PATH. Then do the first step with .bash_profile.

Finally works as it should! Credit goes to these guys and chrisf for improvement.

like image 55
Yerke Avatar answered Oct 25 '22 04:10

Yerke