I am trying to do something pretty simple in my vimrc style. As you can see below I am trying to concat two environmental variables into a local variable and then use that variable.
let cs=$menv_dotfiles_dir."/vimrc_style/".${CODING_STYLE}.".vim"
if filereadable(cs)
source cs
endif
Of course the above doesn't work but I think it expresses what I need to do. What is the correct way to do this?
Similar to this: Vim: sourcing based on a string But I need to do it only if the file exists.
You were very close the {}
brackets do not work like they do in bash. You have to use exec
if you want source from a string variable.
This works:
let cs=$menv_dotfiles_dir."/vimrc_style/".$CODING_STYLE.".vim"
if filereadable(cs)
exec 'source ' . cs
endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With