tmux powerrrr
This commit is contained in:
parent
2e4df78730
commit
fbbd2ca763
1
setup
1
setup
@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
################################################################################
|
################################################################################
|
||||||
### SETUP VERIFICATION #########################################################
|
### SETUP VERIFICATION #########################################################
|
||||||
################################################################################
|
################################################################################
|
||||||
|
20
zsh/ssh
20
zsh/ssh
@ -1,6 +1,7 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
alias c='WRYN_REMOTE_CONNECTOR'
|
alias c='WRYN_REMOTE_CONNECTOR'
|
||||||
|
alias cmux='WRYN_REMOTE_CONNECTOR tmux'
|
||||||
alias sshc='WRYN_REMOTE_CONNECTOR ssh'
|
alias sshc='WRYN_REMOTE_CONNECTOR ssh'
|
||||||
alias sshe='$EDITOR $WRYN_SSH_CONNECTION_LIST'
|
alias sshe='$EDITOR $WRYN_SSH_CONNECTION_LIST'
|
||||||
alias ssh-add-all='WRYN_SSH_ADD_CREDENTIALS'
|
alias ssh-add-all='WRYN_SSH_ADD_CREDENTIALS'
|
||||||
@ -21,6 +22,7 @@ function WRYN_REMOTE_CONNECTOR() {
|
|||||||
local CONNECTION="$2";
|
local CONNECTION="$2";
|
||||||
|
|
||||||
local SSH_ID="^$CONNECTION$WRYN_SSH_DELIMITER"
|
local SSH_ID="^$CONNECTION$WRYN_SSH_DELIMITER"
|
||||||
|
local TMUX_UTF8_FLAG=$(locale charmap | grep -q 'UTF-8' && echo '-u')
|
||||||
|
|
||||||
[ $2 ] \
|
[ $2 ] \
|
||||||
|| { echo 'Must specify a connection'; return 1 };
|
|| { echo 'Must specify a connection'; return 1 };
|
||||||
@ -28,11 +30,14 @@ function WRYN_REMOTE_CONNECTOR() {
|
|||||||
|| { echo 'No such connection'; return 2 };
|
|| { echo 'No such connection'; return 2 };
|
||||||
|
|
||||||
case $COMMAND in;
|
case $COMMAND in;
|
||||||
sshfs ) sshfs $(WRYN_SSH_PARSE_ARGS $SSH_ID):$3 ${@:4} ;;
|
sshfs ) sshfs $(WRYN_SSH_PARSE_ARGS $SSH_ID):$3 ${@:4} ;;
|
||||||
ssh ) ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) ${@:3} ;;
|
ssh ) ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) ${@:3} ;;
|
||||||
cp-to ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID $3):$4 ;;
|
cp-to ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID $3):$4 ;;
|
||||||
cp-from ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID):$3 $4 ;;
|
cp-from ) scp ${@:5} $(WRYN_SCP_PARSE_ARGS $SSH_ID):$3 $4 ;;
|
||||||
copy-id ) ssh-copy-id ${@:3} $(WRYN_SSH_PARSE_ARGS $SSH_ID) ;;
|
copy-id ) ssh-copy-id ${@:3} $(WRYN_SSH_PARSE_ARGS $SSH_ID) ;;
|
||||||
|
tmux ) [ $4 ] || [ $3 == 'a' ]\
|
||||||
|
&& ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG ${@:3} \
|
||||||
|
|| ssh $(WRYN_SSH_PARSE_ARGS $SSH_ID) -t tmux $TMUX_UTF8_FLAG a -t $3 ;;
|
||||||
|
|
||||||
* ) echo "$COMMAND not implemented" ;;
|
* ) echo "$COMMAND not implemented" ;;
|
||||||
esac
|
esac
|
||||||
@ -46,7 +51,8 @@ _WRYN_REMOTE_CONNECTOR() {
|
|||||||
;
|
;
|
||||||
case "$state" in
|
case "$state" in
|
||||||
remote_command)
|
remote_command)
|
||||||
compadd -X 'Choose a connection command:' ssh sshfs cp-to cp-from copy-id
|
compadd -X 'Choose a connection command:' \
|
||||||
|
ssh sshfs cp-to cp-from copy-id tmux
|
||||||
;;
|
;;
|
||||||
connections)
|
connections)
|
||||||
compadd -X 'Choose a connection:' $(sed -n "s/$WRYN_SSH_DELIMITER.*//p" "$WRYN_SSH_CONNECTION_LIST")
|
compadd -X 'Choose a connection:' $(sed -n "s/$WRYN_SSH_DELIMITER.*//p" "$WRYN_SSH_CONNECTION_LIST")
|
||||||
@ -57,7 +63,7 @@ _WRYN_REMOTE_CONNECTOR() {
|
|||||||
ssh ) _ssh;;
|
ssh ) _ssh;;
|
||||||
sshfs ) _sshfs;;
|
sshfs ) _sshfs;;
|
||||||
cpto | cpfrom ) _scp;;
|
cpto | cpfrom ) _scp;;
|
||||||
copy-id ) _ssh-copy-id;;
|
tmux ) _tmux;;
|
||||||
* ) ;;
|
* ) ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user