bashrc

   1 [[ -d ~/.cache/wal ]] &&
   2 cat ~/.cache/wal/sequences &&
   3 source ~/.cache/wal/colors-tty.sh
   4 
   5 [[ $- != *i* ]] && return
   6 
   7 stty -ixon
   8 shopt -s autocd
   9 shopt -s globstar
  10 
  11 [[ $TERM == xterm* ]] &&
  12 TERM=xterm
  13 
  14 HISTSIZE= HISTFILESIZE=
  15 HISTTIMEFORMAT='[%F %T] '
  16 HISTCONTROL=ignorespace:ignoredups
  17 
  18 PROMPT_COMMAND=precmd
  19 function precmd(){ # {{{
  20     history -a
  21     printf '\e]0;%s@%s: %s\a' $USER $HOSTNAME "${PWD/$HOME/\~}"
  22 } # }}}
  23 
  24 PS1='\n\[\e[`ps1_hc`m\] \w`ps1_vc` \$\[\e[0m\] '
  25 function ps1_hc(){ # {{{
  26     [[ $SUDO_USER ]] && echo 31 ||
  27     [[ $SSH_TTY ]] && echo 33 || echo 37
  28 } # }}}
  29 function ps1_vc(){ # {{{
  30     [[ -d .hg  ]] && echo " [hg +$(hg status | wc -l)]" | sed 's/ +0//'
  31     [[ -d .git ]] && echo " [git +$(git status -s | wc -l)]" | sed 's/ +0//'
  32 } # }}}
  33 
  34 alias vi='vim -p'
  35 alias vg='gvim-rt'
  36 alias rg='ranger'
  37 alias tm='tmux a || tmux'
  38 
  39 alias tt='tree -FlCL 2'
  40 alias ll='ls -Flh --color'
  41 alias lll='ll -A --time-style +"%F %T"'
  42 alias ttt='tt -L 10'
  43 
  44 alias d='cd ~/Desktop'
  45 alias l='cd ~/Projects/lexa.by'
  46 
  47 alias grep='grep -i --color'
  48 alias rsync='rsync -iPvh -rt'
  49 
  50 alias backup='rsync -L --exclude lost+\* /media/Home ~/.Backup'
  51 alias backup-camera='rsync -K /media/*/*/DCIM/Camera ~/.Backup'
  52 
  53 alias mpv-audio='mpv --profile audio'
  54 alias mpv-history='tac ~/.config/mpv/history.log | less'
  55 alias mpv-fan='(read u; mpv $(curl -s $u | grep -ao "http:.*\.mp4")) <<<'
  56 
  57 alias proxy-list='w3m -dump -cols 100 socks-proxy.net | sed "1,37d; 119,\$d"'
  58 
  59 u(){ # {{{
  60     [[ ! $@ ]] &&
  61     cd ~/.dotfiles &&
  62     return
  63 
  64     (u; vi $(for i in "$@"; do
  65         [[ -f config/$i ]] &&
  66         echo config/$i || echo $i
  67     done))
  68 } # }}}
  69 complete -W "$(u; find * -type f | sed 's#^config/##')" u
  70 
  71 eval $(keychain -q --eval)
  72 
  73 [[ -d ~/.local/etc/bash_completion.d ]] &&
  74 source ~/.local/etc/bash_completion.d/*
  75 source /usr/share/bash-completion/bash_completion