-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.bash_profile
More file actions
92 lines (81 loc) · 2.69 KB
/
Copy path.bash_profile
File metadata and controls
92 lines (81 loc) · 2.69 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
# Private for stuff not on github (if exists)
[ -f ~/.bash_private ] && source ~/.bash_private
# Colors for LS and Grep
export CLICOLOR=1 # LS Color
alias grep="grep --color=auto"
export GREP_COLOR='1;32'
[[ "$OSTYPE" == "linux-gnu" ]] && alias ls='ls --color=auto'
# Better Bash History
shopt -s histappend # session appends not overwrites to history
HISTFILESIZE=10000
HISTSIZE=10000
HISTCONTROL=ignoreboth # ignore dup commands, commands starting with space
# After each command, save and reload history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# Use nvim or vim as editor
if hash nvim 2>/dev/null;
then
export EDITOR=nvim
else
export EDITOR=vim
fi
if [ -e ~/dev/util/lesspipe.sh ];
then
export LESS='-R'
export LESSOPEN='|~/dev/util/lesspipe.sh %s'
fi
# ------------------------------------------------------
# OSX Only
# ------------------------------------------------------
# Use Terminal's colors for emacs (Mac OS X)
[[ "$OSTYPE" == "darwin"* ]] && export TERM='xterm-256color'
# Disable brew analytics
[[ "$OSTYPE" == "darwin"* ]] && export HOMEBREW_NO_ANALYTICS=1
# pbcopy / pbpaste for OSX clipboard
if [[ "$OSTYPE" == "darwin"* ]]
then
alias pp=pbpaste
alias pc=pbcopy
fi
# Load bash completions from brew
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
# ------------------------------------------------------
# Custom Prompt
# ------------------------------------------------------
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
COLOR="\[\e[0;34m\]"
NORMAL="\[\e[0m\]"
# Construct PS1
# Commands need to be in single quotes or they will expand on PS1 creation, not each time the prompt
# runs
PS1="${COLOR}"
[ -n "$SSH_CLIENT" ] && PS1+="\u@\h :: "
PS1+="\W/"
hash __git_ps1 2>/dev/null && PS1+='$(__git_ps1)'
PS1+=" > ${NORMAL}"
# ------------------------------------------------------
# Command Aliases / Functions
# ------------------------------------------------------
alias la="ls -lah"
if hash rg 2>/dev/null; then alias rgi="rg -i"; fi
alias aliases="cat ~/.bash_private ~/.bash_profile | grep '^alias\|^function\|\(\) {' | sort";
sorted-du () {
paste -d '#' <(du -cs *) <(du -chs *) | sort -rn | cut -d '#' -f 2
}
# Notes
NOTES_BASE_PATH=""
[ -d "$HOME/Documents/notes" ] && NOTES_BASE_PATH="$HOME/Documents/notes"
[ -d "$HOME/docs/notes" ] && NOTES_BASE_PATH="$HOME/docs/notes"
if [ -n "NOTES_BASE_PATH" ]
then
alias journal="nvim $NOTES_BASE_PATH/journal/journal.txt"
fi
# ------------------------------------------------------
# PATH
# ------------------------------------------------------
# Include
# - util
export PATH=$PATH:~/dev/util