My dotfiles. Period.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/bash
  2. ## hack to workaround Fedora/Red Hat bug 878428
  3. test -f /usr/share/git-core/contrib/completion/git-prompt.sh \
  4. && . /usr/share/git-core/contrib/completion/git-prompt.sh
  5. #######################################################
  6. ### things to do BEFORE host/user-specific settings ###
  7. #######################################################
  8. ### .... ###
  9. ### SUBZ ###
  10. ### '''' ###
  11. git() {
  12. if grep -Fwqse "$1" "$GIT_DISABLED_COMMANDS"; then
  13. echo "You don't want this." >&2
  14. return 1
  15. else
  16. command git "$@"
  17. fi
  18. }
  19. grepr() {
  20. local p=$1; shift
  21. grep --color -n --exclude-dir=".git" -e "$p" -r "$@"
  22. }
  23. gitcd() {
  24. cd "$(git rev-parse --show-toplevel)"
  25. }
  26. clsz() {
  27. tput clear; tput cup $(tput lines) 0
  28. }
  29. bcdiff() {
  30. test $# -eq 2 && diff "$@" >/dev/null && return
  31. bcompare "$@" &
  32. }
  33. vims() {
  34. # 2015-07-10 06:10:48.603953758 +0200 ~/TODO.todo
  35. local swap="$HOME/.local/share/vim/swap"
  36. find "$swap" -type f \
  37. | xargs stat -c "%y %n" \
  38. | sed "
  39. s| $swap/| |
  40. s|%|/|g
  41. s|.swp$||
  42. s| $HOME| ~|
  43. s| \(..:..\):[^ ]* +.... | \\1 |
  44. " \
  45. | sort \
  46. | tac
  47. }
  48. yum_hasbin() {
  49. local bname
  50. for bname in "$@";
  51. do
  52. yum provides "*bin/$bname"
  53. done
  54. }
  55. ### .... ###
  56. ### BASH ###
  57. ### '''' ###
  58. export HISTCONTROL=erasedups
  59. export HISTIGNORE="$HISTIGNORE:ls:ll:la:cd"
  60. export HISTIGNORE="$HISTIGNORE:git dc:git st"
  61. #export HISTIGNORE="$HISTIGNORE:se *:sc *"
  62. export HISTSIZE=-1
  63. export HISTFILESIZE=100000
  64. export GLOBIGNORE=.:..
  65. # some more aliases
  66. alias cal='cal -m'
  67. alias cls='clear'
  68. alias ll='ls -lh'
  69. alias lla='ls -lha'
  70. alias open='gnome-open'
  71. alias diff='diff -u'
  72. alias dmesg='dmesg --time-format iso'
  73. alias pad4='sed -e "s/^/ /"'
  74. alias grep='grep --color --binary-files=without-match'
  75. alias sc='se --direction=encz.cz'
  76. alias lsblk='lsblk -o +UUID,LABEL'
  77. alias virsh='virsh --connect qemu:///system'
  78. alias xaa='xclip -o | audit2allow'
  79. alias xi='xclip -i'
  80. alias xo='xclip -o'
  81. RV_TMP="/tmp/bash-rv"
  82. mkdir -p "$RV_TMP"
  83. ### ...... ###
  84. ### OTHERS ###
  85. ### '''''' ###
  86. export LC_COLLATE=C # make sort upper first
  87. export FFOO_PRETTY=color
  88. # make green git bash trinket even cooler
  89. export GIT_PS1_SHOWDIRTYSTATE=true
  90. export GIT_PS1_SHOWUNTRACKEDFILES=true
  91. export GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
  92. # disable mounting things like SFTP to ~/.gvfs when accessed
  93. # via GIO (used by nautilus etc.)
  94. export GVFS_DISABLE_FUSE=1
  95. # disable the terrible beep sound (only for X; for tty?, blacklist pcspkr)
  96. [[ ${!DISPLAY[@]} ]] && xset b off
  97. # get rid of those .pyc files once and for all
  98. export PYTHONDONTWRITEBYTECODE=1
  99. ssh-add -l >& /dev/null || ssh-add