-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
89 lines (76 loc) · 2.57 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
[[ $- != *i* ]] && return
[ -f "/usr/bin/vim" ] && export EDITOR="/usr/bin/vim"
export SHELL="/usr/bin/bash"
export HISTCONTROL=ignoredups:ignorespace;
# https://stackoverflow.com/a/19454838
export HISTFILE="${HOME}/.bash_history"
export HISTFILESIZE=1000000
export HISTSIZE=1000000
shopt -s histappend;
# Non-secure aliases to add color
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# some more ls aliases
alias ll='ls -AlFh'
alias l='ls -1F'
source /usr/share/bash-completion/bash_completion
# Enable aliases completion
source ~/.config/complete-alias.d/complete-alias
# git aliases
alias git-config='/usr/bin/git --git-dir=$HOME/config.git --work-tree=$HOME'
alias gconf='git-config'
# Correct typos
alias gcnof='git-config'
alias gocnf='git-config'
complete -F _complete_alias gconf
# useful aliases
dua ()
{
if [[ -z "$1" ]]; then
du -h --summarize *
else
du -h --summarize "$1"/*
fi | sort --human-numeric-sort | while IFS=$'\t' read -r size line;
do
printf "%s\t%s" $size "$line";
[[ -d $line ]] && printf "/";
echo;
done;
}
# ex = EXtractor for all kinds of archives (from ArcoLinux default .bashrc)
# 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) tar xf $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Start the ssh-agent used to store unlocked ssh key, useful when pushing regularly with git
eval "$(ssh-agent -s)" > /dev/null
### Terminal setup and module loading
# Neofetch
[ -f "/usr/bin/neofetch" ] && [ -z "$NONEOFETCH" ] && echo $- | grep -q i 2>/dev/null && /usr/bin/neofetch;
# Only load liquidprompt in interactive shells, not from a script or from scp
# `liquidprompt`
[ -f "/usr/bin/liquidprompt" ] && echo $- | grep -q i 2>/dev/null && . /usr/bin/liquidprompt;
[ -f "/usr/share/liquidprompt/liquidprompt" ] && echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt
# `autojump`
[ -f "/usr/bin/autojump" ] && [ -f "/usr/share/autojump/autojump.bash" ] && echo $- | grep -q i 2>/dev/null && . /usr/share/autojump/autojump.bash;