If you just straight-up type:
%sh{ echo "evaluate-commands %{ map global normal j k; map global normal k j}" }
…at the :
prompt, or paste it into your kakrc
, then Kakoune will evaluate the shell-script, and replace the %sh{}
block with the script’s standard output as a single string. You can get the same effect by just writing:
'evaluate-commands %{ map global normal j k; map global normal k j}'
Of course, because it’s a single string, Kakoune doesn’t look inside it, it just takes the whole thing and tries to look it up in the list of available commands. It can’t find such a command, because legitimate command names cannot contain spaces or %
or ;
.
If your shell-script produced just a command name, it would work:
%sh{ echo "info" } "hello world"
Here the shell block produces the output “info”, which is a real command, so Kakoune tries to execute:
"info" "hello world"
…which works.
On the other hand, if you wanted the shell-script to output a whole string of commands for Kakoune to evaluate, you need to use evaluate-commands
to make Kakoune look inside the shell output and evaluate what it sees:
evaluate-commands %sh{ echo "evaluate-commands %{ map global normal j k; map global normal k j}" }