From 02594f8dbc66db134cd793decb4bbfa367e9297f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 23 May 2026 23:34:04 +0900 Subject: [PATCH] nushell: Rename duplicate __fzf_defaults in completion.nu `fzf --nushell` concatenates key-bindings.nu and completion.nu, both of which defined `__fzf_defaults`, causing the resulting autoload file to fail parsing: Error: nu::parser::duplicate_command_def x Duplicate command definition within a block. ,-[/Users/jg/.config/nushell/autoload/_fzf_integration.nu:211:5] 210 | # Helper to build default fzf options list 211 | def __fzf_defaults [prepend: string, append: string]: nothing -> string { : ------+------ : `-- defined more than once 212 | let base = $"--height ($env.FZF_TMUX_HEIGHT? | default '40%') ... `---- Rename the completion.nu copy to `__fzf_defaults_completion`. --- shell/completion.nu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/completion.nu b/shell/completion.nu index fde82608..2acf7588 100644 --- a/shell/completion.nu +++ b/shell/completion.nu @@ -39,7 +39,7 @@ $env.FZF_COMPLETION_DIR_COMMANDS = $env.FZF_COMPLETION_DIR_COMMANDS? | default [ # --- Helper Functions --- # Helper to build default fzf options list -def __fzf_defaults [prepend: string, append: string]: nothing -> string { +def __fzf_defaults_completion [prepend: string, append: string]: nothing -> string { let base = $"--height ($env.FZF_TMUX_HEIGHT? | default '40%') --min-height 20+ --bind=ctrl-z:ignore ($prepend)" let opts_file = if ($env.FZF_DEFAULT_OPTS_FILE? | default '' | is-not-empty) { try { open --raw ($env.FZF_DEFAULT_OPTS_FILE) | str trim } catch { '' } @@ -62,7 +62,7 @@ def __fzf_comprun [ context_name: string # e.g., "fzf-completion" , "fzf-h null # Set to null if there's no stdin or an error occurs reading it } - let fzf_default_opts = (__fzf_defaults "" ($env.FZF_COMPLETION_OPTS | default '')) + let fzf_default_opts = (__fzf_defaults_completion "" ($env.FZF_COMPLETION_OPTS | default '')) let fzf_prefinal_opt = ['--query', $query, '--reverse'] | append $fzf_opts_arg # Get the configured height, defaulting to '40%'