asyncrun.vim icon indicating copy to clipboard operation
asyncrun.vim copied to clipboard

how to execute a command in a combined path

Open zombo opened this issue 6 years ago • 3 comments

the LLVM_HOME is an PATH, the run-clang-tidy.py is in $LLVM_HOME/share/clang.

So, if i run the following command, it can't find the file. AsyncRun python $LLVM_HOME/share/clang/run-clang-tidy.py -checks="*" %

however, the following command works. AsyncRun python d:/llvm/share/clang/run-clang-tidy.py -checks="*" %

how to use the env params in command

zombo avatar Aug 24 '19 01:08 zombo

Put them in a external shell script file and run the script by:

AsyncRun ~/.vim/scripts/my script.sh

skywind3000 avatar Aug 25 '19 06:08 skywind3000

Put them in a external shell script file and run the script by:

AsyncRun ~/.vim/scripts/my script.sh

Thanks.

However, it's only worthy for the frequent tasks.

zombo avatar Aug 27 '19 13:08 zombo

Put them in a external shell script file and run the script by: AsyncRun ~/.vim/scripts/my script.sh

Thanks.

However, it's only worthy for the frequent tasks.

Shell environment variables are nothing special as they are just plain strings. Thus, you could write a vim function to execute echo shell command and capture the output as the return value. For example, you could write a function like this:

function! GetEnvVar(varname)
    let varval = ''
    " do something to get the value.
    return varval
endfunction

And in Ex mode, when you need to use the value of the variable, just press <c-r>=call GetEnvVar(XXX)<cr>, the string value of the variable would be expanded.

chengzeyi avatar Sep 25 '19 15:09 chengzeyi