-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
·185 lines (151 loc) · 5.92 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
184
185
# Aliases
alias ls="lsd --oneline"
alias cat="bat --plain"
alias python=python3
alias oil="nvim +Oil"
# alias nvim=/home/ibrahim/nvim/bin/nvim
alias n="nvim"
export PATH="/home/ibrahim/.local/share/nvim/mason/bin:$PATH"
export PATH="/home/ibrahim/.dotnet:$PATH"
export PATH="/home/ibrahim/espeak:$PATH"
export PERSONAL_REPOS=/home/ibrahim/personal/repos
export WORK_REPOS=/home/ibrahim/work/repos
export EDITOR=nvim
export MANPAGER='nvim +Man!'
export PAGER="less"
export LESS="-FXR"
export VISUAL="nvim --cmd 'let g:flatten_wait=1'" # allows edit-exec <C-x><C-e>
# 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.
SAVEHIST=1000 # Save most-recent 1000 lines
HISTFILE=~/.zsh_history
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
#Zinit
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
source "${ZINIT_HOME}/zinit.zsh"
fpath=($HOME/.stripe $fpath)
# source $HOME/personal/repos/zsh-autocomplete/zsh-autocomplete.plugin.zsh
zstyle :compinstall filename '/home/ibrahim/.zshrc'
autoload bashcompinit; bashcompinit
autoload -Uz compinit; compinit
_comp_options+=(globdots) # With hidden files
_dotnet_zsh_complete()
{
local completions=("$(dotnet complete "$words")")
# If the completion list is empty, just continue with filename selection
if [ -z "$completions" ]
then
_arguments '*::arguments: _normal'
return
fi
# This is not a variable assignment, don't remove spaces!
_values = "${(ps:\n:)completions}"
}
compdef _dotnet_zsh_complete dotnet
complete -C "/usr/local/bin/aws_completer" aws
zinit light Aloxaf/fzf-tab
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# preview directory's content with exa when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'lsd -1 --color=always $realpath'
# switch group using `,` and `.`
zstyle ':fzf-tab:*' switch-group ',' '.'
#source ~/.config/.zsh/zinit.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
#
#[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# source <(kubectl completion zsh)
#eval "$(register-python-argcomplete /etc/bash_completion.d/az.completion)"
#sudo ip link set dev eth0 mtu 1350
zinit ice depth=1;zinit light jeffreytse/zsh-vi-mode
zinit ice depth=1; zinit light romkatv/powerlevel10k
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light zdharma-continuum/fast-syntax-highlighting
setopt extendedglob nomatch notify HIST_SAVE_NO_DUPS
setopt AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_SILENT
unsetopt autocd beep
bindkey -v
zmodload zsh/complist
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
# rclone --vfs-cache-mode writes mount "onedrive": /home/ibrahim/personal/onedrive
ZSH_AUTOSUGGEST_STRATEGY=(completion history)
bindkey '^ ' autosuggest-accept
zmodload zsh/zpty
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
autoload -U add-zsh-hook
load-nvmrc() {
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" != "$(nvm version)" ]; then
nvm use
fi
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
# timedatectl set-local-rtc 1 --adjust-system-clock
### End of Zinit's installer chunk
# Start Agent
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi
setopt AUTO_CONTINUE
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
alias vw="sudo ~/work/start-vpn.sh"
alias systeminfo=neofetch
alias calc=/usr/bin/bc
function() {
local bluetooth_headphones="80:C3:BA:4A:30:8B"
alias bc="bluetoothctl unblock $bluetooth_headphones; bluetoothctl connect $bluetooth_headphones;"
alias bd="bluetoothctl disconnect $bluetooth_headphones; bluetoothctl block $bluetooth_headphones;"
}
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
zvm_vi_yank () {
zvm_yank
printf %s "${CUTBUFFER}" | wl-copy -n
zvm_exit_visual_mode
}
# zvm_vi_put_after () {
# CUTBUFFER=\$(wl-paste -n)
# printf %s "${CUTBUFFER}" | wl-copy -n
# zvm_exit_visual_mode
# }
# for f in zvm_vi_put_after zvm_vi_put_before; do
# eval "$(echo "_$f() {"; declare -f $f | tail -n +2)"
# eval "$f() { CUTBUFFER=\$(wl-paste -n); _$f; zvm_highlight clear }"
# done
alias prune-node-modules=find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
# alias grant-pull=aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 654654578139.dkr.ecr.eu-central-1.amazonaws.com