config: configure emacstty as EDITOR

This commit is contained in:
xeruf 2022-06-22 17:59:29 +02:00
parent a3fe85770f
commit a4be3fd82a
5 changed files with 9 additions and 6 deletions

View File

@ -1 +0,0 @@
/usr/share/applications/emacs.desktop

View File

@ -5,7 +5,7 @@ colors:
title: blue title: blue
default_hour: 0 default_hour: 0
default_minute: 0 default_minute: 0
editor: nvim + editor: /home/janek/.local/bin/scripts/emacstty
encrypt: false encrypt: false
highlight: true highlight: true
indent_character: '|' indent_character: '|'
@ -18,4 +18,4 @@ linewrap: 99
tagsymbols: '@' tagsymbols: '@'
template: false template: false
timeformat: '%Y-%m-%d %a %H:%M' timeformat: '%Y-%m-%d %a %H:%M'
version: v2.4.5 version: v2.8.4

View File

@ -32,6 +32,6 @@ case "$sel" in
(/etc/caddy/*) sudoedit "$sel" && caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload-or-restart caddy;; (/etc/caddy/*) sudoedit "$sel" && caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload-or-restart caddy;;
(/etc/ssh/*) sudoedit "$sel" && sudo systemctl reload-or-restart sshd;; (/etc/ssh/*) sudoedit "$sel" && sudo systemctl reload-or-restart sshd;;
(/etc/network/interfaces*) sudoedit "$sel" && sudo service networking reload;; (/etc/network/interfaces*) sudoedit "$sel" && sudo service networking reload;;
(*) $(test -w "$sel" || echo sudo) "$EDITOR" "$sel";; (*) $(test -w "$sel" || echo sudo --preserve-env=ALTERNATE_EDITOR) $EDITOR "$sel";;
esac esac
echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache" echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache"

3
.local/bin/scripts/emacstty Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh -e
# Emacs in the terminal
emacsclient --tty --alternate-editor="" "$@"

View File

@ -62,7 +62,8 @@ export CONFIG_SHELLS="$XDG_CONFIG_HOME"/shell
mkdir -p "$XDG_STATE_HOME/zsh" mkdir -p "$XDG_STATE_HOME/zsh"
# environment # environment
export PATH="$HOME/.local/bin/scripts:$HOME/.local/bin:$PATH:$XDG_CONFIG_HOME/emacs/bin:$GOPATH/bin:$XDG_DATA_HOME/gem/ruby/3.0.0/bin:$ANDROID_SDK_ROOT/platform-tools:$CARGO_HOME/bin" BIN="$HOME/.local/bin/scripts"
export PATH="$BIN:$HOME/.local/bin:$PATH:$XDG_CONFIG_HOME/emacs/bin:$GOPATH/bin:$XDG_DATA_HOME/gem/ruby/3.0.0/bin:$ANDROID_SDK_ROOT/platform-tools:$CARGO_HOME/bin"
export ALTERNATE_EDITOR="$( export ALTERNATE_EDITOR="$(
if which nvim >/dev/null if which nvim >/dev/null
then echo nvim then echo nvim
@ -70,7 +71,7 @@ export ALTERNATE_EDITOR="$(
fi)" fi)"
export EDITOR="$( export EDITOR="$(
if which emacs >/dev/null if which emacs >/dev/null
then echo emacsclient #'emacsclient -a ""' then echo $BIN/emacstty
else echo $ALTERNATE_EDITOR else echo $ALTERNATE_EDITOR
fi fi
)" )"