-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
139 lines (116 loc) · 4.2 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
# 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
# Keybindings
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey -v
# Exports
export EDITOR="nvim"
export TERMINAL="kitty"
export BROWSER="google-chrome"
export PATH="$HOME/.local/bin":$PATH
export PATH=$HOME/.cargo/bin:$PATH
export PATH=$HOME/.local/share/go/bin:$PATH
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH="$GEM_HOME/bin:$PATH"
export MANPAGER='nvim +Man!'
export ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
export GOPATH=$HOME/go
export XDG_CURRENT_DESKTOP="Wayland"
export UE4_ROOT=~/UnrealEngine_4.26
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export BAT_THEME=tokyonight_night
# Plugins
## Download Zinit, if it's not there yet
if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)"
echo "Downloading Zinit..."
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
echo "Zinit downloaded"
fi
source "${ZINIT_HOME}/zinit.zsh"
## To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
zinit ice depth=1; zinit light romkatv/powerlevel10k
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
## Third party
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-syntax-highlighting
zinit light Aloxaf/fzf-tab
zinit light jeffreytse/zsh-vi-mode
## Add in snippets
zinit snippet OMZP::command-not-found
## Load completions
autoload -Uz compinit && compinit
zinit cdreplay -q
# Aliases
alias k="kubectl"
alias nvimrc="cd ~/.config/nvim/ && ${EDITOR:-nvim}"
alias voguerc="cd ~/workspaces/vogue/ && ${EDITOR:-nvim}"
alias zshrc="cd ~ && ${EDITOR:-nvim} .zshrc"
alias vim="nvim"
if [[ $TERM == "xterm-kitty" ]]; then
alias ssh="kitty +kitten ssh"
fi
if command -v bat &> /dev/null; then
alias cat="bat -pp"
alias catt="bat"
fi
if command -v eza &> /dev/null; then
alias ls="eza --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions"
fi
# History
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
# brew
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Advanced customization of fzf options via _fzf_comprun function
# - The first argument to the function is the name of the command.
# - You should make sure to pass the rest of the arguments to fzf.
_fzf_comprun() {
local command=$1
shift
case "$command" in
cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;;
export|unset) fzf --preview "eval 'echo \${}'" "$@" ;;
ssh) fzf --preview 'dig {}' "$@" ;;
*) fzf --preview "$show_file_or_dir_preview" "$@" ;;
esac
}
# completion settings
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
# fzf
# https://github.com/josean-dev/dev-environment-files/blob/main/.zshrc
eval "$(fzf --zsh)"
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \
--color=fg:#c0caf5,bg:#1a1b26,hl:#ff9e64 \
--color=fg+:#c0caf5,bg+:#292e42,hl+:#ff9e64 \
--color=info:#7aa2f7,prompt:#7dcfff,pointer:#7dcfff \
--color=marker:#9ece6a,spinner:#9ece6a,header:#9ece6a"
export FZF_CTRL_T_OPTS="--preview '$show_file_or_dir_preview'"
export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'"
# zioxide
if (( $+commands[zoxide] )); then
eval "$(zoxide init --cmd cd zsh)"
else
echo 'zoxide: command not found, please install it from https://github.com/ajeetdsouza/zoxide'
fi