nixos-config/zshrc

120 lines
3.6 KiB
Bash
Raw Normal View History

2024-11-04 10:54:52 -05:00
# 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
2024-10-22 11:11:45 -04:00
2024-11-04 10:54:52 -05:00
ZSH_DISABLE_COMPFIX=true
2024-10-22 11:11:45 -04:00
2024-11-04 10:54:52 -05:00
# completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu no
2024-11-04 12:52:24 -05:00
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-prewview 'ls $realpath'
2024-10-22 11:11:45 -04:00
2024-11-04 10:54:52 -05:00
# bindings
bindkey -e
bindkey "^p" history-search-backward
bindkey "^n" history-search-forward
2024-10-22 11:11:45 -04:00
2024-11-04 10:54:52 -05:00
# history
HISTSIZE=50000
HISTFILE=~/.zsh_history
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
2024-10-22 11:11:45 -04:00
alias vi=nvim
alias vim=nvim
alias t=tmux
alias se=sudoedit
alias s=sudo
alias dotfiles='/usr/bin/git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"'
2024-10-22 12:17:56 -04:00
alias cz=chezmoi
2024-10-22 11:11:45 -04:00
export PATH=$PATH:/home/yt/.cargo/bin
2024-11-04 10:54:52 -05:00
source <(fzf --zsh)
2024-10-22 11:11:45 -04:00
export FZF_BASE=/usr/bin
export FZF_DEFAULT_COMMAND=rg
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \
--highlight-line \
--info=inline-right \
--ansi \
--layout=reverse \
--border=none
--color=bg+:#283457 \
--color=bg:#16161e \
--color=border:#27a1b9 \
--color=fg:#c0caf5 \
--color=gutter:#16161e \
--color=header:#ff9e64 \
--color=hl+:#2ac3de \
--color=hl:#2ac3de \
--color=info:#545c7e \
--color=marker:#ff007c \
--color=pointer:#ff007c \
--color=prompt:#2ac3de \
--color=query:#c0caf5:regular \
--color=scrollbar:#27a1b9 \
--color=separator:#ff9e64 \
--color=spinner:#ff007c \
"
2024-11-04 10:54:52 -05:00
eval "$(zoxide init --cmd cd zsh)"
2024-10-22 11:11:45 -04:00
export NVM_DIR="$HOME/.config/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
2024-11-04 10:54:52 -05:00
### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# 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
### End of Zinit's installer chunk
# plugins
zinit ice depth=1; zinit light romkatv/powerlevel10k
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
2024-11-04 12:52:24 -05:00
zinit light z-shell/zsh-eza
2024-11-04 10:54:52 -05:00
zinit snippet OMZP::git
zinit snippet OMZP::sudo
zinit snippet OMZP::archlinux
zinit snippet OMZP::command-not-found
2024-11-04 12:52:24 -05:00
zinit snippet OMZP::colored-man-pages
2024-11-04 10:54:52 -05:00
# load completions
autoload -U compinit && compinit
zinit cdreplay -q
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh