95 lines
2.4 KiB
Bash
Executable File
95 lines
2.4 KiB
Bash
Executable File
|
|
|
|
# set the directory we want to store zinit and plugins
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.locale/share}/zinit/zinit.git"
|
|
|
|
# Download Zinit
|
|
if [ ! -d "$ZINIT_HOME" ]; then
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
fi
|
|
|
|
# Source zsh, alias
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
source ~/.aliases.zsh
|
|
source ~/.plugins.zsh
|
|
source ~/.export.zsh
|
|
# Set up fzf key bindings and fuzzy completion
|
|
source <(fzf --zsh)
|
|
|
|
# Load completions
|
|
autoload -U compinit && compinit
|
|
|
|
## zinit cdreplay -q
|
|
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)"
|
|
|
|
#eval "$(ssh-agent -s)"
|
|
#if ! pgrep -u "$USER" ssh-agent > /dev/null; then
|
|
# ssh-agent > ~/.ssh-agent.env
|
|
#fi
|
|
#if [[ -z "$SSH_AUTH_SOCK" ]]; then
|
|
# source ~/.ssh-agent.env > /dev/null
|
|
#fi
|
|
|
|
|
|
# Bindkey
|
|
bindkey -e
|
|
bindkey '^p' history-search-backward
|
|
bindkey '^n' history-search-forward
|
|
|
|
# History
|
|
HISTSIZE=5000
|
|
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
|
|
|
|
# Completion styling
|
|
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 'ls --color $realpath'
|
|
|
|
# Shell integration
|
|
eval "$(fzf --zsh)"
|
|
eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
_fzf_comprun() {
|
|
local command=$1
|
|
shift
|
|
|
|
case "$command" in
|
|
cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;;
|
|
export|unset) fzf --preview "eval 'echo \$' {}" "$@" ;;
|
|
ssh) fzf --preview 'dig {}' "$@" ;;
|
|
*) fzf --preview "--preview 'bat -n --color=always --line-range :10 {}'" "$@" ;;
|
|
esac
|
|
}
|
|
|
|
function y() {
|
|
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
|
|
yazi "$@" --cwd-file="$tmp"
|
|
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
|
builtin cd -- "$cwd"
|
|
fi
|
|
rm -f -- "$tmp"
|
|
}
|
|
|
|
# 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
|
|
|
|
# . "$HOME/.local/bin/env"
|