-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_profile
80 lines (64 loc) · 1.87 KB
/
.bash_profile
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
# Color reporting for tmux
export TERM="xterm-256color"
# Default editor
export EDITOR='vim'
# vi emulation mode
# set -o vi
# Aliases
# Coloured directory listings
alias ls='ls -G'
alias cl='clear'
alias vi='vim'
alias py='python'
alias py3='python3'
alias tls='tmux list-sessions'
alias tks='tmux kill-session'
alias tas='tmux a -t'
alias lc='cl'
alias repl='python'
# tmux 256-colour support:
alias tmux='tmux -2'
# git section
alias g='git'
alias gl='git log --graph --abbrev-commit --pretty=oneline'
# Mac-specific
if [ "$(uname)" == "Darwin" ]; then
# Show and hide hidden files on OS X
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
# Open target with Finder
alias finder='open -a Finder'
# Reload bashrc
alias reload_conf='source ~/.bash_profile'
fi
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
GIT_PROMPT_THEME=Default
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh"
fi
# Link git-completion
source ~/git-completion.bash
if [ -f "~/.git-completion.bash" ]; then
source ~/git-completion.bash
fi
# Link to bash-completion
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Terminal Google Search function
# Syntax: $ google cats
google() {
search=""
echo "Googling: $@"
for term in $@; do
search="$search%20$term"
done
open "http://www.google.com/search?q=$search"
}
# Bash history section
export HISTSIZE=1000
# Avoid duplicate entries
export HISTCONTROL=ignoredups:erasedups
# Append history entries
shopt -s histappend
# Save and reload history after each command
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"