dotfiles/zshrc
2022-05-19 10:10:00 -04:00

123 lines
4.5 KiB
Bash

# 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
# zplug
source ~/.zplug/init.zsh
zplug "zplug/zplug", hook-build:"zplug --self-manage"
zplug "romkatv/powerlevel10k", as:theme, depth:1
zplug "popstas/zsh-command-time"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "ytakahashi/igit"
zplug "mbenford/zsh-tmux-auto-title"
zplug "MichaelAquilina/zsh-you-should-use"
zplug "junegunn/fzf", from:github, as:command, rename-to:fzf, hook-build:"./install --all"
zplug "junegunn/fzf", use:"shell/*.zsh", defer:2
zplug "Aloxaf/fzf-tab", from:github
zplug "alexiszamanidis/zsh-git-fzf"
zplug "ddnexus/fm", hook-build:"./fm__compile"
zplug "larkery/zsh-histdb"
#zplug "m42e/zsh-histdb-fzf"
zplug 'm42e/zsh-histdb-skim', from:github, at:main
zplug load
# zsh options
autoload run-help
setopt auto_pushd
setopt clobber
setopt complete_aliases
setopt correct
#setopt correct_all
setopt extended_glob
setopt extended_history
setopt hash_list_all
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt no_beep
setopt no_hist_allow_clobber
setopt no_rm_star_silent
setopt notify
setopt prompt_subst
setopt pushd_ignore_dups
setopt pushd_silent
setopt pushd_to_home
setopt rm_star_wait
export SAVEHIST=1000000
export HISTSIZE=1000000
export HISTFILE=~/.zsh_history
setopt append_history
setopt share_history
# zsh plugin options
ZSH_COMMAND_TIME_MIN_SECONDS=10
ZSH_TMUX_AUTO_TITLE_SHORT=true
ZSH_TMUX_AUTO_TITLE_IDLE_TEXT="%last"
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1 --color=always $realpath'
# misc / general
export EDITOR="nano"
export PATH=~/.local/bin:${PATH}
. $HOME/.asdf/asdf.sh
alias ls="exa"
alias docker="sudo docker"
alias podman="sudo podman"
# local overrides
test -f ~/.zshrc.local && source ~/.zshrc.local
# dont do anything more if non interactive
if [[ ! -o interactive ]]; then
return
fi
# setup mode/status line for zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# ensure histdb gets ctrl-r for history
#bindkey '^R' histdb-fzf-widget
#source ~/.zplug/repos/larkery/zsh-histdb/histdb-interactive.zsh
#bindkey '^R' _histdb-isearch
bindkey '^R' histdb-skim-widget
# Fix home/end/del silly
if [[ "$TERM" != emacs ]]; then
[[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char
[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
[[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line
[[ -z "$terminfo[kich1]" ]] || bindkey -M emacs "$terminfo[kich1]" overwrite-mode
[[ -z "$terminfo[kdch1]" ]] || bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char
[[ -z "$terminfo[khome]" ]] || bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line
[[ -z "$terminfo[kend]" ]] || bindkey -M vicmd "$terminfo[kend]" vi-end-of-line
[[ -z "$terminfo[kich1]" ]] || bindkey -M vicmd "$terminfo[kich1]" overwrite-mode
[[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history
[[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
[[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history
[[ -z "$terminfo[kcuf1]" ]] || bindkey -M viins "$terminfo[kcuf1]" vi-forward-char
[[ -z "$terminfo[kcub1]" ]] || bindkey -M viins "$terminfo[kcub1]" vi-backward-char
# ncurses fogyatekos
[[ "$terminfo[kcuu1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history
[[ "$terminfo[kcud1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history
[[ "$terminfo[kcuf1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcuf1]/O/[}" vi-forward-char
[[ "$terminfo[kcub1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcub1]/O/[}" vi-backward-char
[[ "$terminfo[khome]" == "^[O"* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line
[[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line
[[ "$terminfo[khome]" == "^[O"* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line
[[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line
fi