Home Download Buy Blog Forum Support

sublime text as editor BASH/mingw32/git/ssh windows

sublime text as editor BASH/mingw32/git/ssh windows

Postby xero on Wed May 02, 2012 4:41 pm

hello,
i have a multi part question.

i want to use sublime text more in my terminal scenarios.

i use windows 7 (64bit) and the newest beta 1281 of sublime.
i use the official git for windows minw32 distribution.

i have made an alias that i can use on my local machine to fire up sublime to edit a file:

alias edit='c:/Program\ Files/sublime\ text\ 2/sublime_text.exe -w'

so when i do something like:
cd c:/repos/test/
edit test.html

sublime will open up, and when i save + close it goes back to the
command prompt like it should.

but problems arise when i ssh to a server. i tired to call my
alias, but it wasnt there. so i tired to readd it, but it's looking
for the c:/program files/sublime text 2/ location on the server
not my local machine!

is there anyway around this?
am i doing something wrong?

------------------------------------------------------------------------------

second question...

i want to configure sublime to be the default view for git diff and
merge commands. i have this working now for winmerge, but it
only will diff two files, not more than two. what are the command
line arguments i need to configure this?

in my .gitconfig file i have:
Code: Select all
[diff]
   tool = windiff
[difftool "windiff"]
   cmd = ~/winmerge.sh \"$LOCAL\" \"$REMOTE\"
[difftool]
   prompt = false
[merge]
   tool = winmerge
[mergetool "winmerge"]
   cmd = ~/winmerge.sh \"$LOCAL\" \"$REMOTE\"
   trustExitCode = false

and the ~/winmerge.sh file is:
Code: Select all
#!/bin/sh
# using winmerge with git
# replaces unix style null files with a newly created empty windows temp files
file1=$1
if [ "$file1" == '/dev/null' ] || [ "$file1" == '\\.\nul' ] || [ ! -e "$file1" ]
    then
       file1="/tmp/gitnull"
       `echo "">$file1`
fi
file2=$2
if [ "$file2" == '/dev/null' ] || [ "$file2" == '\\.\nul' ] || [ ! -e "$file2" ]
    then
       file2="/tmp/gitnull"
       `echo "">$file2`
fi
echo diff : $1 -- $2
"C:\Program files (x86)\WinMerge\WinMergeU.exe" -e -ub -dl "Base" -dr "Mine" "$file1" "$file2"

where $file1 and $file2 are variables in my shell script.

any help will be greatly appreciated!
xero
 
Posts: 2
Joined: Wed May 02, 2012 4:18 pm

Re: sublime text as editor BASH/mingw32/git/ssh windows

Postby SeanWcom on Wed May 02, 2012 8:32 pm

For your first question - no, I don't think there's any way around that. Personally, I use WinSCP to connect to my SFTP sites... using that (or any similar program) will let you define an editor, and you can then browse thru the files with a point and click interface.

It would be cool to do like you are asking, but as far as I know, it's just not possible. You are tunneling into another server - that server has no clue about your desktop... so when you run 'edit' it's looking for that command on the server.
Multiple selections... one of my favorite ST2 features. View some noob-friendly screen casts here.
SeanWcom
 
Posts: 101
Joined: Wed Aug 03, 2011 1:31 am
Location: Georgia

Re: sublime text as editor BASH/mingw32/git/ssh windows

Postby pete340 on Wed May 02, 2012 9:22 pm

xero wrote:but problems arise when i ssh to a server. i tired to call my
alias, but it wasnt there. so i tired to readd it, but it's looking
for the c:/program files/sublime text 2/ location on the server
not my local machine!


Yup. That's what SSH does. It runs a command shell on the server, and you type commands for that shell on your machine. So unless the server has Sublime, you won't be able to use it through SSH.
pete340
 
Posts: 76
Joined: Mon Oct 10, 2011 9:45 pm

Re: sublime text as editor BASH/mingw32/git/ssh windows

Postby xero on Wed May 09, 2012 1:18 pm

thanx to both of you...
that makes perfect sense.

so, what about the second part of the question?
does anyone know the commandline arguments to
pass 2 or 3 files to sublime at run time to diff???
xero
 
Posts: 2
Joined: Wed May 02, 2012 4:18 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 21 guests