*nohtml*

bashrc

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