Hi,

On Mon, Jun 6, 2016 at 10:15 PM, [email protected]
<[email protected]> wrote:
> You mean 'G' command ?
>
> I write a single script to get quickfix autoscroll, problem seems have been
> solved
> by 'normal G' with 'windo'.but the cursor seems a little strange:
> 1. blinks in a strange frequency: sometimes fast and sometimes slow
> 2. 'moving cursor to quickfix window and back' is noticeable, especially in
> gvim
> 3. sometimes cursor moves to ex-command area and stays 1 second and returns
> to the previous window
>
> version: 7.4.1902
>
> quickfix_autoscroll.vim
> --------------
> " scroll down
> function! Quickfix_Scroll()
> if getbufvar('%', '&buftype') == 'quickfix'
> normal G
> endif
> endfunc
>
> " find quickfix window and scroll to the bottom then return last window
> function! Quickfix_AutoScroll()
> let l:winnr = winnr()
> windo call Quickfix_Scroll()
> exec ''.l:winnr.'wincmd w'
> endfunc
>
> " timer callback: simulate a long-time-running job
> function! Callback(id)
> if !exists('s:index')
> let s:index = 0
> else
> let s:index = s:index + 1
> endif
> caddexpr "output ".s:index
> call Quickfix_AutoScroll()
> endfunc
>
> let s:index = 0
> let s:id = timer_start(1000, 'Callback', {'repeat':30})
>
> cexpr ""
> copen 5
> wincmd k
> --------------------
>
> Quickfix seems to be designed for the old synchronizing usage (make/grep)
>
> But after job/channel have been implemented, quickfix should be widely used
> to display realtime output of the background process .
>

You can use a normal buffer to redirect the output from the background
process instead of using quickfix. Depending on the user/use-case, it
may not be preferable to scroll the quickfix window when a new entry is
added to the quickfix list.

For example, let us say the redirected output is from grep (that takes a
long time to complete). The user is browsing through the matches while
grep is adding to the quickfix list in the background. If the quickfix
window is scrolled every time a new entry is added, then it will be
distracting the browsing work flow.

- Yegappan

>
> When background process takes a long time (eg. rebuilding vim source code),
> autoscroll
> enables me to watch the building progress and the output while I am editing
> / navigating the source files
> just like what I do in visual studio.
>
> Auto scroll can be simulated by using the script above, but is this a
> appropriate way ? (cursor problem, etc)
> Is it possible to do this in a more graceful/easier method ?
>
> ________________________________
> [email protected]
>
>
> From: Bram Moolenaar
> Date: 2016-06-07 03:38
> To: [email protected]
> CC: vim-dev
> Subject: Re: Any way to scroll quickfix window automatically for
> long-time-running jobs ?
>
> skywind wrote:
>
>> Since redirecting the job output to quickfix, I need quickfix window
>> can scroll to the last line when a new text line added to quickfix.
>>
>> So I can always see the latest output of a long time running job in
>> realtime.
>>
>> Previously I used `clast` after `caddexpr` in the job callback to
>> scroll quickfix but it alway open the last error in the new tab.
>>
>> Is there a way I can just only scroll quickfix without open the last error
>> ?
>
> You can use
> :copen
> $
> {jump back to original window}
>
> Note that recent changes were made to avoid updating the screen each
> time, because it was slow.  These commands will make it slow again.
> You could use a timer to postpone the scrolling or only update once in
> so many times.
>

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui