Sublime won't open with terminal - text

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.

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

I set .bashrc but my promt looks still the same

i'm quite new with linux and I want to tweak my terminal prompt. The default is user#user - Thinkpad- T420 ~$. That pretty annoying long.
I searched google and I tried my best but it didn't show any difference.
What i have done:
echo $PS1
\[\e]0;\u#\h \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u#\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]
locate bashrc
/etc/bash.bashrc
/etc/skel/#.bashrc#
/etc/skel/.bashrc
/etc/skel/.bashrc~
/usr/share/base-files/dot.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/bash.bashrc
/usr/share/doc/adduser/examples/adduser.local.conf.examples/skel/dot.bashrc
sudo -s Atom /directory
I changed in all files PS1="...." to PS1="hallo". Terminal prompt shows no difference.
Linux Kernel
Mint
4.8.0-53-generic
greetings ! B
source ~/.bashrc
Your terminal only reads the .bashrc on opening, or when you explicitly source it.
I fixed it by editing the .bashrc file in my /home/myusername directory. Don't edit the files here /src/skel

p4 change not working with gvim

I use perforce as source code repository. p4 change command is used to create a changelist of opened files. If I set setenv EDITOR gvim and then run this command then gvim opens and I add some description and then save and quit. I get below error. Same error does not come if EDITOR is not set, I mean in that case vim opens. Any idea to fix this issue?
sachina#inn-sachina-vm[285] p4 change
Error in change specification.
Error detected at line 29.
Change description missing. You must enter one.
Hit return to continue...
Applications that invoke EDITOR assume that the command blocks until editing is done and the editor was closed. While true for vim, the GUI version gvim launches in the background; i.e. the command returns immediately.
You can avoid this via the :help -f command-line option:
setenv EDITOR 'gvim -f'

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

Vim Ex mode loads when opening terminal

I know little about Vim in terminal(Mac) and the other day I was working copy and pasting text and i think I accidently did it when in terminal. Now whenever I open terminal it instantly loads on Vim Ex mode. I know how to quit Ex mode once in terminal but is there any way i can get rid of Vim loading when I open Terminal?
Thanks
Edit: To explain further to what i mean when I open terminal.app from Utilities I get the following
and the only way I get back to the command prompt is by typing quit every time I open terminal and i cant understand why the Vim process is running in the first place.
I was just outside the terminal in a document copy and pasting text then accidentally did a command v to paste within terminal which resulted in this happening.
It appears that you've accidentally updated one of your shell startup scripts so it launches vim.
If your default shell is csh or tcsh, take a look at .cshrc, .tcshrc, and .login in your home directory, and look for a command like vi -e or vim -e.
If your default shell is bash, check .bashrc and .bash_profile.
It may be easier to figure out which file you messed up by checking which file in your home directory was modified most recently:
% ls -altr $HOME | tail
-a lists all files, including files whose names start with ..
-l gives you a long listing, showing timestamps.
-t sorts by modification time.
-r reverses the order, so newer files are shown last

Resources