fish-shell/share/functions/__fish_anyeditor.fish
Johannes Altmanninger 9158395d10 Fix __fish_list_current_token and friends for multiline commandlines
Some of these handled multiline prompts but not multiline command lines. We
first need to move the cursor to the end of the commandline, then we can
print a message.  Finally, we need to move the cursor back to where it was.
2024-04-12 12:00:24 +02:00

16 lines
496 B
Fish

function __fish_anyeditor --description "Print a editor to use, or an error message"
set -l editor
if set -q VISUAL
echo $VISUAL | read -at editor
else if set -q EDITOR
echo $EDITOR | read -at editor
else
__fish_echo string join \n -- \
(_ 'External editor requested but $VISUAL or $EDITOR not set.') \
(_ 'Please set VISUAL or EDITOR to your preferred editor.')
return 1
end
string join \n $editor
return 0
end