-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
90 lines (66 loc) · 2.74 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
[ -z "$PS1" ] && return
PROMPT_DIRTRIM=1 #len of current working directory
set -o vi #allows vi inside bash
bind 'set completion-ignore-case on'
# shopt -s cd spell
# complete -d cd
HISTCONTROL=ignoredups:ignorespace
HISTSIZE=
HISTFILESIZE=
shopt -s histappend # append to the history file after each command
shopt -s checkwinsize # check the window size after each command and, if necessary, update
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# set terminal line start
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]Ben🍏 \[\033[00m\]:\[\033[94m\]\w\[\033[93m\]\$(parse_git_branch)\[\033[00m\]\$ "
#export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]Bash🍏\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# enable color support of ls and also add handy aliases
# if [ -x /usr/bin/dircolors ]; then
# test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
# alias ls='ls --color=auto'
# #alias dir='dir --color=auto'
# #alias vdir='vdir --color=auto'
# alias grep='grep --color=auto'
# alias fgrep='fgrep --color=auto'
# alias egrep='egrep --color=auto'
# fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Allow aliases from .bash_aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
function _update_ps1() {
PS1=$(powerline-shell $?) #https://github.com/b-ryan/powerline-shell
#https://github.com/ryanoasis/nerd-fonts
}
if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
HISTTIMEFORMAT="%F %T "
# set directory color
alias ls='ls --color'
LS_COLORS='di=32:fi=0:ln=94:pi=33:so=33:bd=33:cd=33:or=31:mi=31:ex=33:*.rpm=90'
export LS_COLORS
export EDITOR=vim
export VISUAL=vim
if command -v tmux >/dev/null 2>&1; then
# if not inside a tmux session, and if no session is started, start a new session
[ -z "${TMUX}" ] && (tmux attach >/dev/null 2>&1 || tmux)
fi