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.85k stars 109 forks source link

Use a Vimscript Variable as a shell command #160

Closed Renzix closed 4 years ago

Renzix commented 5 years ago

The normal workaround for using a vimscript variable in a shell command is using :execute "!" . command however this does not work properly with AsyncRun because execute waits for the command to finish before sending it to standard output. I may just be stupid but is there a way to do use a vimscript variable in the shell command?

artem-nefedov commented 4 years ago

I didn't check how execute and AsyncRun work together. However, based on your description, you can work around it with <expr> mapping (if you're calling your command from mapping). For example:

 nnoremap <expr> <leader>a ":AsyncRun " . g:my_cool_var . "\<cr>"

Remove last part if you want to edit command before running it.

Renzix commented 4 years ago

Awesome works great thanks sorry for the lack of vimfu