-
Notifications
You must be signed in to change notification settings - Fork 3
/
zshrc
153 lines (132 loc) · 3.54 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load:
# Look in ~/.oh-my-zsh/themes/
# suvash blinks fino josh re5et random
ZSH_THEME="refined"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Zsh Plugins
# ==============================
# Plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
plugins=(autojump git gitignore golang tmux
zsh-completions zsh-autosuggestions)
# zsh-completions https://github.com/zsh-users/zsh-completions
autoload -U compinit && compinit
# Load oh-my-zsh
# ==============================
source $ZSH/oh-my-zsh.sh
# Configs
# ==============================
export TERM=xterm-256color
# Command line head / tail shortcuts
# ==============================
alias -g A="| ag"
alias -g H="| head"
alias -g T="| tail"
alias -g G="| grep"
alias -g L="| less"
alias -g M="| most"
alias -g CP="| pbcopy"
alias -g PM="2>&1 | pygmentize -l pytb"
alias -g LL="2>&1 | less"
alias -g CA="2>&1 | cat -A"
alias -g NE="2> /dev/null"
alias -g NGO="--ignore '*_test.go'"
alias -g NUL="> /dev/null 2>&1"
alias -g GRP="| sort | uniq -c | sort -r"
# 1 Char Alias
# ==============================
alias a="ag"
alias b="brew"
alias e="nvim"
alias g="git"
alias h="history"
alias l="exa -lF --group-directories-first"
alias n="nvim"
alias m="man"
alias o="open"
alias p="ps -f"
alias q="exit"
alias t="tail -f"
# 2 Chars Alias
# ==============================
# Rails
alias ra="rake"
alias br="bin/rake"
# Vim Alias
alias ee="nvim"
alias vi="nvim"
# Tmux
alias tm="tmux"
# Git
alias gm="git-imerge"
alias gv="nvim -c MagitOnly"
# System
alias ll="exa -alF --group-directories-first"
alias la="exa -alF --git --group-directories-first"
alias cl="clear"
alias rm="trash"
# Network IP address
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
# 3 Chars Alias
# ==============================
# System
alias plz="sudo"
alias rmd="trash"
# Vim
alias vim="nvim"
# Copy to clipboard
alias ccp="pbcopy"
# Local IP address
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# Top 10 history
alias h10="print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10"
# Other Alias
# ==============================
# Edit zshrc and vimrc
alias zshrc="nvim ~/.zshrc"
alias vimrc="nvim ~/.vimrc"
# Enhanced WHOIS lookups
alias whois="whois -h whois-servers.net"
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"
# Function Helpers
# ==============================
function ywd {
pwd | tr -d "\r\n" | pbcopy
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}
# https://github.com/y0ssar1an/q
function qq() {
clear
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ ! -f "$logpath" ]]; then
echo 'Q LOG' > "$logpath"
fi
tail -100f -- "$logpath"
}
function rmqq() {
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ -f "$logpath" ]]; then
rm "$logpath"
fi
qq
}
# Local configs
[ -f ~/.localrc ] && source ~/.localrc