0

I need to create a variable with a fool folder direct which need to concatenate from a environment variable and the end notes

function! MyFoo(arg)
    let repo=$Project + "/cfora"                #Q1      
    let build=$project + "/build/cfora/debug"   
    exec "!cd build"                            
    exec "!cmake repo"                          #02
endfunction

Question:

Q1: How can I concatenate the value of the environment variable $Project with the end node string /cfora into one string and assign it to a new variable repo?

Q2: How can I refer the variable in the string not print the variable name? For example here, I want to ultimately run cmake /root/to/the/project/repo, not cmake repo

3

In vim dot is a concatenation operator:

let repo = $Project . '/cfora'

To "refer" variable in the string, well, in your case it is just a concatenation again:

exe '!cmake ' . repo

PS

I would suggest to use built in make facilities for this.

And vim lcd instead of exe '!cd ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.