You have to excuse me if this is a silly question. But as you might have guessed I'm new to vim.
I've defined a variable s:nfile and want to use it in the following expression.
!stylus < '%:p' > s:nfile
This doesn't work and really runs !stylus < whatever_is_the_current_file > s:nfile.
I've tried everything from echo s:nfile to let s:nfile within the expression.
Thanks in advance,
Jonas Geiregat.
> !stylus < '%:p' > s:nfile
>
> This doesn't work and really runs !stylus < whatever_is_the_current_file >
> s:nfile.
>
> I've tried everything from echo s:nfile to let s:nfile within the
> expression.
You should use :execute in such cases:
execute '!stylus < '.shellescape(expand('%:p'), 1).
\' > '.shellescape(s:nfile, 1)
Note that using «'%:p'» is not sufficient to escape filename: try it when
filename contents odd number of a single quotes.
Original message:
This is becoming a faq and there is also an entry� on the faq, that
covers this question:
http://vimhelp.appspot.com/vim_faq.txt.html#faq-25.14
�)Well, the question only barely mentions your specific problem, but the
general problem on how to evaluate a vim variable with an :ex command is
still covered. Anybody wants to improve the text?
regards,
Christian