*nohtml*

bashrc

   1 [[ $- != *i* ]] && return
   2 cat ~/.cache/wall/colors-*
   3 
   4 stty -ixon
   5 shopt -s autocd
   6 shopt -s globstar
   7 
   8 HISTSIZE= HISTFILESIZE=
   9 HISTTIMEFORMAT='[%F %T] '
  10 HISTCONTROL=ignorespace:ignoredups
  11 
  12 PROMPT_COMMAND=precmd
  13 function precmd(){ # {{{
  14     history -a
  15     ps1_col=$(( (${ps1_col:-$RANDOM} + 1) % 6 ))
  16     printf '\e]0;%s@%s:%s\a' $USER $HOSTNAME "${PWD/~/\~}"
  17 } # }}}
  18 
  19 PS1='\n\[\e[1;3`ps1_col`m\] `ps1_ssh`\w`ps1_git` \$\[\e[0m\] '
  20 function ps1_col(){ # {{{
  21     [[ $SUDO_USER ]] && echo 1 ||
  22     echo $(( $ps1_col + 2 ))
  23 } # }}}
  24 function ps1_ssh(){ # {{{
  25     [[ $SSH_TTY ]] && echo $USER@$HOSTNAME:
  26 } # }}}
  27 function ps1_git(){ # {{{
  28     [[ $(git rev-parse --show-toplevel 2>&-) ]] || return
  29     local a=$(git rev-parse --abbrev-ref HEAD 2>&-)
  30     local b=$(git status -s | wc -l)
  31     local c=$(git log --branches --not --remotes --oneline | wc -l)
  32     echo " [$a:+$b:*$c]" | sed 's/:[+*]0//g'
  33 } # }}}
  34 
  35 [[ $TERM != screen ]] &&
  36 TERM=xterm && printf '\e[0 q' &&
  37 alias htop='TERM=xterm-256color htop'
  38 
  39 alias v='vi'
  40 alias vi='vim -p'
  41 
  42 alias gt='git'
  43 alias rg='ranger'
  44 alias tm='tmux a || tmux'
  45 
  46 alias ll='ls -h --color'
  47 alias lll='ll -al --full-time'
  48 
  49 u(){ # {{{
  50     [[ ! $@ ]] && cd ~/.dotfiles && return
  51     (u; vi $(git ls-files $(for i in "$@"; do echo "*$i*"; done)))
  52 }
  53 
  54 _u(){
  55     COMPREPLY=($(compgen -W "$(
  56         u; git ls-files | sed 's#^config/##'
  57     )" -- ${COMP_WORDS[COMP_CWORD]}))
  58 }
  59 
  60 complete -F _u u # }}}
  61 
  62 alias grep='grep -i --color'
  63 alias rsync='rsync -iPvh -rtl'
  64 
  65 alias backup='rsync -F /home ~/.Backup'
  66 alias backup-android='adb pull -a /sdcard/DCIM/Camera ~/Pictures'
  67 alias backup-iphone='rsync phone:/User/Media/DCIM/*/ ~/Pictures/Camera'
  68 
  69 alias mpv-audio='mpv --profile audio'
  70 alias mpv-history='tac ~/.config/mpv/history.log | less'
  71 alias mpv-fan='(read u; mpv $(curl -s $u | grep -ao "http:.*\.mp4")) <<<'
  72 
  73 eval $(keychain -q --eval)
  74 source /usr/share/bash-completion/bash_completion
  75 
  76 source ~/.local/src/z.sh