gladman
gladman

Reputation: 1266

please help to make it work of vimscript

why I can't set path success.

let s:WORKDIR = getcwd()
set path += ".," . s:WORKDIR . "/**"

echo &path

and the echo result is, my current directory is "/home/myname/example", my expected result is ".,/home/myname/example/**", but what i get is,

.,/usr/include,,

it seems this didn't work in my .vimrc script; please help, thanks.

Upvotes: 0

Views: 49

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172510

Your syntax of the :set command is wrong; you should be getting errors, too. The += must not be surrounded by whitespace, and you cannot use an expression on the right-hand side. Better use the :let command; it can also modify Vim options (&optionname), not just variables:

let &path .= ",.," . s:WORKDIR . "/**"

Upvotes: 3

Related Questions