Ответ на сообщение «Re: passing variable to external command», присланное в 05:23:15 13 октября 2010, Среда. Отправитель: Javier Rojas:
You forgot about escaping again. Should be:
map <C-F2> <ESC>:let name=input("name: ")\|execute "!gcc -o
".shellescape(name)."
".shellescape(expand("%"))\|unlet name<CR>
Текст сообщения:
> On Tue, Oct 12, 2010 at 10:33:14AM -0700, lirenlin wrote:
> > hello everyone,
> > i want to pass some user input variable to some external command, for
> > example,
> > map <C-F2> <ESC>:let name=input("name: ")\| !gcc -o name % <CR>
>
> see the help for the :execute command. You have to create a string with
> the command you want, and then pass it to :exe
>
> what you want should be doable with the following (untested):
>
> map <C-F2> <ESC>:let name=input("name: ")\| execute "!gcc -o " . name . ' '
> . expand('%') <CR>
signature.asc
Description: This is a digitally signed message part.
