-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc
59 lines (48 loc) · 1.78 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
# Terminal Prompt
# Show current Git branch name in bash PS1
# Used PROMPT_COMMAND previously, but it meant that opening new tab in Terminal.app didn't do so in same dir
# See for refs:https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
source ~/.git-prompt.sh
export PS1='(pyenv$(pyenv version-name)) $(__git_ps1 "(%s) "){\t} \u@\h:\w \\$ '
# Added for case insensitive autocomplete
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
# colour support for OSx and Linux
if ls --version 2>/dev/null | grep -q 'coreutils'; then
alias ls='ls --color=always'
else
alias ls='ls -G'
fi
# quick type for cd
alias fd='cd'
# quick make
alias m='make'
alias f='make format'
# annoying metafont
alias mf='make'
# for quick venv
vsa() { source "$@"/bin/activate; }
alias vsv='source .venv/bin/activate'
alias vsd='deactivate'
# for quick port fowarding on 7777 to spark-master
alias spf='ssh -L localhost:7777:localhost:7777 sm'
# GIT SHIT
# https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
alias g='git'
# Autocomplete for 'g' as well
complete -o default -o nospace -F _git g
source ~/.git-completion.bash
# specific for setting up pipe to aws instance for Jupyter Notebook serves
shp () { ssh -L $1:localhost:$1 aws; }
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
mkcd () {
case "$1" in
*/..|*/../) cd -- "$1";; # that doesn't make any sense unless the directory already exists
/*/../*) (cd "${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd -- "$1";;
/*) mkdir -p "$1" && cd "$1";;
*/../*) (cd "./${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd "./$1";;
../*) (cd .. && mkdir -p "${1#.}") && cd "$1";;
*) mkdir -p "./$1" && cd "./$1";;
esac
}