This commit is contained in:
2024-06-19 06:59:47 -05:00
parent e318d180bf
commit 364e662a9e
2 changed files with 9 additions and 15 deletions

View File

@@ -109,22 +109,14 @@ fi
fzf-history-widget() { fzf-history-widget() {
local selected num local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
# Ensure the associative history array, which maps event numbers to the full selected="$(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
# history lines, is loaded, and that Perl is installed for multi-line output. FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \
if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"
selected="$(printf '%1$s\t%2$s\000' "${(vk)history[@]}" |
perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\s+(.*)/, $1)}++) { s/\n/\n\t/gm; print; }' |
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"
else
selected="$(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"
fi
local ret=$? local ret=$?
if [ -n "$selected" ]; then if [ -n "$selected" ]; then
if num=$(awk '{print $1; exit}' <<< "$selected" | grep -o '^[1-9][0-9]*'); then num=$(awk '{print $1}' <<< "$selected")
zle vi-fetch-history -n $num if [[ "$num" =~ '^[1-9][0-9]*\*?$' ]]; then
zle vi-fetch-history -n ${num%\*}
else # selected is a custom query, not from history else # selected is a custom query, not from history
LBUFFER="$selected" LBUFFER="$selected"
fi fi

View File

@@ -29,7 +29,6 @@ required_packages_pacman:
- wayland - wayland
- kanshi - kanshi
- xdg-desktop-portal-gtk - xdg-desktop-portal-gtk
- gnome-tweaks
- nautilus - nautilus
- eza - eza
- bat - bat
@@ -45,6 +44,7 @@ required_packages_pacman:
- networkmanager-openvpn - networkmanager-openvpn
- openresolv - openresolv
- xsettingsd - xsettingsd
- vivid
flatpak_remote: flatpak_remote:
- {name: 'flathub', url: "https://dl.flathub.org/repo/flathub.flatpakrepo"} - {name: 'flathub', url: "https://dl.flathub.org/repo/flathub.flatpakrepo"}
@@ -56,3 +56,5 @@ required_packages_flatpak:
- com.github.tchx84.Flatseal - com.github.tchx84.Flatseal
- com.vscodium.codium - com.vscodium.codium
systemd_service:
- ly.service