why sublime text do not open with this command? - text

i would open sublime text editor from my console; with this command subl . but it doesn't work. Sorry i'm just a noob try to code. i did it on a mac book pro .
zsh: command not found: subl

Related

How to make Sublime Text open several files in one window?

Using Sublime Text 3 on the Centos 7.6 (Linux) operating system.
When I use Sublime Text to open files from the command prompt:
[root#localhost www]# sublime sitemap.php
[root#localhost www]# sublime robots.txt
The files are opened in 2 Sublime Text windows, even when the open_files_in_new_window setting is set to false.
How do I make Sublime Text open the files in one window?
I also use a Linux distribution and when I open files from the command line they do open in the same window.
The command you are using on the command line is sublime I suspect that starts Sublime Text with the --new-window option.
Look to see if you have the /usr/bin/subl file on your system. If you do then use subl instead of sublime on the command line and see if that opens the files in the same window.
If /usr/bin/subl is not on your system then you can create it like this:
Note: /usr/bin/subl is just the Sublime Text launcher which is automatically installed on Debian based Linux distributions.
Add these 2 lines to a new file and save it as /home/user/subl:
Note: Change the path to /opt/sublime_text/sublime_text if need be.
#!/bin/sh
exec /opt/sublime_text/sublime_text "$#"
Then run these commands as a super user or with sudo, whatever is easiest with Centos:
$ chown root:root subl
$ mv subl /usr/bin/
Now you should be able to use subl on the command line to open files in Sublime Text and they should open in the same window, e.g.:
$ subl sitemap.php
$ subl robots.txt

Opening up files with sublime text 3 in git bash in Windows

I want to open files with Sublime text 3. Is there a way that I can permanently set Sublime text as the default editor in git bash?
I tried the following code:
alias 'subl= "/c/Program Files/Sublime Text 3/subl.exe"'
and it worked. But, when I closed the Git bash and reopen it later, the command subl didn't work and I had to type in the code again.

Open Sublime 3 from Mac Terminal

I was following "Launch Sublime Text 2 or 3 from the Mac OSX Terminal" to open Sublime from Terminal.
I typed open ~/.bash_profile in Terminal. The first time it opened a text editor with a line like this:
export PATH=/usr/local/bin:$PATH
I changed it to
export PATH=/usr/local/bin:$/usr/local/bin
Now, when I type
open ~/.bash_profile
in the terminal, it shows "command not found" and in the terminal if I type
open /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl
Sublime will not pop up. But if I take open off, like
type /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl
Sublime will just open.
And now, if I type clear in the terminal to clear the previous codes, Terminal shows "command not found".
Is there are anything I can do to revert back?

Sublime won't open with terminal

I am trying to open up sublime through the terminal but it won't open
Here is the code
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
When I try to open it with subl .bash_profile
I get this error
-bash: subl: command not found
does anybody know why????
You need to close your terminal window and re-open it for changes to take effect. Or you can run:
source ~/.bash_profile
This will allow the change to take place without restarting your tty session.

Start Sublime 3 from terminal, when default is Sublime Text 2

I am on Ubuntu 12.04 LTS. Calling sublime foo.txt would normally open foo.txt in Sublime Text 2. Recently I installed Sublime Text 3. In addition to this, I tried to remove Sublime Text 2 completely from my filesystem.
After doing this, my system still tries to open Sublime Text 2 when I use sublime in my terminal. Clearly this is no good - because I removed Sublime Text 2. (at least partially).
I noticed the Sublime Text 2 icon is still in my applications list. If I try to remove it by clicking Uninstall I get the following error:
The files which should be removed are not part of any installed software.
So how do I fully remove it from an Ubuntu system, and how do I make sublime open Sublime Text 3?
Type : subl in terminal to launch Sublime Text 3 from terminal.
sudo ln -s /opt/sublime_text/sublime_text /usr/bin/sublime
When you run sublime, your computer should run a bash file at /usr/bin/sublime (running which sublime as Mike Li suggested will confirm the location. Open that up and edit it for Sublime Text 3. The contents of that file should be:
#!/bin/bash
/usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$#"
Edit it as so: (On my computer the executable is called subime_text_3 instead of subime_text. Verifiy by opening /usr/lib/sublime-text-3.)
#!/bin/bash
/usr/lib/sublime-text-3/sublime_text_3 --class=sublime-text-3 "$#"
Point it to the location of Sublime Text 3 on your system.
Edit Build 2221 (using the ppa) changed the installation directory from /usr/lib/sublime-text-2 to /opt/sublime_text_2
No need to do extra configuration for this. Just use subl commnad and it will open the sublime text editor.
For sublimetext 3, it is only need "subl"

Resources