1

I am developing a neovim client using RPC, and trying to get all status line texts shown in below figure. Are there any ways to get them?

I have already tried using execute function and the redirection function, but they can only get them partially. I would like to get all strings.

enter image description here

  • that are not the statusline strings. You can capture the output from various commands using redir or execute(), but you cannot obtain the statusline strings. – Christian Brabandt Mar 31 at 7:51
1

You need to use :h :redir

Try the following:

:redir @a
:ls
:redir END
:reg a

The above commands will redirect the output of the commands used in between redir@a and redir END to register a (see :h :reg).

You can also redirect output to

  • A file with :redir >> file
  • A register with :redir @{a-z} or :redir @{a-z}>
  • Selection clipboard with :redir @*>
  • A variable with :redir => {var}

And you can append (not overwrite) to the already contents stored in the registers, files, variables by using >> instead of > in all the above :h :redir commands. That is you can append the output of a command to

  • A file with :redir >> file
  • A register with :redir @{a-z}>> or :redir @{A-Z}> or :redir @{A-Z}
  • Selection clipboard with :redir @*>>
  • A variable with :redir =>> {var}
  • 2
    Also the execute() function returns output – D. Ben Knoble Mar 31 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.