Here is what you need to do:
- Open ~/.bashrc. This should be under CIGWIN_DIR/home/YOUR_USERNAME/.bashrc
- Create a variable holding the path of your favorite editor. In my case, I am calling it EDITOR. Change the path inside of double quotes to the windows explorer path. To configure notepad++ I use:
EDITOR=`cygpath -a "C:\Program Files (x86)\Notepad++\notepad++.exe"`
- Add the following function to .bashrc
ed () {
FILE=`cygpath -w -a $@`
echo Editing: $FILE
`"$EDITOR" $FILE`&
} - Start a new bash session or run source ~/.bashrc to reload your bashrc.
You should now be able to edit files just by typing the function name from step 3, in this case it is ed (for edit).
$ cd /tmp
$ ed test.txt
Editing: C:\cygwin\tmp\test.txt
[1] 6440
$
No comments:
Post a Comment