-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
116 lines (89 loc) · 2.59 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
if [[ $+commands[tty] && $(tty) = "/dev/tty1" ]]; then
exec startx
fi
#
# Plugin Loading Utils
#
# I got so tired of plugin managers changing or going missing every few years,
# so I just wrote this minimal function to handle all the use-cases I need.
belak-load() {
cleaned_path=${1:l}
repo=${cleaned_path:h2}
if [[ ! -d "$HOME/.config/belak/repos/$cleaned_path" ]]; then
dirname=$(dirname $repo)
mkdir -p "$HOME/.config/belak/repos/$dirname"
git clone "https://github.com/$repo" "$HOME/.config/belak/repos/$repo"
fi
target=${2:-${cleaned_path:t}.plugin.zsh}
set --
source "$HOME/.config/belak/repos/$cleaned_path/$target"
}
#
# Plugins
#
# Specify completions we want before the completion module is loaded
belak-load 'zsh-users/zsh-completions'
# Specify which zsh-utils modules we want
belak-load 'belak/zsh-utils/editor'
belak-load 'belak/zsh-utils/history'
belak-load 'belak/zsh-utils/prompt'
belak-load 'belak/zsh-utils/utility'
belak-load 'belak/zsh-utils/completion'
# Load gitstatus for our prompt
belak-load 'romkatv/gitstatus'
#
# Settings
#
# Set any settings or overrides here - enable the prompt we want and ensure
# we're using emacs bindings.
prompt belak
bindkey -e
# Disable ^s and ^q
stty -ixon
# In order to group dirs together, we need to specify that we're grouping.
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
# List dirs first, to match what we do for ls.
zstyle ':completion:*' list-dirs-first true
# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-F -g -i -M -R -S -w -X -z-4'
#
# Aliases
#
alias json="python -mjson.tool"
alias k="kubectl"
if (( $+commands[nvim] )); then
alias vim="nvim"
fi
#
# Functions
#
gocover () {
t="/tmp/go-cover.$$.tmp"
go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t
}
#
# Additional Bundles
#
# Load fzf. This will usually be installed when neovim plugins are installed.
if [[ -f ~/.fzf.zsh ]] source ~/.fzf.zsh
if (( $+commands[jump] )); then
eval "$(jump shell)"
fi
if (( $+commands[pyenv] )); then
eval "$(pyenv init -)"
fi
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init -)"
fi
if (( $+commands[rbenv] )); then
eval "$(rbenv init -)"
fi
if (( $+commands[direnv] )); then
eval "$(direnv hook zsh)"
fi
# Make it possible to add per-machine customizations.
if [[ -f ~/.zshrc.local ]] source ~/.zshrc.local
#if [[ -f ~/.iterm2_shell_integration.zsh ]] source ~/.iterm2_shell_integration.zsh