bashrc (3977B)
1 # stuff {{{1 2 # If not running interactively, don't do anything 3 case $- in 4 *i*) ;; 5 *) return;; 6 esac 7 8 # don't put duplicate lines or lines starting with space in the history. 9 HISTCONTROL=ignoreboth 10 11 # append to the history file, don't overwrite it 12 shopt -s histappend 13 14 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 15 HISTSIZE=1000 16 HISTFILESIZE=2000 17 18 # check the window size after each command and, if necessary, 19 # update the values of LINES and COLUMNS. 20 shopt -s checkwinsize 21 22 # make less more friendly for non-text input files, see lesspipe(1) 23 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 24 25 # enable programmable completion features 26 if ! shopt -oq posix; then 27 if [ -f /usr/share/bash-completion/bash_completion ]; then 28 . /usr/share/bash-completion/bash_completion 29 elif [ -f /etc/bash_completion ]; then 30 . /etc/bash_completion 31 fi 32 fi 33 #}}} 34 # prompt statement {{{1 35 # change color of branch name 36 git_color() { 37 if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then 38 local color="${Cyan}" 39 40 # modified 41 git diff --no-ext-diff --quiet --exit-code || color="${Red}" 42 43 # staged 44 if git rev-parse --quiet --verify HEAD >/dev/null; then 45 git diff-index --cached --quiet HEAD -- || color="${IRed}" 46 fi 47 48 # stashed 49 git rev-parse --verify refs/stash >/dev/null 2>&1 && color="${Yellow}" 50 51 echo "$color" 52 fi 53 } 54 55 PS1='\[${Blue}\]\u \ 56 \[$(echk_color)\]$(echk_random_face) \ 57 \[$(git_color)\]$(__git_ps1 "%s ")\[${Yellow}\]\ 58 $([ \j -gt 0 ] && echo "\j ")\[${White}\]\ 59 \$\[${Color_Off}\] ' 60 61 # PS1='\[${White}\]\$\[${Color_Off}\] ' 62 # PS1="${Blue}\u@\h${Color_Off}:${Cyan}\w${White}❯❯${Color_Off} " 63 # PS1='C:${PWD////\\\\}> ' 64 65 PS2='\[${White}\]\$\[${Color_Off}\] ' 66 67 PROMPT_COMMAND="[ -d .git -o -f .sett ] && sett" 68 69 # basic {{{1 70 export EDITOR='vim' 71 72 # allow for color support in terminal 73 if [ "$TERM" == "xterm" ]; then 74 export TERM=xterm-256color 75 fi 76 77 export GPG_TTY=$(tty) 78 79 # load other files 80 source ~/bin/ED.sh 81 source ~/bin/echk 82 source ~/bin/colors.sh 83 source ~/bin/z.sh 84 85 # add dart's bin to PATH 86 if [ -d "/usr/lib/dart/bin" ] ; then 87 PATH="/usr/lib/dart/bin:$PATH" 88 fi 89 if [ -d "$HOME/code/dart/flutter/bin" ] ; then 90 PATH="$HOME/code/dart/flutter/bin:$PATH" 91 fi 92 93 # aliases {{{1 94 # better tab complete 95 bind '"\t":menu-complete' 96 97 # enable color support 98 if [ -x /usr/bin/dircolors ]; then 99 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 100 alias ls='ls --color=auto -F' 101 alias dir='dir --color=auto' 102 alias vdir='vdir --color=auto' 103 104 alias grep='grep --color=auto' 105 alias fgrep='fgrep --color=auto' 106 alias egrep='egrep --color=auto' 107 108 alias diff='diff --color=auto' 109 fi 110 111 # easily change back directories 112 alias ..='cd ..' 113 alias ...='cd ../..' 114 alias ....='cd ../../..' 115 alias .....='cd ../../../..' 116 117 # better ls-ing 118 alias ll='ls -alF' 119 alias la='ls -A' 120 121 # make these commands safer 122 alias mv='mv -i' 123 alias cp='cp -i' 124 alias ln='ln -i' 125 alias rm='rm -i' 126 127 # shortcuts 128 alias sb='source ~/.bashrc' 129 alias cmon='sudo "$BASH" -c "$(history -p !!)"' 130 alias emacs='emacs --no-window-system' 131 alias matlab='matlab -nodesktop' 132 alias old='tg old' 133 alias gdb='gdb -q' 134 alias db='gdb -q -ex run ./$(basename $PWD)' # TODO smart script to allow argument 135 alias v='valgrind --leak-check=full --show-leak-kinds=all' 136 alias gf='echo haha, you wish' 137 alias ytdlp='youtube-dl --extract-audio --audio-format mp3 -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"' 138 alias newline='echo >>' 139 alias term='tabbed -c st -w' 140 alias f='feh --force-aliasing --auto-zoom --auto-rotate --scale-down' 141 alias py='python3 -q' 142 alias exif='identify -verbose' # TODO only get exif info 143 alias todo='grep -RI TODO * --exclude-dir=public' # TODO use git grep if in git repo 144 alias gg='git grep --untracked' 145 alias dock-run='docker run -it --rm --detach-keys='ctrl-e,e' -v $PWD:$PWD -w $PWD' 146 alias fonts-reload='fc-cache -f -v' 147 148 #}}}