From 1d827d1d2de97c1acd1775367b956fb6c880e76d Mon Sep 17 00:00:00 2001 From: phanium <91544758+phanen@users.noreply.github.com> Date: Sat, 1 Feb 2025 19:22:58 +0800 Subject: [PATCH] Fix twice tokenize editor_cmd ```fish export VISUAL='nvim --cmd let\ g:flatten_wait=1' funced -s fish_prompt ``` `editor_cmd[3]` would be `let` rather than `let g:flatten_wait=1` --- share/functions/funced.fish | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/share/functions/funced.fish b/share/functions/funced.fish index 2a38d2420..c68592547 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -20,7 +20,7 @@ function funced --description 'Edit function definition' if set -q _flag_interactive set editor fish else if set -q _flag_editor - set editor $_flag_editor + echo $_flag_editor | read -at editor else if set -q VISUAL echo $VISUAL | read -at editor else if set -q EDITOR @@ -37,11 +37,8 @@ function funced --description 'Edit function definition' set init function $funcname\n\nend end - # Break editor up to get its first command (i.e. discard flags) - set -l editor_cmd - echo $editor | read -ta editor_cmd - if not type -q -f "$editor_cmd[1]" - echo (_ "funced: The value for \$EDITOR '$editor' could not be used because the command '$editor_cmd[1]' could not be found") >&2 + if not type -q -f "$editor[1]" + echo (_ "funced: The value for \$EDITOR '$editor' could not be used because the command '$editor[1]' could not be found") >&2 set editor fish end @@ -88,7 +85,7 @@ function funced --description 'Edit function definition' while true set -l checksum (__fish_md5 "$tmpname") - if not $editor_cmd $tmpname + if not $editor $tmpname echo (_ "Editing failed or was cancelled") else # Verify the checksum (if present) to detect potential problems