How can I do this extremely simple operation in vim?
let g:string_from_shell = run_in_shell('awk ...')
(command use for exposition only)
You can use system function to execute system/shell commands in vim. Then, you can store its output to a vim variable.
Syntax :
:let variable = system("shell command")
You can check its output by printing the variable like
:echo variable
Example:
:let list = system("ls -ltr")
:echo list
To know more about it, give :help system() in command line.
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