-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
66 lines (54 loc) · 1.83 KB
/
.bashrc
File metadata and controls
66 lines (54 loc) · 1.83 KB
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
# Jae's ~/.bashrc
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history
# and don't put lines starting with space.
HISTCONTROL=ignoredups:ignorespace
# basic prompt
PS1='\u@\h \w \$ '
# color prompt
# - see https://wiki.archlinux.org/index.php/Color_Bash_Prompt
PS1="$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;32m\]\u@\h'; fi)\[\033[01;34m\] \w \$([[ \$? != 0 ]] && echo \"\[\033[01;31m\]:(\[\033[01;34m\] \")\\$\[\033[00m\] "
# show "[hh:mm] user@host:pwd" in xterm title bar
if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
# for Mac Terminal, omit "User@Users-MacBook-Air"
# and preserve PROMPT_COMMAND set by /etc/bashrc.
show_what_in_title_bar='"[$(date +%H:%M)] ${PWD/#$HOME/~}"'
PROMPT_COMMAND='printf "\033]0;%s\007" '"$show_what_in_title_bar; $PROMPT_COMMAND"
else
show_what_in_title_bar='"[$(date +%H:%M)] ${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"'
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND='printf "\033]0;%s\007" '$show_what_in_title_bar
;;
screen)
PROMPT_COMMAND='printf "\033_%s\033\\" '$show_what_in_title_bar
;;
esac
fi
unset show_what_in_title_bar
# editor
export EDITOR=vim
# set vi editing mode
set -o vi
# aliases & functions
case "$OSTYPE" in
*linux*)
alias dmesg='dmesg --color'
alias pacman='pacman --color=auto'
alias ls='ls --color=auto'
;;
*darwin*)
alias ls='ls -G'
;;
esac
alias ll='ls -alF'
alias l='ls -CF'
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
svndiff() { svn diff "$@" | colordiff; }
svndiffless() { svn diff "$@" | colordiff | less -R; }
alias gccg='gcc -g -Wall'
alias g++g='g++ -g -Wall'
alias valgrindlc='valgrind --leak-check=yes'