forked from adam8157/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
123 lines (110 loc) · 2.77 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# umask
umask 022
# variable
export EDITOR=vim
# xon/xoff
[ -t 0 ] && stty -ixon
# path
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ]
then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
;;
esac
}
pathmunge $HOME/binary after
pathmunge $HOME/scripts after
export PATH
# colorful manual page
export GROFF_NO_SGR=1
export LESS_TERMCAP_mb=$'\E[05;34m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;34m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[44;33m' # begin standout-mode
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_us=$'\E[04;33m' # begin underline
# completion
if [ -f /etc/bash_completion ]
then
. /etc/bash_completion
fi
_comp_all_packages()
{
local cur
COMPREPLY=()
cur=`_get_cword`
COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
return 0
}
_show_installed_packages()
{
command grep -A 1 "Package: $1" /var/lib/dpkg/status | \
command grep -B 1 -Ee "ok installed|half-installed|unpacked| \
half-configured|config-files" -Ee "^Essential: yes" | \
command grep "Package: $1" | cut -d\ -f2
}
_comp_installed_packages()
{
local cur
COMPREPLY=()
cur=`_get_cword`
COMPREPLY=( $( _show_installed_packages $cur ) )
return 0
}
complete -F _comp_all_packages $default ai aw
complete -F _comp_installed_packages $default ap
# alias
alias ..='cd ..'
alias ac='sudo apt-get autoremove --purge && sudo apt-get clean && dpkg -l |grep ^rc |awk "{print \$2}" |sudo xargs dpkg -P'
alias ad='sudo apt-get update && sudo apt-get dist-upgrade'
alias ai='sudo apt-get install'
alias ap='sudo apt-get purge'
alias as='apt-cache search --names-only'
alias au='sudo apt-get upgrade'
alias aw='apt-cache show'
alias ct='ctags -R --fields=+lS && cscope -Rbq'
alias ga='git add -A'
alias gc='git commit -a'
alias gd='git difftool'
alias gi='git add -i'
alias gl='git log --graph'
alias gp='git push'
alias grep='grep --color=auto'
alias gr='git ls-files -d |xargs git checkout --'
alias gs='git status'
alias gu='git pull'
alias gw='git show'
alias la='ls -lAh --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias ntp='sudo ntpdate pool.ntp.org && sudo hwclock --systohc'
alias poweroff='sudo -k poweroff'
alias pt='find . -name \*.py -exec ptags {} \+'
alias pw='pwgen -Bcns 16 1'
alias reboot='sudo -k reboot'
alias sr='screen -R'
# screen and xterm's dynamic title
[ -z "$SSH_TTY" ] && case $TERM in
xterm*)
# Set xterm's title
TITLEBAR='\[\e]0;\u@\h:\w\a\]'
PS1="${TITLEBAR}${PS1}"
;;
screen*)
# Use path as title
PATHTITLE='\[\ek\W\e\\\]'
# Use program name as title
PROGRAMTITLE='\[\ek\e\\\]'
PS1="${PROGRAMTITLE}${PATHTITLE}${PS1}"
;;
*)
;;
esac