On 2012-03-11, powertomato wrote:
> Hi,
> 
> I'm using vim in a script to generate syntax highlighted HTML files
> for source code. A very simple one to reproduce my error is:
> 
>     #!/bin/bash
>     if [ $# -ne 2 ];then
>         echo 'Usage:'
>         echo "    $0 /path/to/src /path/to/file.html"
>     else
>         vim -n $1 -cTOhtml -c"w! $2" -cq! -cq! &>/dev/null
>     fi
> 
> and for the sake of completenes here is the .vimrc of the user running it:
> 
>     let html_use_css=1
>     let html_number_lines=1
>     let html_no_pre=1
>     syntax on
> 
> What I'm doing is:
>  * open a file (vim -n $1)
>  * generate syntax-highlighted HTML (-cTOhtml)
>  * save it somewhere (-c"w! $2")
>  * and quit both windows (-cq! -cq!)
> 
> While this works well I'm not quite happy with it. After adding
> "&>/dev/null" (I also tried using @vim [...]) to suppress the output
> the script takes ~3 seconds per file, idling most of the time. I
> think this is because of the ncurses library which isn't satisfied
> with /dev/null not beeing a terminal.
> Is there a way to get around this (e.g. running vim quietly just
> processing through some commands or using some settings to ignore the
> case of /dev/null not beeing a terminal)?

Use the -E and -s options, e.g.,

    vim -E -s -n $1 -cTOhtml -c"w! $2" -cq! -cq!

See

    :help -E
    :help -s

Regards,
Gary

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

Reply via email to