-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bash_aliases
115 lines (95 loc) · 3.32 KB
/
.bash_aliases
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
# Change when necessary
export PATH="$PATH:$HOME/bin"
# Import constants
if [ -f ~/.bash_constants ]; then
. ~/.bash_constants
fi
# ----------------------------------------------------------------------------
# Environment variables
# ----------------------------------------------------------------------------
# Set locales
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PYTHONIOENCODING=UTF-8 # http://stackoverflow.com/a/6361471/1054939
# Tell 'ls' to be colorful
export CLICOLOR=1
# Linker library
export LD_LIBRARY_PATH='/usr/local/lib'
# ----------------------------------------------------------------------------
# Aliases
# ----------------------------------------------------------------------------
# global
alias sourceb='source ~/.bashrc'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
alias ..2='cd ../..'
alias ..3='cd ../../..'
alias ..4='cd ../../../..'
alias ..5='cd ../../../../..'
alias vi='nvim'
alias agi='ag --ignore-dir'
alias e2u='iconv -f euckr -t utf8'
alias ports='lsof -Pn -i4 | grep LISTEN'
alias rm='rm -i'
alias rmed='find . -type d -empty -delete'
# for many small files
alias rscp='rsync -r --ignore-existing --progress --rsh=ssh'
# for a few big files
alias rscpb='rsync -r --partial --progress --rsh=ssh'
alias tl='tree -L 2'
alias wgetr='wget -r --no-parent'
alias sshuttles='sshuttle -r lovit 0/0'
# fasd
eval "$(fasd --init auto)"
alias s='fasd -si' # show / search / select
alias c='fasd_cd -b current' # cd in current folder
alias cc='fasd_cd -b current -i' # cd in current folder (interactive)
alias v='fasd -e vim -b current' # open file in current folder
alias vv='fasd -e vim -b current -i' # open file in current folder (interactive)
alias z='fasd_cd -d'
alias zz='fasd_cd -d -i' # global cd (interactive)
if [ -f "$HOME/.fasdrc" ]; then
. $HOME/.fasdrc
fi
alias f='open .' # overwrite f
alias emem='sudo bash -c "sync; echo 1 > /proc/sys/vm/drop_caches"'
# github/gist
alias gistup='gistup --remote=gist --private --'
# nvm
export NVM_DIR="$HOME/.nvm"
# NOTE: The following line is VERY SLOW
alias sourcen='. "${NVM_DIR}/nvm.sh"'
# python
alias pyserv='python -m SimpleHTTPServer || python -m http.server'
alias pyprofile='python -m cProfile --sort=cumulative'
# tmux
alias ta='tmux attach -t lucypark || tmux new -s lucypark'
alias tw='tmux rename-window -t'
# SCM Breeze
[ -s "$HOME/.scm_breeze/scm_breeze.sh" ] && source "$HOME/.scm_breeze/scm_breeze.sh"
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
alias sourcer='eval "$(rbenv init -)"'
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - --no-rehash)"
eval "$(pyenv virtualenv-init -)"
# fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_OPTS='--height 40% --reverse --border'
# ----------------------------------------------------------------------------
# Misc
# ----------------------------------------------------------------------------
# bash history logging
if [ -d "$HOME/.logs" ]; then
export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi'
fi
# local bash
if [ -f "$HOME/.bash_local" ]; then
. ~/.bash_local
fi