[OpenBSD] create volume_control, openbsd_install
[dotfiles_afify.git] / .bashrc
blob4ebdb667918b16d2549d761e67381733feec4d04
1 #!/usr/bin/env bash
3 #==============================================================================
4 # Name : .bashrc
5 # GitHub : Afify
6 # Copyright : MIT
7 # Description : bash configuration file
8 #==============================================================================
10 #------ Export ----------------------------------------------------------------
11 export EDITOR=vim
12 export VISUAL=vim
13 export GPG_TTY=$(tty)
14 stty -ixon # Disable ctrl-s and ctrl-q.
16 #------ ALIAS -----------------------------------------------------------------
17 alias ll='ls -lahg'
18 alias k='clear'
19 alias mv='mv -i'
20 alias cp='cp -ir'
21 alias rm='rm -i'
22 alias df='df -h'
23 alias du='du -cs'
24 alias ka='killall'
25 alias sed='sed -E'
26 alias grep='grep -E'
27 alias mkdir='mkdir -p'
28 alias mk="makepkg -sri"
29 alias f="~/.scripts/find.sh"
30 alias fw="~/.scripts/find_word.sh"
31 alias fr="~/.scripts/find_replace_word.sh"
32 alias xc='xclip -sel clip <'
34 if [[ "$OSTYPE" == "openbsd"* ]]; then
35 alias lsb="dmesg | egrep '^(cd|wd|sd|fd). at '"
36 alias ka="pkill"
39 if [[ "$OSTYPE" == "linux-gnu" ]]; then
40 alias ll='ls -lahG --color=auto --group-directories-first'
41 alias pm="sudo pacman"
42 alias pmu="sudo pacman -Syyu"
43 alias pmo="sudo pacman -Rns $(pacman -Qtdq)"
44 alias pmr="sudo pacman -Rns"
45 alias aur="yaourt -Qm --aur"
46 alias grep="grep --color=always"
47 export GREP_COLOR="30;47"
50 # Edit config files
51 alias vimrc="vim ~/.vimrc"
52 alias bashrc="vim ~/.bashrc"
53 alias dwmrc="cd /mnt/data/dev/suckless/dwm-6.2/; vim config.def.h;"
54 alias blockrc="cd /mnt/data/dev/suckless/dwmblocks/; vim blocks.h;"
56 alias gdiff="~/.scripts/create_diff_git.sh"
57 alias github="eval \"$(ssh-agent -s)\"; ssh-add ~/.ssh/github"
59 alias ya="youtube-dl -i --add-metadata -f bestaudio"
60 alias yv="youtube-dl -i --add-metadata -f webm"
61 alias yvp="youtube-dl -i --add-metadata -f webm -o \"%(autonumber)s-%(title)s.%(ext)s\""
62 # alias curlf="xargs -n 1 curl -O < "
63 # alias wgetf="wget -i filename.txt"
65 #------ PROMPT ----------------------------------------------------------------
66 esc="\[\033"
67 bold="$esc[1m\]"
68 restore="$esc[00m\]"
70 white="$esc[97m\]"
71 black="$esc[30m\]"
72 dgrey="$esc[38;5;233m\]"
73 dgrey2="$esc[38;5;234m\]"
74 gold="$esc[38;5;214m\]"
75 gold2="$esc[38;5;94m\]"
76 green="$esc[38;5;2m\]"
77 orange="$esc[38;5;166m\]"
78 blue2="$esc[38;5;24m\]"
80 bg_black="$esc[48;5;0m\]"
81 bg_dgrey="$esc[48;5;233m\]"
82 bg_dgrey2="$esc[48;5;234m\]"
83 bg_gold="$esc[48;5;214m\]"
84 bg_gold2="$esc[48;5;94m\]"
85 bg_blue="$esc[48;5;27m\]"
86 bg_red="$esc[48;5;88m\]"
87 bg_mag="$esc[48;5;53m\]"
88 bg_green="$esc[48;5;2m\]"
89 bg_orange="$esc[48;5;166m\]"
90 bg_blue2="$esc[48;5;24m\]"
92 # gitbranch="\$(__git_ps1 '  %s ')"
93 gitbranch="\$(__git_ps1 ' %s ')"
94 dir_fg=$gold
95 dir_bg=$bg_black
96 dir_bgc=$black
98 branch_fg=$orange
99 branch_bg=$bg_dgrey
100 branch_bgc=$dgrey
102 # user_fg=$blue2
103 # user_bg=$bg_dgrey2
104 # user_bgc=$dgrey2
105 # sep=
107 export PS1="$dir_fg$dir_bg \W $branch_bg$dir_bgc$sep$branch_fg$gitbranch$restore$user_bgc$sep$restore "
109 #------ HISTORY CONFIG --------------------------------------------------------
110 export HISTSIZE=10000
111 export HISTFILESIZE=10000
112 export HISTTIMEFORMAT='%b %d %I:%M %p '
113 export HISTCONTROL=ignoreboth
114 export HISTIGNORE="history:pwd:exit:df:ls:ls -lahG:ll"
115 export HISTFILE=~/.cache/.bash_history
117 #------ Archive extractor -----------------------------------------------------
118 ex (){
119 if [ -f $1 ] ; then
120 case $1 in
121 *.tar.bz2) tar xjf $1 ;;
122 *.tar.gz) tar xzf $1 ;;
123 *.tar.xz) tar xf $1 ;;
124 *.xz) xz -d $1 ;;
125 *.bz2) bunzip2 $1 ;;
126 *.rar) unrar x $1 ;;
127 *.gz) gunzip $1 ;;
128 *.tar) tar xf $1 ;;
129 *.tbz2) tar xjf $1 ;;
130 *.tgz) tar xzf $1 ;;
131 *.zip) unzip $1 ;;
132 *.Z) uncompress $1;;
133 *.7z) 7z x $1 ;;
134 *) echo "'$1' cannot be extracted via ex()";;
135 esac
136 else
137 echo "'$1' is not a valid file"
141 #------ GIT -------------------------------------------------------------------
142 if [ -f ~/.git-completion.bash ]; then
143 source ~/.git-completion.bash
146 if [ -f ~/.git-prompt.sh ]; then
147 source ~/.git-prompt.sh
150 #------ MAN -------------------------------------------------------------------
151 export LESS_TERMCAP_mb=$'\e[1;32m'
152 export LESS_TERMCAP_md=$'\e[1;32m'
153 export LESS_TERMCAP_so=$'\e[01;44;37m'
154 export LESS_TERMCAP_us=$'\e[1;4;31m'
155 export LESS_TERMCAP_me=$'\e[0m'
156 export LESS_TERMCAP_se=$'\e[0m'
157 export LESS_TERMCAP_ue=$'\e[0m'