My current .vimrc includes these two lines, which are a bit redundant
let g:opamshare = "/home/hugo/.opam/system/share"
source /home/hugo/.opam/system/share/vim/syntax/ocp-indent.vim
Is there a way to use the value of the opamshare
variable in the source
command on the second line? I tried
source g:opamshare . "/vim/syntax/ocp-indent.vim"
but that gives me a E172: Only one file name allowed
error.
From vim doc:
:so[urce] {file} Read Ex commands from {file}.
You need to pass only one file
as argument to source
command.
It doesn't treat argument as string
, so you cannot use .(dot)
to concat strings.
Try this:
:exec printf('source %s/%s', g:opamshare, 'vim/syntax/ocp-indent.vim')
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