From 36dc401bbd1a2081d25cfe6491f7aadb9e71d99d Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Sun, 22 Jun 2025 12:03:50 -0500 Subject: [PATCH] gnu: fzf: Use bashrc.d for Bash integration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fzf comes with two Bash integration files. The first, completion.bash, enables fzf-powered completion of various types (files, variable names, processes, etc) for various commands (cat, export, kill, etc). This is in contrast with the Bash completions most packages ship, which are based on the bash-completion package and only include completions for the package binaries. The bash-completion package lazily loads completions from bash_completion.d directories when the user invokes completion for a given command. fzf’s completion.bash shouldn’t be installed to etc/bash_completion.d/fzf, since it doesn’t depend on bash-completion and it supplies completions for more than just the fzf binary. Instead, install it to the more general bashrc.d, where users can source it so fzf-powered completions are immediately available for common commands. The second, key-bindings.bash, provides fzf-based history search for C-r as well as a couple other convenient bindings. Install it to bashrc.d as well so users can source it. * gnu/packages/terminals.scm (fzf): [phases]{install-completions}: Use bashrc.d for Bash integration files. Change-Id: Ied0ec1187a04bcc74d39ee22957fc9b4573b5992 Signed-off-by: Sharlatan Hellseher --- gnu/packages/terminals.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm index 23faaa9d8e0..1a1ce1d297e 100644 --- a/gnu/packages/terminals.scm +++ b/gnu/packages/terminals.scm @@ -44,6 +44,7 @@ ;;; Copyright © 2024 Ashvith Shetty ;;; Copyright © 2024, 2025 Artyom V. Poptsov ;;; Copyright © 2025 Roman Scherer +;;; Copyright © 2025 Liam Hupfer ;;; ;;; This file is part of GNU Guix. ;;; @@ -1025,16 +1026,18 @@ minimalistic.") `("PATH" ":" prefix (,(string-append ncurses "/bin"))))))) (add-after 'install 'install-completions (lambda* (#:key import-path #:allow-other-keys) - (let* ((bash-completion - (string-append #$output "/etc/bash_completion.d")) + (let* ((bashrc-functions + (string-append #$output "/etc/bashrc.d")) (fish-functions (string-append #$output "/share/fish/vendor_functions.d")) (zsh-completion (string-append #$output "/share/zsh/site-functions"))) (with-directory-excursion (string-append "src/" import-path) - (mkdir-p bash-completion) + (mkdir-p bashrc-functions) (copy-file "shell/completion.bash" - (string-append bash-completion "/fzf")) + (string-append bashrc-functions "/fzf-completion.bash")) + (copy-file "shell/key-bindings.bash" + (string-append bashrc-functions "/fzf-bindings.bash")) (mkdir-p fish-functions) (copy-file "shell/key-bindings.fish" (string-append fish-functions "/fzf_key_bindings.fish"))