Tuesday, 15 September 2015

Launch Sublime Text From A Cygwin Terminal

Hi guys,

This is just a quick tip to launch Sublime Text  from A Cygwin Terminal, most developers need to use the command-line but lets face it vim, vi and nano all suck as editors sublime is nice so lets use that.

1) Edit the bashrc (OK we gonna use a terminal editor jut one)
nano ~/.bashrc
2) Put this at the bottom of the file 


 subl() {

 local cmd="'$(cygpath 'D:\Documents\Sublime Text 2.0.1\sublime_text.exe')'"



 if [[ $@ ]]; then

      cmd=$cmd' "'$(cygpath --windows "$@" | sed ':a;N;$!ba;s/\n/" "/g')'"'

 fi

 eval $cmd
}

3) Then re compile bashrc

  source ~/.bashrc

OR

  . ~/.bashrc

and you are done ! type subl any time to edit file in Sublime Text.

No comments:

Post a comment