1 [[ $- != *i* ]] && return
   2 
   3 stty -ixon
   4 
   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     printf '\e]0;%s@%s: %s\a' $USER $HOSTNAME "${PWD/$HOME/\~}"
  16 } # }}}
  17 
  18 PS1='\n\[\e[`ps1_hc`m\] \w`ps1_vcs` \$\[\e[0m\] '
  19 function ps1_hc(){ # {{{
  20     local c=37 f=~/.hostcolor
  21 
  22     [[ $SSH_TTY && -f $f ]] && c=$(< $f)
  23     [[ $SUDO_USER ]] && c=31
  24 
  25     echo $c
  26 } # }}}
  27 function ps1_vcs(){ # {{{
  28     local s
  29 
  30     [[ -d .hg || -d ../.hg || -d ../../.hg ]] &&
  31     s="hg:$(hg branch) +$(hg status | wc -l)"
  32 
  33     [[ -d .git || -d ../.git || -d ../../.git ]] &&
  34     s="git:$(git name-rev --name-only @) +$(git status -s | wc -l)"
  35 
  36     [[ $s ]] &&
  37     echo " [${s/ +0/}]"
  38 } # }}}
  39 
  40 # Aliases {{{
  41 
  42 alias vi='vim'
  43 alias vim='TERM=xterm vim'
  44 
  45 alias tm='tmux a || tmux'
  46 
  47 alias tt='tree -FlCL 2'
  48 alias ll='ls -Falh --color'
  49 
  50 alias rg='ranger'
  51 alias ranger='ranger -r ~/.ranger'
  52 
  53 alias ggrep='grep -nR'
  54 alias grep='grep -iI --color'
  55 
  56 alias rsync='rsync -iPvh -rt'
  57 alias backup='rsync -L --delete --exclude-from <(cd ~
  58 find .* -maxdepth 0; find * -maxdepth 0 -type l) ~/ ~/.Backup'
  59 alias backup-camera='rsync {/media/*/*,/run/*/*/*/*/sdcard}/DCIM/Camera/ ~/.Camera'
  60 
  61 alias mpv-audio='mpv --profile audio'
  62 alias mpv-history='tac ~/.config/mpv/history.log | less'
  63 alias mpv-fan='(read u; mpv $(curl -s $u | grep -ao "http:.\+\.mp4")) <<<'
  64 
  65 alias proxy-list='curl -s https://www.socks-proxy.net | sed "s/<tr>/\n/g" |
  66 grep -P "\d+\.\d+\.\d+\.\d+" | sed "s|</\?td>|/|g" |
  67 awk -F / "{ print \$6\" \"tolower(\$9)\"://\"\$2\":\"\$4 }" | sort'
  68 
  69 u(){ local d=~/.dotfiles; [[ $1 ]] && (cd $d; vi -p "$@") || cd $d; }
  70 complete -W "$(u; find * -type f)" u
  71 
  72 # }}}
  73 # Colors {{{
  74 
  75 if [[ ! $SSH_TTY ]]; then
  76 
  77 printf "\e]11;#222228\a"
  78 printf "\e]10;#d8dade\a"
  79 
  80 printf "\e]4;0;#37373f\a"
  81 printf "\e]4;8;#4e4e56\a"
  82 
  83 printf "\e]4;1;#ff5f5f\a"
  84 printf "\e]4;9;#ff5f5f\a"
  85 
  86 printf "\e]4;2;#87af5f\a"
  87 printf "\e]4;10;#87af5f\a"
  88 
  89 printf "\e]4;3;#d7af87\a"
  90 printf "\e]4;11;#ffd75f\a"
  91 
  92 printf "\e]4;4;#5f5fff\a"
  93 printf "\e]4;12;#afafd7\a"
  94 
  95 printf "\e]4;5;#d75fff\a"
  96 printf "\e]4;13;#d75fff\a"
  97 
  98 printf "\e]4;6;#87d7d7\a"
  99 printf "\e]4;14;#87d7d6\a"
 100 
 101 printf "\e]4;7;#a8aaae\a"
 102 printf "\e]4;15;#d8dade\a"
 103 
 104 fi
 105 
 106 # }}}
 107 
 108 eval $(keychain -q --eval)
 109 source ~/.local/etc/bash_completion.d/*
 110 source /usr/share/bash-completion/bash_completion
 111 
 112 complete -W "$(start.sh)" start.sh
 113 complete -W "$(www.sh | cut -d ' ' -f 2)" www.sh
 114 
 115 [[ ! $SSH_TTY && $DISPLAY && $PWD == ~ ]] && cd ~/Desktop
[raw]