diff options
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -26,7 +26,9 @@ _linkalias () { linkalias () { alias "$1=_linkalias $2"; } # Source the other common definitions -for f in /etc/bashrc ~/.bashrc-dotfiles ~/.bashrc-fedora ~/.bashrc-work ~/.bashrc-xml ~/.bashrc-priv; do +_bashconfs="~/.bashrc-dotfiles ~/.bashrc-fedora ~/.bashrc-work ~/.bashrc-xml ~/.bashrc-priv ~/.bashrc-preexec" +for f in ${_bashconfs}; do + f=${f/#~/$HOME} [ -f "${f}" ] && source "${f}" || : done @@ -117,3 +119,26 @@ img-qr () { || { input=$(</dev/stdin); title+="$(echo "${input}" | head -n1)"; } xloadimage -fit -shrink -title "${title}" <(qrencode -m0 -s40 -o- "${input}" ) } + +# prexec stuff + +_preexec_flag=0 +# idea is simple: auto-paginate output of selected commads that cannot do it +# on their own +# XXX: hacky, not exactly sure why this (and so far only this) works :) +preexec() { + local cmd=${1%% *} + #test ${_preexec_flag} -eq 0 && test ${BASH_SUBSHELL} -eq 0 \ + # || { _preexec_flag=0; return 0; } + test ${BASH_SUBSHELL} -eq 0 || { _preexec_flag=0; return 0; } + case "$1" in + rpm\ *|yum\ list\ *) + _preexec_flag=1 + ${1} <&- 2>&1 | ${PAGER} + trap "_preexec_flag=0; trap - RETURN;" RETURN + return 2 + ;; + esac +} + +preexec_install |