-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
95 lines (75 loc) · 2.38 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
path=(~/.local/bin $path)
#node
path=(/opt/homebrew/opt/node@18/bin ~/.npm-packages/bin $path)
# haskell
path=(~/.cabal/bin ~/.ghcup/bin $path)
# rust
source "$HOME/.cargo/env"
mkdir -p ~/.zfunc
fpath+=~/.zfunc
rustup completions zsh cargo > ~/.zfunc/_cargo
rustup completions zsh rustup > ~/.zfunc/_rustup
export LC_ALL='en_US.UTF-8'
export EDITOR=nvim
# completion
autoload -Uz compinit && compinit -i
zstyle ':completion:*' menu select
# prompt
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git*' formats '%F{2}%b%f'
precmd () {
vcs_info
}
setopt PROMPT_SUBST
PROMPT='%F{5}%n%f %~ %B%F{2}>%f%b '
RPROMPT='${vcs_info_msg_0_}'
setopt AUTOCD
# history
HISTFILE=~/.zhistory
HISTSIZE=1000 # history lines within session
SAVEHIST=1000 # history lines saved to file
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
# keybindings
bindkey '^[[3~' delete-char
autoload -U up-line-or-beginning-search && zle -N up-line-or-beginning-search
bindkey '^[[A' up-line-or-beginning-search
autoload -U down-line-or-beginning-search && zle -N down-line-or-beginning-search
bindkey '^[[B' down-line-or-beginning-search
# aliases
alias up='brew update && brew upgrade && brew upgrade --cask && brew cleanup'
alias lock='chflags uchg'
alias unlock='chflags nouchg'
alias rm=trash
alias c='clear'
alias gbc='git br --merged | rg -v "\* .*" | xargs git br -D'
alias l='eza -l'
alias ll='eza -TlL 2'
alias la='eza -la'
alias nv='nvim'
# almrc
source "${ZDOTDIR:-$HOME}/.almrc"
# nix
# NB: /nix/nix-installer uninstall
nix_path='/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
[ -f $nix_path ] && source $nix_path
# ocaml
if [ $commands[opam] ]; then
source <(opam env)
fi
# fzf
# NB: /opt/homebrew/opt/fzf/install
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPTS='--cycle --layout=reverse'
# kubernetes
if [ $commands[kubectl] ]; then
source <(kubectl completion zsh)
fi
# base commands
eval "$(starship init zsh)"
eval "$(zoxide init zsh)"
eval "$(atuin init zsh --disable-up-arrow)"