Skip to content
Myr

nushell: Rename duplicate __fzf_defaults in completion.nu

Before adoption: this commit came in with the history the project adopted, so no landing records it.

`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`.

authored by Junegunn Choi · committed by Junegunn Choi · parent f81cb19 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:shell/completion.nu+2 added-2 removed
37 unmodified lines
3839# --- Helper Functions ---4041# Helper to build default fzf options list42def __fzf_defaults [prepend: string, append: string]: nothing -> string {42def __fzf_defaults_completion [prepend: string, append: string]: nothing -> string {43 let base = $"--height ($env.FZF_TMUX_HEIGHT? | default '40%') --min-height 20+ --bind=ctrl-z:ignore ($prepend)"44 let opts_file = if ($env.FZF_DEFAULT_OPTS_FILE? | default '' | is-not-empty) {45 try { open --raw ($env.FZF_DEFAULT_OPTS_FILE) | str trim } catch { '' }46 } else {
14 unmodified lines
61 } catch {62 null # Set to null if there's no stdin or an error occurs reading it63 }6465 let fzf_default_opts = (__fzf_defaults "" ($env.FZF_COMPLETION_OPTS | default ''))65 let fzf_default_opts = (__fzf_defaults_completion "" ($env.FZF_COMPLETION_OPTS | default ''))66 let fzf_prefinal_opt = ['--query', $query, '--reverse'] | append $fzf_opts_arg6768 # Get the configured height, defaulting to '40%'69 let height_opt = $env.FZF_TMUX_HEIGHT? | default '40%'
420 unmodified lines