Multi line `execute-keys`

When I try to break a line inside a execute keys I get error:

 execute-keys '!lua -e "
        a = 'foo';

Is there a work around ?

Your issue is to not double-up the single quotes.

echo 'a''b'

It is recommended however to not pass complex strings – such as a script – to execute-keys, because of the key interpretation.

# Save the shell command register
evaluate-commands -save-regs '|' %{
  # Set the shell command to execute
  set-register | %{
    lua -e '
      a = "foo"

  # Insert the output of the shell command
  execute-keys '!<ret>'

You can also use a heredoc without interpolation or escapes:

lua <<'EOF'
1 Like

Would something like this work?

 execute-keys %{!lua -e "
        a = 'foo';

@scr I added a tiny execute-key command to allow to do that.

execute-key ! %{
  lua -e '
    io.write("Hello, World!")