Sublime Forum

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

#1

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:

[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:

#!/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!

0 Likes

#2

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.

0 Likes

#3

[quote=“xero”]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!
[/quote]

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.

0 Likes

#4

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???

0 Likes