-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc_dotfiles
102 lines (82 loc) · 3.61 KB
/
.bashrc_dotfiles
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
# This file contains bash settings and aliases that are
# used by every PC I have. It is sourced by .bashrc so
# the original bashrc for each system stays in place.
export EDITOR=vim
#eval "#(fasd --init auto)"
# Use fd to respect .gitignore
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# line editing like vim
set -o vi
# vim: automatically open multiple files in tabs
alias vim="vim -p"
alias v="vim -p"
# ls aliases
export CLICOLOR=1
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# git aliases
alias g='git'
# complete for 'g' as well as 'git'
complete -o default -o nospace -F _git g
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gc='git commit'
alias gl='git log --graph --full-history --branches --remotes --tags --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
alias gitsearch='git rev-list --all | xargs git grep -F'
# Notify when long running commands are over (Ubuntu)
n (){
($* ; notify-send "Command over" "$*")
}
function mcd() {
mkdir -p "$1" && cd "$1";
}
function undozip(){
unzip -l "$1" | awk 'BEGIN { OFS="" ; ORS="" } ; { for ( i=4; i<NF; i++ ) print $i " "; print $NF "\n" }' | xargs -I{} rm -r {}
}
# Uninstall old kernels
cleankernels() {
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get purge --yes
}
alias aptupgrade='sudo apt-get update && sudo apt-get upgrade --yes && sudo apt-get clean --yes'
alias reload='source $HOME/.bashrc 1>/dev/null'
alias myip='curl ip.appspot.com'
# Server current directory on localhost:8765
# Works for versions less than 3. Py3 is python "-m http.server 8765"
alias servethis="python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'"
GIT_PROMPT_THEME=Solarize
GIT_PROMPT_FETCH_REMOTE_STATUS=0
if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
source ~/.bash-git-prompt/gitprompt.sh
elif [ $(command -v brew 2>&-) ] && [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
if [ $(command -v brew 2>&-) ] && [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -f /proc/version ] && [ grep -q Microsoft /proc/version ]; then
# Fix everything being highlighted in light green (due to the group
# write bit being set or something like that)
export LS_COLORS=$(echo $LS_COLORS | sed "s/ow=34;42/ow=01;34/g")
fi
# Only works on OS X
alias setJdk6='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)'
alias setJdk7='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)'
alias setJdk8='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'
alias setJdk9='export JAVA_HOME=$(/usr/libexec/java_home -v9)'
alias setJdk10='export JAVA_HOME=$(/usr/libexec/java_home -v10)'
alias setJdk11='export JAVA_HOME=$(/usr/libexec/java_home -v11)'
alias setJdk12='export JAVA_HOME=$(/usr/libexec/java_home -v12)'
shopt -s histappend # Set history file mode to append
# -a writes current/new lines to history file
# -c clears the history list (bash in memory concept)
# -r reads history file into the history list
PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND"
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000
export HISTCONTROL=ignoreboth # Don't save commands that start with space (for passwords and stuff), and don't save dups
export HISTIGNORE='ls:bg:fg:history'
export HISTTIMEFORMAT='%F %T ' # full time in history file
shopt -s cmdhist # force multi-line commands to one line in history