-
Notifications
You must be signed in to change notification settings - Fork 3
/
zshrc
83 lines (65 loc) · 1.73 KB
/
zshrc
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
# ================ Source Prezto =====================
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# ================== Custom Setup ====================
# Set default shell editor
export VISUAL=vim
export EDITOR=VISUAL
# Let pinentry know about my current shell
export GPG_TTY=$(tty)
# Add yarn global installs to PATH
export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"
# ================ Alias Functions ===================
# ls automatically after cd
function cs() {
if [ $# -eq 0 ]; then
cd && ls
else
cd "$*" && ls
fi
}
alias cd='cs'
# mkdir and cd into it in one action
function mkcd {
mkdir $1
cd $1
}
# create missing subfolders before touching file
supervim() {
if [ $# -lt 1 ]; then
echo "Missing argument";
return 1;
fi
for f in "$@"; do
mkdir -p -- "$(dirname -- "$f")"
vim -- "$f"
done
}
# clone and cd into repo
function clone() {
git clone $1 && cd $(basename ${1%.*})
}
# create GitHub pull-request
# first arg is branch you want to create PR against
# second arg (optional) is your commit message; if no message provided, it will
# open your editor so you can add a message there
function hpr() {
hub pull-request -b $1 --browse -m ${2-''}
}
# ================ Aliases ===========================
# Env setup
alias vimconfig="vim ~/.dotfiles/vimrc"
alias zshconfig="vim ~/.dotfiles/zshrc"
alias tmuxconfig="vim ~/.dotfiles/tmux.conf"
# File traversal
alias c='clear;ls'
alias cl='clear'
alias dot='cd ~/.dotfiles'
alias rl='source ~/.zshrc'
# ================ Local version =====================
if [ -f ~/.zshrc_local ]; then
source ~/.zshrc_local
fi
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh