-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_zshrc
97 lines (81 loc) · 2.35 KB
/
dot_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
# Preserve History
HISTFILE=~/.zsh_history
HISTSIZE=5000
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# Completion & Keybind
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 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath'
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
autoload -Uz compinit && compinit
# Edit the current command line in $EDITOR
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^v' edit-command-line
# Initialize programs
eval "$(starship init zsh)"
eval "$(zoxide init --cmd cd zsh)"
eval "$(fzf --zsh)"
# Source nvm
source /usr/share/nvm/init-nvm.sh
# Add directory to PATH env
path+=~/.yarn/bin
path+=~/.cargo/bin
# Run fastfetch
fastfetch
# Aliases
alias c="clear"
alias vim="nvim"
alias v="nvim"
alias ls="eza --group-directories-first --icons=auto --git -h"
alias ll="ls -la"
alias cat="bat"
alias lg="lazygit"
# Yazi yy shell wrapper
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd "$cwd"
fi
rm -f -- "$tmp"
}
# Environment variables
# use tty gpg
export GPG_TTY=$(tty)
# set default editor as neovim
export VISUAL=nvim
export EDITOR=$VISUAL
# Start ssh-agent (if it's not started yet), and remove any output
[ -z "$SSH_AUTH_SOCK" ] && eval "$(ssh-agent -s | grep -v '^echo')"
# Initialize Zinit
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# Download Zinit, if it's not there yet
if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# Source / Load zinit
source "${ZINIT_HOME}/zinit.zsh"
# Add zsh plugin
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
zinit snippet OMZP::command-not-found
zinit snippet OMZP::sudo
zinit snippet OMZP::colored-man-pages
zinit cdreplay -q
# vim: filetype=sh syntax=sh