-
Notifications
You must be signed in to change notification settings - Fork 1
/
zshrc
119 lines (88 loc) · 2.66 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
# Make a fine looking prompt
# ==========================
# I have been using this style of prompt since roughly 1997. I don't want to
# change, even though newfangled stuff like powerline is all the rage now...
if [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
# For SSH sessions, show hostname.
PROMPT='%F{green}%n@%F{red}%m%F{white}:%B%F{blue}%2~%b%F{white}%(!.#.$) '
else
# For local sessions, do NOT show hostname.
PROMPT='%F{green}%n%F{white}:%B%F{blue}%2~%b%F{white}%(!.#.$) '
fi
# ZSH preferences
# =======================
# Basically, I'd like a large history and to ignore duplicates
# History stuff
# -------------
HISTFILE=~/tmp/.zsh.history
HISTSIZE=1000000
SAVEHIST=1000000
setopt appendhistory
setopt INC_APPEND_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
# Autocomplete stuff
# -------------
zstyle ':completion:*' menu select
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# Configure ls color preferences
# ===========================
# The defaults can be hard to see on certain displays. This improves the
# contrast just a bit.
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# Helpful aliases
# ===============
# Many of these are related to colorized output
# Politely ask ls to use colors.
# Linux and BSDs (like OSX) need told in different ways.
if [ "$(uname -s)" = "Linux" ]; then
alias ls='ls --color=auto'
else
alias ls='ls -G'
fi
# This is just a nice shortcut
alias ll='ls -la'
# Colorized grep is so much nicer
alias grep='grep --color=auto'
# Helper to clean up dead git branches
alias clean-branches='~/.dotfiles/helpers/cleanup_branches'
# Make a fancy color theme happen to my shell
if [ -f "$HOME/.dotfiles/zsh/base16-gruvbox-dark-medium.sh" ]; then
. "$HOME/.dotfiles/zsh/base16-gruvbox-dark-medium.sh"
fi
# Setup GPG prompt for git commit signing
export GPG_TTY=$(tty)
# Some nice helper functions
# ==========================
# These are just a few
function grepp () {
if (( $# == 0)); then
echo "Usage: $0 <search> [<path>]"
return 1
fi
local SEARCH_PRED=$1
if (( $# == 1)); then
local SEARCH_PATH=${(f)$(ls)}
else
local SEARCH_PATH=${=@:2}
fi
echo "Grepping for $SEARCH_PRED in: $SEARCH_PATH"
grep -R --include="*.py" $SEARCH_PRED "${=SEARCH_PATH}" ;
}
function grepe () {
echo "Grepping for $@"
grep -R --include="*.elm" "$@" * ;
}
function grepj () {
echo "Grepping for $@"
grep -R --include="*.js" "$@" * ;
}
# This is mostly for brew
export PATH="/usr/local/sbin:$PATH"
# Local binaries
export PATH="$HOME/bin:$PATH"