In each of your cases, you seem to be wanting the :set command to ignore white space, which it doesn't (nor does it handle user vars). What is the problem with using :let instead? From inside Vim script, it is almost always the best choice.
As far as I can tell, :set is there to interface with the user, and has other features which facilitate that (i.e. += or -=string, =opt?, =opt!, etc.) On 4/22/06, Suresh Govindachar <[EMAIL PROTECTED]> wrote: > > Hello > > While one can always :let &l:tw, &g:tw or &tw to a variable, > here are some observations on setting to variables and spaces. > > The following work: > > :let foo = 68 > :exec 'set tw='.foo > > but adding spaces for readability generates an error message! > > :exec 'set tw = ' . foo > > Setting to a variable without use of exec fails with or > without spaces -- none of the following work: > > :set tw=foo > :set tw = foo > > Also, > > :let boo = 'set tw = 80' followed by > :exec boo fails, > > but :let boo = 'set tw=80' followed by > :exec boo succeeds! > > > --Suresh > >