function which runs current zshrc on in remote shell

This commit is contained in:
Paweł Płazieński 2015-12-21 21:29:06 +01:00
parent 7260ad08d5
commit c692428358

14
.zshrc
View File

@ -438,6 +438,20 @@ maven_read_project() {
add-zsh-hook chpwd maven_read_project add-zsh-hook chpwd maven_read_project
#---------------------------------- Copy zshrc remote -------------------------
sshc() {
local source target
source=${ZDOTDIR:-$HOME}
target="/tmp/.zdot-${RANDOM}"
ssh -q -o "ControlPath=/tmp/.cm-%r@%h:%p" -o "ControlMaster=yes" -o "ControlPersist=yes" $1 'false'
ssh -q -o "ControlPath=/tmp/.cm-%r@%h:%p" $1 "mkdir $target"
scp -q -o "ControlPath=/tmp/.cm-%r@%h:%p" $source/.zshrc $1:$target/.zshrc
ssh -q -o "ControlPath=/tmp/.cm-%r@%h:%p" $1 -t "ZDOTDIR=$target exec zsh -l"
ssh -q -o "ControlPath=/tmp/.cm-%r@%h:%p" $1 "rm -r $target"
ssh -q -o "ControlPath=/tmp/.cm-%r@%h:%p" -O stop $1
}
#---------------------------------- Miscellaneous ---------------------------- #---------------------------------- Miscellaneous ----------------------------
setopt extended_glob setopt extended_glob