-
Notifications
You must be signed in to change notification settings - Fork 1
/
_bashrc
129 lines (100 loc) · 4.38 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
124
125
126
127
128
129
#!bash
# shellcheck disable=SC1090
# SC1090 is non-constant sources, which we have many
true
# -*- mode: shell-script -*-
# ~/.bashrc: executed by bash(1) for non-login shells.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
export EDITOR=vim
export GOPATH=$HOME/.go
# my path, not yours
PATH="$HOME/bin"
PATH="$PATH:/usr/lib/ccache" # ccache symlinks on debian
PATH="$PATH:/usr/lib64/ccache" # ccache symlinks on CentOS (x86_64)
PATH="$PATH:/usr/local/opt/ccache/libexec" # ccache symlinks on OSX (homebrew)
PATH="$PATH:$HOME/.cabal/bin" # cabal - haskell packages/apps
PATH="$PATH:$HOME/.rbenv/bin" # rbenv
PATH="$PATH:$HOME/.npm_scratch/bin" # npm-installed commands
PATH="$PATH:$HOME/hck/perl-5.12.1/bin" # handbuilt perl
PATH="$PATH:/opt/local/bin:/opt/local/sbin" # macports
PATH="$PATH:/usr/local/git/bin" # http://code.google.com/p/git-osx-installer/
PATH="$PATH:/Library/TeX/texbin" # MaxTeX
PATH="$PATH:/usr/local/go/bin" # go
PATH="$PATH:$GOPATH/bin" # installed go binaries
PATH="$PATH:/opt/puppetlabs/pdk/bin" # puppetlabs pdk
PATH="$PATH:/opt/puppetlabs/bin" # puppetlabs other (bolt)
PATH="$PATH:/usr/local/bin:/usr/local/sbin"
PATH="$PATH:/usr/bin:/usr/sbin"
PATH="$PATH:/bin:/sbin"
export PATH
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
PS1='\033[1m[\D{%Y-%m-%d %H:%M:%S}] \u@\h:\w\033[0m\n\$ '
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|screen)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
screen-256color)
# tmux normally - set OSC title to last part of pwd
PROMPT_COMMAND='printf "\033]2;$(basename "$PWD")\033\\"'
;;
*)
;;
esac
# append history
shopt -s histappend
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
# fuck you and your auto-suggesting ways
unset command_not_found_handle
# xdg-open(1) on Linux, open(1) on OSX
[ "$( uname )" == "Linux" ] && alias open=xdg-open
[ "$( uname )" == "Linux" ] && alias pbcopy='xclip -selection clipboard'
[ "$( uname )" == "Linux" ] && alias pbpaste='xclip -selection clipboard -o'
[[ -e /usr/local/bin/hub ]] && alias git=hub
alias vi=vim
alias grep='grep --color=auto'
# enable perlbrew http://search.cpan.org/perldoc?perlbrew
[[ -s "$HOME/perl5/perlbrew/etc/bashrc" ]] && source "$HOME/perl5/perlbrew/etc/bashrc"
# enable local::lib http://search.cpan.org/perldoc?local::lib
[[ -s "$HOME/perl5/lib/perl5/local/lib.pm" ]] && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
# enable rvm http://rvm.beginrescueend.com/
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# enable rbenv https://github.com/sstephenson/rbenv
[[ -f "$HOME/.rbenv/bin/rbenv" ]] && eval "$(rbenv init -)"
# enable chruby https://github.com/postmodern/chruby
[[ -s /usr/local/share/chruby/chruby.sh ]] && source /usr/local/share/chruby/chruby.sh
[[ -s /usr/local/share/chruby/auto.sh ]] && source /usr/local/share/chruby/auto.sh
# enable pyenv if installed
if which pyenv >/dev/null ; then
eval "$(pyenv init -)"
fi
# enable rustup https://www.rustup.rs/
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
# Launch/connect to a gpg-agent
if which gpg-agent >/dev/null; then
GPG_ENV_FILE="${HOME}/.gnupg/gpg-agent.env"
if ! pgrep gpg-agent >/dev/null; then
gpg-agent --daemon --write-env-file "${GPG_ENV_FILE}" >/dev/null
fi
if [ -f "${GPG_ENV_FILE}" ]; then
source "${GPG_ENV_FILE}"
export GPG_AGENT_INFO
fi
fi
# clean out some broken vars
export -n LESS
export -n TMOUT
[[ -s "$HOME/.bashrc_local" ]] && source ~/.bashrc_local
[[ -s /usr/local/etc/bash_completion ]] && source /usr/local/etc/bash_completion
[[ -s /etc/bash_completion ]] && source /etc/bash_completion
[[ -s "$HOME/.bash_completion.d/knife/knife.sh" ]] && source $HOME/.bash_completion.d/knife/knife.sh
return # Insulate ourselves from silly installers that just append source lines