Open Sublime 3 from Mac Terminal - sublimetext3

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?

Related

How do I display a terminal banner after clearing the terminal

so I set up my terminal banner with figlet and I really like it. But it will only be displayed after opening a new terminal. My question is: Can I somehow display a banner after I hit "clear"?
You'll have to edit your .bashrc file and add the following line:
alias clear='clear && (the figlet command you use)'
Then it will start up every time you type clear.

Linux: Gedit won't run in foreground

If I run gedit in the Linux terminal ($ gedit) it opens as a background job; which is not what I'm after at the moment.
Other programs (such as emacs) run in the foreground with commands like ($ emacs) and only run in the background if I've specified it via something like ($ emacs &).
I've tried searching for a solution but almost everything is about the opposite (trying/struggling to get things to run in the background).
Any ideas?
As it works for me: I run gedit /tmp/file.txt for the first time and it runs in the foreground. Then I open another terminal tab and run gedit /tmp/file2.txt while Gedit is still open — the second command instructs running instance of Gedit to open second tab and exits immediately. Gedit is still in the foreground in the first terminal tab.
According to gedit help, it has an option
-w, --wait Open files and block process until files are closed
If in the second terminal tab I run gedit --wait /tmp/file3.txt, then it opens a new tab in the existing Gedit window but the command stays in the foreground until I close that file tab.
Just in case: it was tested under KDE, Ubuntu 16.04, gedit version is 3.18.3

edit-and-execute-command bash with sublime text

In a bash terminal session, I notice that the edit-and-execute-command C-xC-e does not work with Sublime Text 3.
I've set EDITOR=subl, but when I try to edit a command line from bash, sublime-text opens an empty window.
Do I miss something ?
You should export the EDITOR as:
EDITOR="subl -w"
as:
To use Sublime Text as the editor for many commands that prompt for
input, set your EDITOR environment variable:
export EDITOR='subl -w'
Specifying -w will cause the subl command to not exit until the file is >closed.
Full explanation here

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