-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
151 lines (116 loc) · 3.69 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
# Configs
export EDITOR='vim'
# Disable XON/XOFF
stty -ixon
# Install zplug if not presente
if [[ ! -d ~/.zplug ]]; then
git clone https://github.com/zplug/zplug ~/.zplug
source ~/.zplug/init.zsh && zplug update --self
fi
# Source zplug/zplug
source ~/.zplug/init.zsh
#
# Declare custom theme segments here
# https://github.com/Powerlevel9k/powerlevel9k#custom_command
#
custom::is_git() {
# See https://git.io/fp8Pa for related discussion
[[ $(command git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]
}
custom_dir() {
local 'dir' 'trunc_prefix'
# Threat repo root as a top-level directory or not
if custom::is_git; then
local git_root=$(git rev-parse --show-toplevel)
dir="$git_root:t${${PWD:A}#$~~git_root}"
else
dir="%~"
fi
echo "$dir"
}
###########
# PLUGINS #
###########
# oh-my-zsh
export ZSH=$HOME/.zplug/repos/robbyrussell/oh-my-zsh
zplug "plugins/gnu-utils", from:oh-my-zsh
# zplug "plugins/archlinux", from:oh-my-zsh, if:"which pacman"
zplug "plugins/systemd", from:oh-my-zsh, if:"which systemctl"
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/grep", from:oh-my-zsh
# zplug "plugins/colored-man-pages", from:oh-my-zsh
zplug "plugins/docker", from:oh-my-zsh
zplug "plugins/node", from:oh-my-zsh
zplug "plugins/npm", from:oh-my-zsh
zplug "plugins/yarn", from:oh-my-zsh
# zplug "plugins/rsync", from:oh-my-zsh
zplug "plugins/sudo", from:oh-my-zsh
# #zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/ruby", from:oh-my-zsh
zplug "plugins/rails", from:oh-my-zsh
zplug "plugins/bundler", from:oh-my-zsh
# zsh-user
zplug "zsh-users/zsh-completions", defer:3
zplug "zsh-users/zsh-syntax-highlighting", defer:3
zplug "zsh-users/zsh-autosuggestions", defer:3
zplug "zsh-users/zsh-history-substring-search", defer:2
# fzy
zplug "aperezdc/zsh-fzy"
# theme
POWERLEVEL9K_MODE='awesome-fontconfig'
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context ssh custom_dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)
POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
export DEFAULT_USER="$USER"
zplug "bhilburn/powerlevel9k", use:powerlevel9k.zsh-theme
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Then, source plugins and add commands to $PATH
zplug load # --verbose
# Autocomplete from man pages
#zstyle ':completion:*:manuals' separate-sections true
#zstyle ':completion:*:manuals.*' insert-sections true
#zstyle ':completion:*:man:*' menu yes select
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
source $ZSH/oh-my-zsh.sh
# zsh-fzy
# ALT-C: cd into the selected directory
bindkey '\ec' fzy-cd-widget
# CTRL-T: Place the selected file path in the command line
zstyle :fzy:file command rg --files
bindkey '^T' fzy-file-widget
# CTRL-R: Place the selected command from history in the command line
# bindkey '^R' fzy-history-widget
# CTRL-P: Place the selected process ID in the command line
bindkey '^P' fzy-proc-widget
# direnv
eval "$(direnv hook zsh)"
# fzf
source '/usr/share/fzf/key-bindings.zsh'
# Less
export LESS='--RAW-CONTROL-CHARS --LINE-NUMBERS --no-init'
# fasd
eval "$(fasd --init auto)"
alias v='f -e vim'
# thefuck
eval $(thefuck --alias)
# yarn
export PATH="$(yarn global bin):$PATH"
# Encoding stuff for the terminal
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# local bins
export PATH="$HOME/.local/bin:$PATH"
# Local config
[[ -f ~/.local/.zshrc ]] && source ~/.local/.zshrc
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
[[ -f ~/.local/.aliases ]] && source ~/.local/.aliases