Skip to content

Instantly share code, notes, and snippets.

@rahim
Created June 7, 2012 16:15
Show Gist options
  • Save rahim/2889809 to your computer and use it in GitHub Desktop.
Save rahim/2889809 to your computer and use it in GitHub Desktop.
Open sublime on windows (+cygwin) from remote with same dir
#!/bin/bash
# placed in .bashrc
function sb {
# TODO: do something to deal with paths that don't match shared workspace
# perhaps open in vim? or prompt to open in vim?
local FULLPATH=`readlink -f $1`
local HOMEPATH=~ #/home/AHC/rahim.packirsaibo
local HOMECHAR='~'
local REPLACED_PATH=${FULLPATH/$HOMEPATH/$HOMECHAR}
echo $REPLACED_PATH
ssh laptop33 '~/bin/sb' $REPLACED_PATH &
}
#!/bin/bash
# placed in PATH as sb
function sb {
local ORIG=$1
# turn relative path to absolute
local UNIXPATH=`cygpath -a $ORIG`
# turn full path to win path
local WINPATH=`cygpath --dos $UNIXPATH`
~/Apps/Sublime\ Text\ 2\ Build\ 2181\ x64/sublime_text.exe $WINPATH &
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment