vim: how to press <enter> after execution of external cmd

166 views
Skip to first unread message

ping

unread,
Jul 31, 2012, 5:38:47 PM7/31/12
to vim-use Mailingliste
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

Ben Schmidt

unread,
Jul 31, 2012, 8:17:20 PM7/31/12
to vim...@googlegroups.com
:help :silent

?

Ben.



ping

unread,
Jul 31, 2012, 10:34:58 PM7/31/12
to vim...@googlegroups.com, Ben Schmidt
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

Ben Schmidt

unread,
Jul 31, 2012, 10:52:24 PM7/31/12
to ping, vim...@googlegroups.com
> 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

:silent will only apply to :w where you have placed it. You probably
want it to apply to the shell command by putting it between the | and
the !, or to the whole lot by putting it before :execute.

Ben.



ping

unread,
Jul 31, 2012, 11:05:50 PM7/31/12
to Ben Schmidt, vim...@googlegroups.com
that works, again..
thanks!

b.t.w, just curious is there anything about vim that you don't know of? :D

Ben Schmidt

unread,
Aug 1, 2012, 2:48:23 AM8/1/12
to vim...@googlegroups.com
On 1/08/12 1:05 PM, ping wrote:
> b.t.w, just curious is there anything about vim that you don't know of? :D

Yeah, but I try not to answer those questions.

Smiles,

Ben.



Reply all
Reply to author
Forward
0 new messages