add base setup with dotter

This commit is contained in:
Alexander Navarro 2024-11-08 22:53:56 +00:00 committed by aleidk
parent 6b0da868bb
commit 42e6595b60
177 changed files with 1062 additions and 70 deletions

View file

@ -0,0 +1,25 @@
fzf-atuin-history-widget() {
local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
selected=( $(atuin history list --cmd-only | tac | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' | bat --color=always --wrap never --language=sh --style=plain |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )
local ret=$?
if [ -n "$selected" ]; then
cmd=$selected[1,-1]
if [ -n "$cmd" ]; then
zle vi-fetch-history -n $cmd
fi
fi
zle -U "$cmd"
zle kill-buffer
zle reset-prompt
return $ret
}
if ! command -v atuin > /dev/null; then
zle -N fzf-history-widget
bindkey '^R' fzf-history-widget
else
zle -N fzf-atuin-history-widget
bindkey '^R' fzf-atuin-history-widget
fi