Problem :
I’m having trouble using the terminal to change my text editor to Sublime Text 2.
I followed the instructions in this thread to no avail :/
Any assistance would be extremely appreciated
Solution :
First use which command to find the location of sublime on your system
which sublime
which command will output the location of sublime in your system. You can use the location to set the editor. It usually resides in /bin/ directory.
Next, set the environment variable EDITOR to the sublime location
export EDITOR=<installed location - sublime>
Finally, add the above line to .bashrc hidden file. You can find .bashrc hidden file in your home directory by running the following command.
ls -a
Save and close the .bashrc file.
In case you do not find .bashrc file in your home directory. You can create it yourself and add the above line.
To set default graphical text editor, you can VISUAL environment variable.
export VISUAL=$EDITOR
and add the line in .bashrc as well.