skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.86k stars 111 forks source link

Question: how to pass a variable to the command #221

Closed hidetatz closed 3 years ago

hidetatz commented 3 years ago

It might be a stupid question, but may I know how to pass a variable to the command which will be executed by AsyncRun? What I want to do is this:

function RunGoTest()
  let l:func_name = "some_function_name" " this dynamically changes by the cursor position
  AsyncRun! "go test -run " . l:func_name ./...
endf

Then, run :call RunGoTest().

The above code did not work because (I guess) "go test -run" is treated as one command (the actual output was command not found).