Tuesday, July 31, 2012

Re: vim: how to press after execution of external cmd

On 7/31/2012 8:17 PM, Ben Schmidt wrote:
> On 1/08/12 7:38 AM, ping wrote:
>> hi experts:
>> I now everything after
>> :!ext-prog
>> will be treated as param of that ext-prog. so I can't
>> :!ext-prog param1 param2 <enter>
>> but then how to avoid keep typing <enter> in following cases?
>>
>> command! AsciidocA call s:Asciidoc2All()
>>
>> function! s:Asciidoc2All()
>> w|!asciidoc -a toc -a toclevels=6 -o /mnt/public_html/temp/%:t:r.html "%"
>> w|!asciidoc -b odt -o ~/Dropbox/temp-transfer/%:t:r.fodt "%"
>> w|!asciidoc -b odp -o ~/Dropbox/temp-transfer/%:t:r.fodp "%"
>> w|!a2x -f pdf --verbose --no-xmllint "%"
>> endfunction
>>
>>
>> I tried following doesn't work:
>>
>> command! AsciidocA call s:Asciidoc2All()
>>
>> function! s:Asciidoc2All()
>> w|!asciidoc -a toc -a toclevels=6 -o /mnt/public_html/temp/%:t:r.html "%"
>> <enter>
>> w|!asciidoc -b odt -o ~/Dropbox/temp-transfer/%:t:r.fodt "%"
>> <enter>
>> w|!asciidoc -b odp -o ~/Dropbox/temp-transfer/%:t:r.fodp "%"
>> <enter>
>> w|!a2x -f pdf --verbose --no-xmllint "%"
>> endfunction
>>
>
> :help :silent
>
> ?
>
> Ben.
>
>
>
thanks, but...
I tried following, still I need to press 4 enter...

function! s:Asciidoc2All()
let a:destdir = "/Dropbox/temp-transfer/"
let a:filebasename = "%:t:r"
let tohtml = "silent w|!asciidoc -a toc -a toclevels=6 -o" .
a:destdir . "/" . a:filebasename . ".html \"%\""
let tofodt = "silent w|!asciidoc -b odt -o" .
a:destdir . "/" . a:filebasename . ".fodt \"%\""
let tofodp = "silent w|!asciidoc -b odp -o" .
a:destdir . "/" . a:filebasename . ".fodp \"%\""
let topdf = "silent w|!a2x -f pdf --verbose --no-xmllint -D" .
a:destdir . "/" . " \"%\""
execute tohtml
execute tofodt
execute tofodp
execute topdf
endfunction

--
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: