简体   繁体   中英

How to use variable when setting makeprg in vim?

I am creating a method called SetLaunchingComponent which is used to set the makeprg with the variable passed in.This is how the script look like now.

function! SetLaunchingComponent(path) 
    set makeprg=$path
endfunction

Obviously the function isn't working as i wished. As vim resolve the path environment as the system variable but not a:path. So what should i do?

要设置一个选项,您应该使用以下语法:

let &makeprg=a:path
command! -n=1 SL call SetLanuchingComponent(<arg>)

这将使您易于使用该功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM