I'd like to edit existing fish functions in VS Code, but can't seem to get funced to behave as expected.
Here's what I've tried:
$ set VISUAL code # also tried /usr/local/bin/code
$ funced print_bool
Editor exited but the function was not modified
$ funced print_bool -e code # or /usr/local/bin/code
Editor exited but the function was not modified
In each case, VS Code opens an empty file titled "print_bool.fish"…
…however, print_bool
isn't an empty function:
$ funced print_bool -i
$ print_bool> function print_bool --argument arg
if eval $arg
echo true
else
echo false
end
end
What am I missing here?
CodePudding user response:
To use code
as a synchronous editor, pass --wait
:
set -x VISUAL 'code --wait'
otherwise the command will return immediately before the file is saved, so fish will conclude the file has not been changed.