Is it possible to run an external command and store its output in a register?
:redir
works for ex commands, not for external commands (afaik):r !
runs the external command but directly inserts output into the
current bufferFound the answer thanks to a user on the vim-use mailing list:
:let @a = system("ls -l")
To run a command with the file under the cursor as argument:
:let @a = system("ls -l " . shellescape(expand('<cfile>')))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With