Wednesday, May 9, 2012

Re: set from environment variable

On Wed, 9 May 2012, Paul wrote:

> In vimrc, I want to set the path from an environment variable, eg.:
>
> set path = '.,' . $SOMEVAR . '/**'
>
> So if $SOMEVAR was /foo/bar, I want vim's path to be '.,/foo/bar/**'.

You're using :let syntax (which takes a VimL expression) for a :set
(which is a command (so, no VimL, no spaces between 'path', '=', etc.)).

Either of the following should work:

set path=.,$SOMEVAR/**

or

let &path = '.,' . $SOMEVAR . '/**'


In both cases, you might want to make it buffer-local (e.g. if $SOMEVAR
is filetype-specific):

setl path= "...
or
let &l:path = " ...

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: