Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.6 KiB

13 years ago
8 years ago
11 years ago
11 years ago
  1. # Path stuff. This accounts for, at least:
  2. #
  3. # - a custom Firefox install
  4. # - some bin dirs in my homedir
  5. # - golang
  6. # - some Chef bullshit
  7. # - ansible
  8. #
  9. # Beware that other modifications to path might be made in .zshrc or .bashrc
  10. export GOPATH=~/gocode
  11. export PATH=~/firefox:~/bin:/usr/local/bin:~/.local/bin/:$PATH:$GOPATH/bin:~/.chefdk/gem/ruby/2.3.0/bin
  12. # Needed for ansible - wouldn't surprise me if this interfered with other
  13. # things:
  14. # export PYTHONPATH=~/code/ansible/lib
  15. # Debian stuff:
  16. export DEBEMAIL="bbearnes@gmail.com"
  17. export DEBFULLNAME="Brennen Bearnes"
  18. # Explicitly set default editor:
  19. export EDITOR=`which vim`
  20. # Configure less(1):
  21. export LESS='-FiRSX'
  22. # Configure fzf fuzzyfinder:
  23. export FZF_CTRL_R_OPTS='-e' # exact match by default - see fzf(1)
  24. # Aliases, various and sundry: {{{
  25. alias ac='apt-cache'
  26. alias agu='sudo apt-get update && sudo apt-get upgrade'
  27. alias c="commandlog"
  28. alias g='git'
  29. alias gitsu='git submodule sync && git submodule update'
  30. alias l='ls -CF'
  31. alias la='ls -A'
  32. alias lal='ls -Al'
  33. alias lah='ls -Alh'
  34. alias ll='ls -l'
  35. alias ls='ls --color'
  36. alias m='make'
  37. alias s='sudo'
  38. alias st='mr -m stat' # myrepo status, minimal output
  39. alias v='vim'
  40. alias vt='vim `todaydir`'
  41. # How big is the terminal?
  42. alias dim='echo $(tput cols)x$(tput lines)'
  43. # vi life:
  44. alias :e='vim'
  45. alias :q='exit'
  46. alias :wq='exit'
  47. alias :r='cat'
  48. # Navigation:
  49. alias p='cd ~/p1k3'
  50. alias ct='cd `todaydir`'
  51. # Get a persistent directory history menu in fzf - originally written for dmenu
  52. # and inspired by jholland at:
  53. # http://hints.macworld.com/article.php?story=20050806202859392
  54. # I get the feeling that there's probably a more idiomatic way to do what
  55. # I want here, but for the moment it's nice. See: https://p1k3.com/2016/5/17/
  56. alias h='cd $(tail -500 ~/.directory_history | sed "s/^:[^;]*;//" | tac | unsorted-unique | fzf-tmux)'
  57. alias ack='ack-grep'
  58. # }}}
  59. # Functions: {{{
  60. function parse_git_branch {
  61. # Formerly:
  62. # ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  63. # echo "("${ref#refs/heads/}") "
  64. # Largely borrowed from:
  65. # https://github.com/robacarp/config_files/commit/5d983240d509bf4f7815ed822c0e868ccce08a79
  66. git_status=$(git status --porcelain -b 2> /dev/null) || return
  67. echo $git_status | awk '
  68. BEGIN {
  69. status["untracked"] = 0
  70. status["modifications"] = 0
  71. status["unmerged"] = 0
  72. }
  73. $1 ~ /##/ {
  74. split($2, branch_names, ".")
  75. }
  76. $1 ~ /\?\?/ { status["untracked"] ++ }
  77. $1 ~ /M/ { status["modifications"] ++ }
  78. $1 ~ /[DAU][DAU]/ { status["unmerged"] ++ }
  79. END {
  80. printf "(%s %i/%i) ", branch_names[1], status["modifications"], status["untracked"]
  81. }
  82. '
  83. }
  84. # }}}