[FreeBSD] add crossplatform script & pkg_base
[dotfiles_afify.git] / .bashrc
blobc9cf0de4f3229734ddea378e02a8a6e255bcc791
1 #!/usr/bin/env bash
3 #==============================================================================
4 # Name : .bashrc
5 # GitHub : HassanAfify
6 # Copyright : MIT
7 # Version : 0.1
8 # Description :
9 #==============================================================================
12 #------ Export ----------------------------------------------------------------
14 export EDITOR=vim
15 export VISUAL=vim
16 stty -ixon # Disable ctrl-s and ctrl-q.
18 #------ ALIAS -----------------------------------------------------------------
20 alias ll='ls -lahG --color=auto --group-directories-first'
21 alias k='clear'
22 alias mv='mv -i'
23 alias cp='cp -ir'
24 alias rm='rm -i'
25 alias df='df -h'
26 alias du='du -cs'
27 alias ka='killall'
28 alias sed='sed -E'
29 alias grep='grep -E'
30 alias mkdir='mkdir -p'
31 alias mk="makepkg -sri"
32 alias f="~/.scripts/find.sh"
33 alias fw="~/.scripts/find_word.sh"
34 alias fr="~/.scripts/find_replace_word.sh"
35 alias xc='xclip -sel clip <'
37 alias pm="sudo pacman"
38 alias pmu="sudo pacman -Syyu"
39 alias pmo="sudo pacman -Rns $(pacman -Qtdq)"
40 alias pmr="sudo pacman -Rns"
42 # Edit config files
43 alias vimrc="vim ~/.vimrc"
44 alias bashrc="vim ~/.bashrc"
45 alias dwmrc="cd /mnt/data/dev/suckless/dwm-6.2/; vim config.def.h;"
46 alias blockrc="cd /mnt/data/dev/suckless/dwmblocks/; vim blocks.h;"
48 alias gdiff="/home/hassan/.scripts/create_diff_git.sh"
49 alias github="eval \"$(ssh-agent -s)\"; ssh-add /home/hassan/.ssh/github"
51 alias ya="youtube-dl -i --add-metadata -f bestaudio"
52 alias yv="youtube-dl -i --add-metadata -f webm"
53 alias yvp="youtube-dl -i --add-metadata -f webm -o \"%(autonumber)s-%(title)s.%(ext)s\""
55 #------ PROMPT ----------------------------------------------------------------
57 esc="\[\033"
58 bold="$esc[1m\]"
59 restore="$esc[00m\]"
61 white="$esc[97m\]"
62 black="$esc[30m\]"
63 dgrey="$esc[38;5;233m\]"
64 dgrey2="$esc[38;5;234m\]"
65 gold="$esc[38;5;214m\]"
66 gold2="$esc[38;5;94m\]"
67 green="$esc[38;5;2m\]"
68 orange="$esc[38;5;166m\]"
69 blue2="$esc[38;5;24m\]"
71 bg_black="$esc[48;5;0m\]"
72 bg_dgrey="$esc[48;5;233m\]"
73 bg_dgrey2="$esc[48;5;234m\]"
74 bg_gold="$esc[48;5;214m\]"
75 bg_gold2="$esc[48;5;94m\]"
76 bg_blue="$esc[48;5;27m\]"
77 bg_red="$esc[48;5;88m\]"
78 bg_mag="$esc[48;5;53m\]"
79 bg_green="$esc[48;5;2m\]"
80 bg_orange="$esc[48;5;166m\]"
81 bg_blue2="$esc[48;5;24m\]"
83 gitbranch="\$(__git_ps1 '  %s ')"
84 dir_fg=$gold
85 dir_bg=$bg_black
86 dir_bgc=$black
88 branch_fg=$orange
89 branch_bg=$bg_dgrey
90 branch_bgc=$dgrey
92 # user_fg=$blue2
93 # user_bg=$bg_dgrey2
94 # user_bgc=$dgrey2
95 # sep=
97 export PS1="$dir_fg$dir_bg \W $branch_bg$dir_bgc$sep$branch_fg$gitbranch$restore$user_bgc$sep$restore "
99 #------ HISTORY CONFIG --------------------------------------------------------
101 export HISTSIZE=10000
102 export HISTFILESIZE=10000
103 export HISTTIMEFORMAT='%b %d %I:%M %p '
104 export HISTCONTROL=ignoreboth
105 export HISTIGNORE="history:pwd:exit:df:ls:ls -lahG:ll"
106 export HISTFILE=~/.cache/.bash_history
108 #------ GREP COLOR CODE -------------------------------------------------------
110 alias grep="grep --color=always"
111 export GREP_COLOR="30;47"
113 #------ Archive extractor -----------------------------------------------------
115 ex (){
116 if [ -f $1 ] ; then
117 case $1 in
118 *.tar.bz2) tar xjf $1 ;;
119 *.tar.gz) tar xzf $1 ;;
120 *.tar.xz) tar xf $1 ;;
121 *.xz) xz -d $1 ;;
122 *.bz2) bunzip2 $1 ;;
123 *.rar) unrar x $1 ;;
124 *.gz) gunzip $1 ;;
125 *.tar) tar xf $1 ;;
126 *.tbz2) tar xjf $1 ;;
127 *.tgz) tar xzf $1 ;;
128 *.zip) unzip $1 ;;
129 *.Z) uncompress $1;;
130 *.7z) 7z x $1 ;;
131 *) echo "'$1' cannot be extracted via ex()";;
132 esac
133 else
134 echo "'$1' is not a valid file"
138 #------ GIT -------------------------------------------------------------------
140 if [ -f /home/hassan/.git-completion.bash ]; then
141 source /home/hassan/.git-completion.bash
144 if [ -f /home/hassan/.git-prompt.sh ]; then
145 source /home/hassan/.git-prompt.sh
148 #------ MAN -------------------------------------------------------------------
150 export LESS_TERMCAP_mb=$'\e[1;32m'
151 export LESS_TERMCAP_md=$'\e[1;32m'
152 export LESS_TERMCAP_so=$'\e[01;44;37m'
153 export LESS_TERMCAP_us=$'\e[1;4;31m'
154 export LESS_TERMCAP_me=$'\e[0m'
155 export LESS_TERMCAP_se=$'\e[0m'
156 export LESS_TERMCAP_ue=$'\e[0m'