mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 17:46:14 +01:00
Emacs changes
This commit is contained in:
parent
fde825536d
commit
1baf468127
17
dot_bashrc
17
dot_bashrc
|
@ -22,7 +22,7 @@ if [[ -d "${HOME}/.yarn/bin" ]]; then
|
|||
export PATH="${HOME}/.yarn/bin:${PATH}"
|
||||
fi
|
||||
|
||||
vterm_printf(){
|
||||
vterm_printf() {
|
||||
if [ -n "$TMUX" ]; then
|
||||
# Tell tmux to pass the escape sequences through
|
||||
# (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324)
|
||||
|
@ -35,7 +35,7 @@ vterm_printf(){
|
|||
fi
|
||||
}
|
||||
|
||||
vterm_prompt_end(){
|
||||
vterm_prompt_end() {
|
||||
vterm_printf "\u@\[\e[37m\]\h\[\e[m\]:\[\e[32m\]\w\[\e[m\]\[\e[31m\]\\$\[\e[m\] "
|
||||
}
|
||||
PS1=$PS1'\[$(vterm_prompt_end)\]'
|
||||
|
@ -43,6 +43,19 @@ PS1=$PS1'\[$(vterm_prompt_end)\]'
|
|||
alias E="SUDO_EDITOR=\"emacsclient -a emacs\" sudoedit"
|
||||
alias e="emacsclient"
|
||||
|
||||
essh() {
|
||||
ssh -MNf -S ~/.ssh/controlmasters/%r@%h:%p $1 > /dev/null 2>&1
|
||||
|
||||
ssh -S ~/.ssh/controlmasters/%r@%h:%p $1 "mkdir -p /tmp/bin"
|
||||
ssh -S ~/.ssh/controlmasters/%r@%h:%p $1 "echo $1 > /tmp/hostname"
|
||||
scp -o "ControlPath ~/.ssh/controlmasters/%r@%h:%p" $(which emacsclient) $1:/tmp/bin/emacsclient > /dev/null
|
||||
scp -o "ControlPath ~/.ssh/controlmasters/%r@%h:%p" $(which emacsclient-remote) $1:/tmp/bin/emacsclient-remote > /dev/null
|
||||
ssh -S ~/.ssh/controlmasters/%r@%h:%p -R ~/.ssh/emacs-server:/run/user/1000/emacs/server $1 -t 'export PATH=/tmp/bin:$PATH ; bash -l'
|
||||
ssh -S ~/.ssh/controlmasters/%r@%h:%p $1 "rm -r /tmp/bin/ /tmp/hostname ~/.ssh/emacs-server"
|
||||
ssh -S ~/.ssh/controlmasters/%r@%h:%p -O stop $1 > /dev/null 2>&1
|
||||
}
|
||||
complete -F _known_hosts essh
|
||||
|
||||
[[ ! -z "${INSIDE_EMACS}" ]] && alias vim="e"
|
||||
|
||||
#if [[ -d "/mnt/data3/Programs/bin" ]]; then
|
||||
|
|
16
dot_emacs
16
dot_emacs
|
@ -41,6 +41,8 @@ There are two things you can do about this warning:
|
|||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
|
||||
(add-to-list 'load-path "~/.emacs.d/lisp/")
|
||||
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package)
|
||||
|
@ -219,10 +221,15 @@ it is not appropriate in some cases like terminals."
|
|||
(use-package all-the-icons
|
||||
:ensure t)
|
||||
|
||||
(use-package telephone-line
|
||||
(use-package doom-modeline
|
||||
:ensure t
|
||||
:config
|
||||
(telephone-line-mode 1))
|
||||
(doom-modeline-mode))
|
||||
|
||||
;(use-package telephone-line
|
||||
; :ensure t
|
||||
; :config
|
||||
; (telephone-line-mode 1))
|
||||
|
||||
(use-package chess
|
||||
:ensure t)
|
||||
|
@ -343,8 +350,6 @@ it is not appropriate in some cases like terminals."
|
|||
;; enable parenthesis and quotes pairing thing
|
||||
(electric-pair-mode)
|
||||
|
||||
(server-start)
|
||||
|
||||
;; fullscreen
|
||||
(defun fullscreen ()
|
||||
(interactive)
|
||||
|
@ -371,4 +376,5 @@ it is not appropriate in some cases like terminals."
|
|||
;; compositor based transparency
|
||||
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
|
||||
|
||||
;(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
(server-start)
|
||||
|
||||
|
|
41
dot_local/bin/executable_emacsclient-remote
Normal file
41
dot_local/bin/executable_emacsclient-remote
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
# Open file on a remote Emacs server.
|
||||
# https://andy.wordpress.com/2013/01/03/automatic-emacsclient/ with added sudo.
|
||||
|
||||
params=()
|
||||
sudo=0
|
||||
local=0
|
||||
|
||||
for p in "${@}"; do
|
||||
if [[ "${p}" == "-n" ]]; then
|
||||
params+=( "${p}" )
|
||||
elif [[ "${p}" == "-c" ]]; then
|
||||
params+=( "${p}" )
|
||||
elif [[ "${p:0:1}" == "+" ]]; then
|
||||
params+=( "${p}" )
|
||||
elif [[ "${p}" == "--sudo" ]]; then
|
||||
sudo=1
|
||||
elif [[ "${p}" == "--local" ]]; then
|
||||
# Use local server, for use with --sudo.
|
||||
local=1
|
||||
else
|
||||
# Setting field separator to newline so that filenames with spaces will
|
||||
# not be split up into 2 array elements.
|
||||
OLDIFS=${IFS}
|
||||
IFS=$'\n'
|
||||
|
||||
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}") )
|
||||
else
|
||||
params+=( "/sudo:localhost:"$(realpath -m "${p}") )
|
||||
fi
|
||||
else
|
||||
params+=( "/ssh:$(cat /tmp/hostname):"$(realpath "${p}") )
|
||||
fi
|
||||
|
||||
IFS=${OLDIFS}
|
||||
fi
|
||||
done
|
||||
|
||||
emacsclient -s ~/.ssh/emacs-server "${params[@]}"
|
0
private_dot_emacs.d/.keep
Normal file
0
private_dot_emacs.d/.keep
Normal file
0
private_dot_emacs.d/lisp/.keep
Normal file
0
private_dot_emacs.d/lisp/.keep
Normal file
Loading…
Reference in a new issue