diff options
Diffstat (limited to '.shinit')
-rw-r--r-- | .shinit | 61 |
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 |