subl command not working on gitbash after i restart my terminal - sublimetext3

subl command not working whenever i restart my terminal after adding
alias 'subl="/c/Program Files/Sublime Text 3/subl.exe"'
But it works on first attempt
😥 it annoys me to write
alias 'subl="/c/Program Files/Sublime Text 3/subl.exe"' everytime whenever i have to open sublime through git bash

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.

How do I run a shell command from vim in the existing terminal SCM session?

Here's the problem statement:
I open a GNOME terminal and run a startup script setup_myproject_view1 which sets up an SCM session and sets some enviroment variables.
I open terminal vim and start browsing through some files often in multiple split panes (:sp, :vsp)
I realize that I need to edit and save one or more of these files. But before I can do that I need to check out the file from the SCM server/depot.
Now I have multiple options:
Close all my vim panes and run the checkout command in the shell and then open one or all of the files I had open before. Very tedious.
Open a new terminal window or tab and run the startup script and checkout the file. Then return to the original terminal, run :e to load the file again with write permission enabled and proceed to edit it. Still tedious because I have to run the startup script (so I have to remember which project view I'm working in) and switch through windows/tabs.
Run the shell check out command from vim using :shell or :!. This would be ideal because I'm quickly able to return to editing without breaking my train of thought. But the shell inside vim again does not have the startup session setup_myproject1_view1. Nor do I want to put setup_myproject_view1 to run automatically in my shell's .cshrc file because I have different projects and views: setup_myproject3_view2, etc.
So how can I run a shell command conveniently from vim without having to setup the SCM project view?
you can pause vim using ctrl+z, do your checkout and then resume it with fg if you invoked vim from a bash shell. For more information see bash job control
An alternative, you should modify your setup script to export variables to underlying shells. For example if your script is like this:
# script.sh
MEH=4
you will get this result when you use it:
source script.sh
vim
:shell
echo $MEH
exit
but if you change it like this:
# script.sh
export MEH=4
you will get this result when you use it:
source script.sh
vim
:shell
echo $MEH
4
exit

bash - no such file or directory for ATOM text editor

I have installed the ATOM text editor the other day, and it works fine when I launch it within the installation directory. However, its tedious to go there every time, so I added it to my profile.
the command I added is:
export PATH=$PATH:/home/cole/ATOM/atom-1.14.3/usr/bin
But when I try to open it from my home directory I get the error:
bash: ./atom: No such file or directory
Any suggestions?
If you only wish to launch atom directly from terminal by typing in atom and pressing enter, I would suggest to create an alias for it instead.
Open up .bashrc file:
nano ~/.bashrc
(Or use some other text editor.)
Then scroll to the end of the file and add the following rows
# Alias for launching atom text editor
alias atom='/home/cole/ATOM/atom-1.14.3/usr/bin/atom'
Now terminal needs to be relaunched for the alias to work.
Hope this helps.

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.

Resources