Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to change or add the ability to open files when working with mingw32 with a different text editor (in my case sublime text 2).

I would like to be able to do the following from the command line:

$ sublime_text textfile.text -- where st is a command to use st2 to open the textfile.

you can already do this with vim

so following Git for Windows: .bashrc or equivalent config files for Git Bash shell , I have created a .bashrc file and put:

export EDITOR=/c/Users/bill/Desktop/f/st/sublime_text1

Inside. however even after closing and opening the window the command:

bill@PC /c/users/bill/desktop/f
$ sublime_text1 hello
sh.exe": sublime_text1: command not found

I would appreciate any help.

share|improve this question
up vote 1 down vote accepted

It seems you are doing two different things here:

export EDITOR=/c/Users/bill/Desktop/f/st/sublime_text1

If other applications need to open a text editor (e.g. git, to edit a commit message), they will use the one specified in the EDITOR environment variable.

$ sublime_text1 hello

Now you want to run Sublime Text from the command line. There are two ways you can do that without having to always specify the full path: either use an alias:

$ alias sublime_text='/c/Users/bill/Desktop/f/st/sublime_text1'
$ sublime_text hello

or add Sublime Text's directory to the PATH:

$ PATH="/c/Users/bill/Desktop/f/st:$PATH"
$ sublime_text1 hello

Note that aliases are only available inside the shell, so they won't work if you try to run them from inside another application (e.g. vim).

share|improve this answer
    
Thanks, I used the path. Is this the same path as in the win 7 path environmental variable? – user61629 Feb 25 '13 at 2:22
    
@user61629 The function and contents are the same. The only changes are that ; separates directories on Windows (: on Cygwin) and (obviously) the paths' formatting. – Aluísio A. S. G. Feb 25 '13 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .