# --- preferences # load standard environment variables . $HOME/.shenv # '>' is a nice prompt char because it need not be followed by a # space. It is easy to distinguish the command from the prompt PS1='\[\e[1m\]$(exit_code=$?; test $exit_code -eq 0 || printf %s $exit_code " ")${debian_chroot:+($debian_chroot)}\u@\h:\w>\[\e[0m\]' # if this is an xterm set its title to user@host:dir # (this doesn't stop the likes of ncmpcpp setting a title) case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\a\]$PS1" ;; *) ;; esac # enable better completion if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # history settings HISTCONTROL=ignorespace:ignoredups HISTSIZE=5000 HISTFILESIZE=5000 HISTIGNORE="ls" # colon-separated shopt -s histappend # make less more friendly for non-text input files; see lesspipe(1) if [ -x /usr/bin/lesspipe ]; then eval "$(lesspipe)" fi . $HOME/.bash_defns # --- aliases alias ls="ls --color=auto --literal --classify" alias grep="grep --colour=auto" alias e="$EDITOR" alias d="emacsclient -cne '(dired \".\")' >/dev/null" # alias m="emacsclient -c -n -e '(progn (magit-status \".\") \ # (delete-other-windows))' >/dev/null" alias ta="tmux new-session -A -s default" alias rax="screen -URaAx" alias new-login-shell="exec su -l $USER" # get new UNIX group without relog alias mrs="src-register-all && mr -m status" alias b="bts --mbox show" # alias develacc='sudo machinectl shell spw@develacc \ # $(sudo enter-develacc /bin/sh -c "getent passwd spw | cut -d: -f7")' # alias develaccr='sudo machinectl shell root@develacc \ # $(sudo enter-develacc /bin/sh -c "getent passwd root | cut -d: -f7")' # --- more powerful aliases built with shell functions secs () { for i in $(seq $1 -1 1); do echo $i sleep 1 done echo 0 } 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 for var in $(tmux show-environment | grep -v "^-"); do eval "export $var" done fi update-emacs-daemon-environment } # --- host-specific aliases/functions # 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 some # arguments to it, as mine does if [[ $1 ]]; then VISUAL=emacsclient dak process-new "$1"*changes else VISUAL=emacsclient dak process-new -b fi } fi