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

modeline like file-specific command for AsyncRun? #243

Closed haolian9 closed 2 years ago

haolian9 commented 2 years ago

inspired by vim's modeline, i think if asyncrun provides a similar feature would more convenient.

say i have a file contains a line like this, and when asyncrun runs, it expects this line.

# asyncrun: -mode=term -pos=tab python "$(VIM_FILEPATH)"

it's very handy when there are many small single-file-sourced executables, i dont have to type command every time nor remember it every time i open the file. i dont think this feature is overlapped with map, it's a good complement.

i wrote a simple implementation that only works on nvim.

skywind3000 commented 2 years ago

AsyncRun supports shebang, if you have the command starting with #! like:

#! python

in your source header, You can try this:

:AsyncRun -program=shebang  abc.py

the command will be interpreted as

python abc.py
skywind3000 commented 2 years ago

But not all source contain a shebang, so you may take a look at:

https://github.com/skywind3000/asynctasks.vim

haolian9 commented 2 years ago

thanks for the reply! good to know the shebang support; seems i should try asynctasks further (i just looked it's doc before ask).

so i am closing this.