add base setup with dotter
This commit is contained in:
parent
6b0da868bb
commit
22c4779e10
175 changed files with 58 additions and 51 deletions
25
config/fzf/widgets/atuin-history_widget.zsh
Normal file
25
config/fzf/widgets/atuin-history_widget.zsh
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue