summaryrefslogtreecommitdiff
path: root/.shinit
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-11-23 23:35:59 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-11-24 12:42:27 -0700
commitc67d4836f4d6d5e6c8ef4e2de38bd21ccb6ee1a1 (patch)
treefded906652b6bf03c60e0c133a368c5027cd4d1e /.shinit
parentaa5a315a0876431105f73da75de9ddfa89e907d3 (diff)
downloaddotfiles-c67d4836f4d6d5e6c8ef4e2de38bd21ccb6ee1a1.tar.gz
tidy and simplify shell init
Rely on SPWCRONTAB property to set PATH for cronjobs, and otherwise rely on .profile, .xsessionrc etc. to set PATH, once, at login. Just archive scripts I haven't used lately which might otherwise need more significant adjustments, or appear to be broken in other ways.
Diffstat (limited to '.shinit')
-rw-r--r--.shinit61
1 files changed, 61 insertions, 0 deletions
diff --git a/.shinit b/.shinit
new file mode 100644
index 00000000..4201f08b
--- /dev/null
+++ b/.shinit
@@ -0,0 +1,61 @@
+# -*- mode: sh -*-
+
+if [ "$DESKTOP_SESSION" = i3 -o "$XDG_CURRENT_DESKTOP" = sway ] \
+ && command -v emacs >/dev/null; then
+ EDITOR="emacsclient -c"; VISUAL="$EDITOR"
+fi
+
+ls --version 2>/dev/null | grep -q "GNU coreutils" \
+ && alias ls="ls --color=auto --literal --classify"
+grep --version 2>/dev/null | grep -q "GNU grep" \
+ && alias grep="grep --color=auto"
+
+alias e="$EDITOR"
+alias d="emacsclient -te '(dired \".\")'"
+alias ta="tmux new-session -A -s default"
+alias rax="screen -URaAx"
+alias mrs="src-register-all && mr -m status"
+alias gdbmacs="emacsclient -tc -sgdbmacs"
+alias g="git"
+alias ga="git annex"
+# useful to check whether a rebase introduced any changes to files
+alias rld="git diff @{1}..@{0}"
+alias athvpn="sshuttle -r athena 0/0 --dns"
+alias grepcopy="grep --color=always -Eir '(copyright|©)' * | less -R"
+
+upenv () {
+ # don't want to do this outside of tmux as then tmux show-environment will
+ # show values for the 'default' session which may be irrelevant to us
+ if [ -n "$TMUX" ]; then
+ local IFS=$'\n'
+ for var in $(tmux show-environment | grep -v "^-"); do
+ eval "export \"$var\""
+ done
+ fi
+ emacsclient --spw/update-environment
+ emacsclient -sgdbmacs --spw/update-environment
+}
+
+#### Host-specific: ftp-master.debian.org ####
+
+if [ -d "/srv/ftp-master.debian.org" ]; then
+ alias newlocks="cd /srv/ftp-master.debian.org/lock/new/ && ls -l"
+ newlock () {
+ touch /srv/ftp-master.debian.org/lock/new/"$1"
+ }
+
+ newunlock () {
+ rm /srv/ftp-master.debian.org/lock/new/"$1"
+ }
+
+ pn () {
+ cd /srv/ftp-master.debian.org/queue/new
+ # We need VISUAL=emacsclient because dak's utils.call_editor fails
+ # when VISUAL contains both the editor's name and arguments like -t.
+ if [ -n "$1" ]; then
+ VISUAL=emacsclient dak process-new "$1"*changes
+ else
+ VISUAL=emacsclient dak process-new -b
+ fi
+ }
+fi