I have the following vimscript:

let g:base_path="~/.config/nvim/"
let g:plugins_path=base_path."plugins/"
let g:repos_path=plugins_path."repos/github.com/"

set runtimepath+=g:repos_path."Shougo/dein.vim"

But it's doing something weird, instead of seeing a path at the end, I'm seeing this:


It's adding this to the end:


instead of


Why is vim not adding the path to the end correctly and also why is this happening?

EDIT: The only way to get this to work is to use the fullpath without any quotes like this:

set runtimepath+=~/.config/nvim/plugins/repos/github.com/Shougo/dein.vim

1 Answer 1


After reading this:

let &backupdir=s:vimetc.'backups/'

I realised what I needed to do was this:

let &runtimepath=&runtimepath.','.g:repos_path."Shougo/dein.vim"

I have to say, vim script can be a bit inconsistent, using bare strings works fine but without it you need to some some weird stuff to get it to work if you want to use variables.

  • There is no inconsistency, setting an option and letting a variable are very different things. vim offers an interface to options as variables, by prepending &. let &runtimepath.=','.g:repos_path.'Shougo/dein.vim' would also have worked.
    – Mass
    Commented Mar 26, 2018 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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