#!/bin/bash ## hack to workaround Fedora/Red Hat bug 878428 test -f /usr/share/git-core/contrib/completion/git-prompt.sh \ && . /usr/share/git-core/contrib/completion/git-prompt.sh ####################################################### ### things to do BEFORE host/user-specific settings ### ####################################################### ### .... ### ### SUBZ ### ### '''' ### git() { if grep -Fwqse "$1" "$GIT_DISABLED_COMMANDS"; then echo "You don't want this." >&2 return 1 else command git "$@" fi } grepr() { local p=$1; shift grep --color -n --exclude-dir=".git" -e "$p" -r "$@" } gitcd() { cd "$(git rev-parse --show-toplevel)" } clsz() { tput clear; tput cup $(tput lines) 0 } bcdiff() { test $# -eq 2 && diff "$@" >/dev/null && return bcompare "$@" & } vims() { # 2015-07-10 06:10:48.603953758 +0200 ~/TODO.todo local swap="$HOME/.local/share/vim/swap" find "$swap" -type f \ | xargs -r stat -c "%y %n" \ | sed " s| $swap/| | s|%|/|g s|.swp$|| s| $HOME| ~| s| \(..:..\):[^ ]* +.... | \\1 | " \ | sort \ | tac } yum_hasbin() { local bname for bname in "$@"; do yum provides "*bin/$bname" \ | grep '^.' \ | grep -E '^[0-9a-zA-Z_:.-]+ :' done } ### .... ### ### BASH ### ### '''' ### export HISTCONTROL=erasedups export HISTIGNORE="$HISTIGNORE:ls:ll:la:cd" export HISTIGNORE="$HISTIGNORE:git dc:git st" #export HISTIGNORE="$HISTIGNORE:se *:sc *" export HISTSIZE=-1 export HISTFILESIZE=100000 export GLOBIGNORE=.:.. # some more aliases alias cal='cal -m' alias cls='clear' alias ll='ls -lh' alias lla='ls -lha' alias open='gnome-open' alias diff='diff -u' alias dmesg='dmesg --time-format iso' alias pad4='sed -e "s/^/ /"' alias grep='grep --color --binary-files=without-match' alias sc='se --direction=encz.cz' alias lsblk='lsblk -o +UUID,LABEL' alias virsh='virsh --connect qemu:///system' alias xaa='xclip -o | audit2allow' alias xi='xclip -i' alias xo='xclip -o' RV_TMP="/tmp/bash-rv" mkdir -p "$RV_TMP" ### ...... ### ### OTHERS ### ### '''''' ### export LC_COLLATE=C # make sort upper first export FFOO_PRETTY=color # make green git bash trinket even cooler export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true export GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands" # disable mounting things like SFTP to ~/.gvfs when accessed # via GIO (used by nautilus etc.) export GVFS_DISABLE_FUSE=1 # disable the terrible beep sound (only for X; for tty?, blacklist pcspkr) [[ ${!DISPLAY[@]} ]] && xset b off # get rid of those .pyc files once and for all export PYTHONDONTWRITEBYTECODE=1 ssh-add -l >& /dev/null || ssh-add