My dotfiles. Period.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. ### .... ###
  49. ### BASH ###
  50. ### '''' ###
  51. export HISTCONTROL=erasedups
  52. export HISTIGNORE="$HISTIGNORE:ls:ll:la:cd"
  53. export HISTIGNORE="$HISTIGNORE:git dc:git st"
  54. #export HISTIGNORE="$HISTIGNORE:se *:sc *"
  55. export HISTSIZE=-1
  56. export HISTFILESIZE=100000
  57. export GLOBIGNORE=.:..
  58. # some more aliases
  59. alias cal='cal -m'
  60. alias cls='clear'
  61. alias ll='ls -lh'
  62. alias lla='ls -lha'
  63. alias open='gnome-open'
  64. alias diff='diff -u'
  65. alias dmesg='dmesg --time-format iso'
  66. alias pad4='sed -e "s/^/ /"'
  67. alias grep='grep --color --binary-files=without-match'
  68. alias sc='se --direction=encz.cz'
  69. alias lsblk='lsblk -o +UUID,LABEL'
  70. alias virsh='virsh --connect qemu:///system'
  71. alias xaa='xclip -o | audit2allow'
  72. alias xi='xclip -i'
  73. alias xo='xclip -o'
  74. RV_TMP="/tmp/bash-rv"
  75. mkdir -p "$RV_TMP"
  76. ### ...... ###
  77. ### OTHERS ###
  78. ### '''''' ###
  79. export LC_COLLATE=C # make sort upper first
  80. export FFOO_PRETTY=color
  81. # make green git bash trinket even cooler
  82. export GIT_PS1_SHOWDIRTYSTATE=true
  83. export GIT_PS1_SHOWUNTRACKEDFILES=true
  84. export GIT_DISABLED_COMMANDS="$HOME/.gittum/disabled-commands"
  85. # disable mounting things like SFTP to ~/.gvfs when accessed
  86. # via GIO (used by nautilus etc.)
  87. export GVFS_DISABLE_FUSE=1
  88. # disable the terrible beep sound (only for X; for tty?, blacklist pcspkr)
  89. [[ ${!DISPLAY[@]} ]] && xset b off
  90. # get rid of those .pyc files once and for all
  91. export PYTHONDONTWRITEBYTECODE=1
  92. ssh-add -l >& /dev/null || ssh-add