Emacs changes

This commit is contained in:
Magic_RB 2020-09-05 20:46:32 +02:00
parent bd1cca59ca
commit 4cbad841cc
4 changed files with 26 additions and 12 deletions

View file

@ -40,28 +40,38 @@ vterm_prompt_end() {
}
PS1=$PS1'\[$(vterm_prompt_end)\]'
alias E="SUDO_EDITOR=\"emacsclient -a emacs\" sudoedit"
alias e="emacsclient"
if [[ ! -z "${INSIDE_EMACS+x}" ]] && [[ ! -z "${SSH_CONNECTION}" ]]
then
alias E="emacsclient-remote --sudo"
alias e="emacsclient"
else
alias E="SUDO_EDITOR=\"emacsclient -a emacs\" sudoedit"
alias e="emacsclient"
fi
[[ ! -z "${INSIDE_EMACS+x}" ]] && alias vim="e"
essh() {
ssh() {
if [[ ! -z "${INSIDE_EMACS+x}" ]]
then
#ssh -MNf -S ~/.ssh/controlmasters/%r@%h:%p $1 > /dev/null 2>&1
#ssh -S ~/.ssh/controlmasters/%r@%h:%p "rm ~/.ssh/emacs-server"
ssh \
-o 'SendEnv=INSIDE_EMACS' -o 'StreamLocalBindUnlink=yes' \
-o "SendEnv INSIDE_EMACS" \
-o "StreamLocalBindUnlink yes" \
-o "ControlMaster auto" \
-o "ControlPath ~/.ssh/controlmasters/%r@%h:%p" \
-Nf \
-R ~/.ssh/emacs-server:/run/user/1000/emacs/server \
$1
ssh \
-S ~/.ssh/controlmasters/%r@%h:%p \
-o 'SendEnv=INSIDE_EMACS' \
$@
else
ssh $@
fi
}
alias ssh="essh"
#if [[ -d "/mnt/data3/Programs/bin" ]]; then
# export PATH="/mnt/data3/Programs/bin:${PATH}"
#fi
@ -71,3 +81,5 @@ export PS1="\u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
export EDITOR="emacsclient"
export BROWSER="firefox-nightly"
trap finish EXIT

View file

@ -377,4 +377,3 @@ it is not appropriate in some cases like terminals."
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(server-start)

View file

@ -6,6 +6,9 @@ params=()
sudo=0
local=0
host=$(echo $SSH_CONNECTION | cut -d' ' -f3)
port=$(echo $SSH_CONNECTION | cut -d' ' -f4)
for p in "${@}"; do
if [[ "${p}" == "-n" ]]; then
params+=( "${p}" )
@ -26,12 +29,12 @@ for p in "${@}"; do
if [[ $(id -u) -eq 0 || ${sudo} -eq 1 ]]; then
if [[ ${local} -eq 0 ]]; then
params+=( "/ssh:$(cat /tmp/hostname)|sudo:$(hostname -f):"$(realpath -m "${p}") )
params+=( "/ssh:${host}:${port}|sudo::"$(realpath -m "${p}") )
else
params+=( "/sudo:localhost:"$(realpath -m "${p}") )
fi
else
params+=( "/ssh:$(cat /tmp/hostname):"$(realpath "${p}") )
params+=( "/ssh:${host}:${port}:"$(realpath "${p}") )
fi
IFS=${OLDIFS}

0
private_dot_ssh/.keep Normal file
View file