My dotfiles. Period.

main.bashrc 2.7KB

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