-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
150 lines (124 loc) · 4.05 KB
/
bashrc
File metadata and controls
150 lines (124 loc) · 4.05 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# variables
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export HISTCONTROL=ignorespace:ignoredups
export EDITOR="vim"
export MANPAGER="less -X"
export LESS_TERMCAP_md=$'\E[1;36m'
# aliases
alias l="ls -l"
alias la="ls -a"
alias lla="l -a"
alias lh="l -h"
alias l1="ls -1"
alias ip="ip -c"
# ssh aliases
if [ -f ~/.ssh/aliases ]; then
. ~/.ssh/aliases
fi
# functions
mkcd() { mkdir -p "$@" && cd "$_"; }
# set TERM for tmux
if [ "$TERM" == "screen" ]; then
export TERM=screen-256color
fi
# operating system specific settings
# Darwin
if [ "$(uname)" == "Darwin" ]; then
# variables
export PATH="${HOME}/bin:${HOME}/.composer/vendor/bin:${PATH}"
export PATH="/usr/local/sbin/:${PATH}" # Homebrew
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH" # MySQL 5.7 (Homebrew)
export COPYFILE_DISABLE=1
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="1;31;49"
# aliases
alias ls="ls -FG"
alias df="df -PhT apfs,hfs,afpfs,exfat,fuse4x,msdos,osxfuse,nfs"
# bash-completion
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
if [ -r /usr/local/etc/profile.d/bash_completion.sh ]; then
. /usr/local/etc/profile.d/bash_completion.sh
fi
# mc wrapper for exiting to the latest PWD
if [ -f /usr/local/Cellar/midnight-commander/4.8.22/libexec/mc/mc.sh ]; then
. /usr/local/Cellar/midnight-commander/4.8.22/libexec/mc/mc.sh
fi
# Git prompt
if [ -f /usr/local/etc/bash_completion.d/git-prompt.sh ]; then
. /usr/local/etc/bash_completion.d/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto verbose"
fi
# Linux
elif [ "$(uname)" == "Linux" ]; then
# ssh-agent
#if [ -f ~/bin/sshagent.sh ]; then
# . ~/bin/sshagent.sh
#fi
# variables
export PATH="$PATH:$HOME/bin"
export PAGER="vimpager"
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# aliases
alias ls="ls --color=auto"
alias less="$PAGER"
alias cal="cal -m"
alias df="df -h -t ext2 -t ext3 -t ext4 -t btrfs -t fuseblk -t fuse.sshfs -t fuse.encfs"
# bash-completion
# Gentoo doesn't need that anymore?
#if [ -f /etc/profile.d/bash-completion.sh ]; then
# . /etc/profile.d/bash-completion.sh
#fi
# mc wrapper for exiting to the latest PWD
if [ -f /usr/libexec/mc/mc.sh ]; then
. /usr/libexec/mc/mc.sh
fi
# Git prompt
if [ -f /usr/share/git/git-prompt.sh ]; then
. /usr/share/git/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto verbose"
fi
# virtualenvwrapper
if [ -f /usr/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper.sh
fi
# FreeBSD
elif [ "$(uname)" == "FreeBSD" ]; then
# variables
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# aliases
alias ls="ls -G"
alias df="df -ht ufs"
alias top="top -PCs1"
# bash-completion
if [ -f /usr/local/share/bash-completion/bash_completion.sh ]; then
. /usr/local/share/bash-completion/bash_completion.sh
fi
# OpenBSD
elif [ "$(uname)" == "OpenBSD" ]; then
# variables
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
# aliases
alias ls="colorls -G"
fi
# host specific settings
#if [ "$(hostname -s)" == "snotra" ]; then
# export MPD_HOST="$HOME/.mpd/socket"
#fi
# user specific prompt
if [ "$(id -u)" == "0" ]; then
export PS1="\[\033[0;31m\]\H\[\033[0;34m\] \w (\j) \$\[\033[00m\] "
else
export PS1="\[\033[0;32m\]\h\[\033[0;34m\] \w (\j) \$\[\033[00m\] "
fi
if [ -v GIT_PS1_SHOWDIRTYSTATE ]; then
export PS1='\[\033[0;32m\]\h\[\033[0;34m\] \w (\j)$(__git_ps1 " \[\033[0;36m\](%s)\[\033[0;34m\]") \$\[\033[00m\] '
fi