-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
102 lines (79 loc) · 2.84 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
# Other no configuration plugins as a record of what to install when moving to new laptop:
# stow
# tldr (tealdeer)
# tmux (zellij)
## Start tmux
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
exec tmux new -As tmux
fi
## Start zellij
# modified from this command: zellij setup --generate-auto-start zsh
# if [[ -z "$ZELLIJ" ]]; then
# zellij a main || zellij -s main || zellij
# exit
# fi
# 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
setopt inc_append_history
setopt share_history
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# fzf
source <(fzf --zsh)
# ripgrep (replaces grep)
alias grep="rg"
# fd (replaces find)
alias find="fd"
# dust (replaces du)
alias du="dust"
# eza (replaces ls)
alias ls="eza"
alias tree="eza --tree"
# bat (replaces cat)
alias cat="bat -p"
# zoxide (replaces cd)
eval "$(zoxide init zsh --cmd cd)"
# direnv
eval "$(direnv hook zsh)"
# gnu sed (replaces sed)
alias sed="gsed"
# rsync (aliased for mv and cp to allow show progress, also rmb to install latest version using brew)
alias cp="rsync --info=progress2 --info=name0"
alias mv="rsync --info=progress2 --info=name0 --remove-source-files --archive"
# nvim
alias vim="nvim"
mkcd() {
mkdir $1 ; cd $1
}
# fzf-tab
zstyle ':completion:*' menu no
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 -a --color=always $realpath'
autoload -U compinit; compinit
source ~/somewhere/fzf-tab.plugin.zsh
# powerlevel10k
source /opt/homebrew/share/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.config/.p10k.zsh ]] || source ~/.config/.p10k.zsh # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
# zsh-auto-suggestions
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
unset ZSH_AUTOSUGGEST_USE_ASYNC # To fix incompatibility issue: https://github.com/romkatv/powerlevel10k/issues/1554#issuecomment-1701598955
# zsh-syntax-highlighting (Note this must be the near? last command in .zshrc)
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# vi mode
bindkey -v
export KEYTIMEOUT=1
# https://github.com/kutsan/zsh-system-clipboard
source "${ZSH_CUSTOM:-$HOME/.zsh}/plugins/zsh-system-clipboard/zsh-system-clipboard.zsh"
# others
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
export EDITOR=nvim
export VISUAL=nvim