-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
183 lines (158 loc) · 5.56 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Lines configured by zsh-newuser-install
HISTFILE=$HOME/.histfile
HISTSIZE=100000
SAVEHIST=100000
setopt notify
unsetopt autocd beep
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '$HOME/.zshrc'
# autoload -Uz compinit
# compinit
# End of lines added by compinstall
# prompt showing red error codes
# PROMPT='%(?..%F{red}%?%f)%# '
setopt share_history
export HISTTIMEFORMAT="[%F %T] "
setopt hist_find_no_dups
# _history-incremental-search-backward () {
# zle .history-incremental-search-backward $BUFFER
# }
# zle -N history-incremental-search-backward _history-incremental-search-backward
# plugins
CONFIG_DIR=$HOME/.config/zsh
# autocomplete
# source $HOME/.config/zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh
# zstyle ':autocomplete:*' min-delay 0.5
# zstyle ':autocomplete:*' min-input 5
# powerlevel10k theme
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=proxy
source $CONFIG_DIR/powerlevel10k/powerlevel10k.zsh-theme
# fish like autosuggestions
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
source $CONFIG_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh
# fish like syntax highlighting
source $CONFIG_DIR/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
# fish like aabbreviations
source $CONFIG_DIR/zsh-abbr/zsh-abbr.zsh
# history multi word search
source $CONFIG_DIR/history-search-multi-word/history-search-multi-word.plugin.zsh
# zsh script for autojump
export ZSHZ_CMD=j
export ZSHZ_TILDE=1
export ZSHZ_UNCOMMON=1
export ZSHZ_TRAILING_SLASH=1
source $HOME/.config/zsh/zsh-z/zsh-z.plugin.zsh
# per directory history. press ^G to toggle between local and global histories
source $HOME/.config/zsh/per-directory-history/per-directory-history.zsh
# add directories to stack
setopt auto_pushd
# completion options
setopt complete_in_word
setopt always_to_end
setopt path_dirs
setopt auto_list
autoload -U compinit && compinit
# match anwhere in a word
zstyle ':completion:*' matcher-list '' '' '' 'l:|=*' 'r:|=*'
zstyle ':completion:*' menu select
zstyle ':completion:*:directory-stack' list-colors '=(#b) #([0-9]#)*( *)==95=38;5;12' # colors for cd -
# Completion for kitty
# kitty + complete setup zsh | source /dev/stdin
# enable direnv
# eval "$(direnv hook zsh)"
# change what counts as a word.
WORDCHARS='~!#$%^&*<>+;-'
# initialize z.lua
# eval "$(lua $HOME/source/z.lua/z.lua --init zsh enhanced once)"
# export _ZL_ECHO=1
# always ls after changing dir
chpwd() { ls }
# no beeping noise please
setopt nobeep
# interpret a single value as `cd $value` if the value isn't a command
setopt autocd
# allow more complex glob patterns
setopt extendedglob
# simple spellcheck of commands
setopt correct
# Aliases:
# manage config files
alias config="/usr/bin/git --git-dir=$HOME/.configrepo/ --work-tree=$HOME"
alias csync="config commit --allow-empty -am 'sync' && config pull && config submodule update --init --recursive && config push"
[ -e .zshalias ] && source .zshalias
open_kakoune() {
repopwd=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ $? -eq 0 ]]
then
local reponame=$repopwd:t
kak -c $reponame $* 2>/dev/null
if [[ $? -ne 0 ]]
then
kak -d -s $reponame -E ":cd $repopwd" &!
sleep .1
kak -c $reponame $*
fi
else
kak $*
fi
}
alias k="open_kakoune"
alias py="python"
# todo: make these abbreviations
os=$(uname -a)
case $os in
*Ubuntu*)
alias s="sudo apt search"
alias i="sudo apt install" ;;
*Fedora*)
alias s="sudo dnf search"
alias i="sudo dnf install" ;;
*Darwin*)
alias s="brew search"
alias i="brew install" ;;
*)
alias s="echo 'Error: No search alias for this OS'"
alias i="echo 'Error: No install alias for this OS'" ;;
esac
alias ...="cd ../.."
alias ....="cd ../../.."
[[ ! -f $HOME/.config/zsh/local.zsh ]] || source $HOME/.config/zsh/local.zsh
# source $HOME/.config/broot/launcher/bash/br
# nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use
# autoload -U add-zsh-hook
# load-nvmrc() {
# local node_version="$(nvm version)"
# local nvmrc_path="$(nvm_find_nvmrc)"
#
# if [ -n "$nvmrc_path" ]; then
# local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
#
# if [ "$nvmrc_node_version" = "N/A" ]; then
# nvm install
# elif [ "$nvmrc_node_version" != "$node_version" ]; then
# nvm use
# fi
# elif [ "$node_version" != "$(nvm version default)" ]; then
# echo "Reverting to nvm default version"
# nvm use default
# fi
# }
# add-zsh-hook chpwd load-nvmrc
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/NM_Root_CA2.pem
export NVM_DIR=/Users/TUT1039/.nvm || [ -s /Users/TUT1039/.nvm/nvm.sh ] && \. /Users/TUT1039/.nvm/nvm.sh # This loads nvm
source ~/.bash_profile