-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
53 lines (45 loc) · 1.48 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
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ] || [ "$(uname)" = "Darwin" ]; then
alias ls='ls --color=auto'
alias gcc='gcc -fdiagnostics-color=always'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias pacman='pacman --color=always'
alias yay='yay --color=always'
fi
# Aliases
alias la='ls -lhFA'
alias ll='ls -lhF'
alias l='ls -CF'
alias dot="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'"
# XDG aliases
alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"'
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
alias sqlite3='sqlite3 -init "$XDG_CONFIG_HOME"/sqlite3/sqliterc'
# Bash config
if [[ "$(set -o | grep 'emacs\|\bvi\b' | cut -f2 | tr '\n' ':')" != 'off:off:' ]]; then
bind "set completion-ignore-case on"
fi
# Functions
cdf() {
cd "$(find ~ -type d &>/dev/null | fzf)"
}
vcsinfo_git_branch() {
git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/^\(* \)//'
}
vcsinfo_branch() {
branch=$(vcsinfo_git_branch)
[ ! -z $branch ] && echo " ($branch)" && return
}
set_prompt() {
# red color if current user us root, otherwise - green
[ "$USER" = "root" ] && UCOLOR="\e[1;31m" || UCOLOR="\e[1;32m"
[ "$USER" = "root" ] && END="#" || END="$"
BLUE="\e[1;34m"
PURPLE="\e[1;35m"
STOP="\e[m"
export PS1="\A $UCOLOR\u$STOP@$PURPLE\h$STOP:$BLUE\w$STOP\$(vcsinfo_branch)"$'\n'"$END "
}
set_prompt 0
source $HOME/.profile