X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=bash%2F.bash_aliases;h=d5cc9d5ca933872062bbcccab5a85f84f5a0cfe1;hb=5f8135d931908809a284f939f8e1a5a11b786a26;hp=041788cd6d7d63e99157654c1f1f7ebde201f11b;hpb=56871825930ef16af8843406af90eebb41b71f0c;p=max%2Fdotfiles.git diff --git a/bash/.bash_aliases b/bash/.bash_aliases index 041788c..d5cc9d5 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -21,4 +21,32 @@ function la { fi } alias tmux='TERM=xterm-256color tmux' -alias vim='gvim -v' +if [ -x /usr/bin/gvim ]; then + alias vim='gvim -v' +fi + + +function ssh_in() { + control_file="$TMPDIR/${1}_ssh_in" + if [[ -e $control_file ]]; then + echo "Session is already open" + exit + fi + + cat ~/.tmux.conf | ssh \ + -M \ + -S "$control_file" \ + -o ControlPersist=yes \ + "${1}" \ + 'cat - > ~/.tmux_ssh.conf' + + + i3-sensible-terminal -e \ + sh -c \ + "ssh \ + -o RemoteCommand=\"/bin/sh -c 'exec tmux -f ~/.tmux_ssh.conf new -As remote'\" \ + -S \"$control_file\" \ + -t \ + \"$@\" + ssh -O exit -S \"$control_file\" \"$1\"" +}