-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
96 lines (81 loc) · 2.84 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# ____ _ _
#| _ \ __ _| | |___ ___
#| |_) / _` | | / __|/ _ \
#| _ < (_| | | \__ \ (_) |
#|_| \_\__,_|_|_|___/\___/
#
### EXPORT
export TERM="xterm-256color" # getting proper colors
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export BASH_SILENCE_DEPRECATION_WARNING=1 #
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
### PROMPT
PS1="\342\224\214($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]👑⚡\h⚡👑'; else echo '\[\033[01;36m\]\u ⚡ '; fi)\$(date +%k:%M:%S)\[\033[1;37m\])\342\224\200(\w)\342\224\200(\[\033[1;33m\]\$(ls -1 | wc -l | sed 's: ::g') files\[\033[1;37m\])\342\224\200(\[\033[1;35m\]\$(ls -1a | grep -e '^\..*'| wc -l | sed 's: ::g') dot files\[\033[1;37m\])\n\342\224\224\$(parse_git_branch)\342\206\222 ⚡"
### PATH
if [ -d "$HOME/.bin" ] ;
then PATH="$HOME/.bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ] ;
then PATH="$HOME/.local/bin:$PATH"
fi
### SHOPT
shopt -s autocd # change to named directory
shopt -s cdspell # autocorrects cd misspellings
shopt -s cmdhist # save multi-line commands in history as single line
shopt -s dotglob
shopt -s histappend # do not overwrite history
shopt -s expand_aliases # expand aliases
shopt -s checkwinsize # checks term size when bash regains control
#ignore upper and lowercase when TAB completion
bind "set completion-ignore-case on"
### ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.deb) ar x $1 ;;
*.tar.xz) tar xf $1 ;;
*.tar.zst) unzstd $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
### ALIAS
# Colorize grep output
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
# confirm before overwriting something
alias cp="cp -i"
alias mv='mv -i'
alias rm='rm -i'
# adding flags
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
# the terminal rickroll
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'
alias ls="ls -FG --color=auto"
alias ll="ls -laFG --color=auto"
alias ..="cd .."
alias ttyc="tty-clock -s -x -c -C 4"
alias bpy="bpytop"
# clear
# [ $[$RANDOM % 10] = 0 ] && timeout 4 cmatrix || clear