dehua
dehua

Reputation: 25

How to append line to inactive window buffer and scroll that window to bottom

I want to develop a vim plugin that writes some lines to inactive window(some window for async command output etc.)

I know I can use "setbufline" to write to buffer, and use redraw to draw the vim screen. but I can't find a function to scroll specific window to bottom. Is there a function like "cbottom" but works for normal window?

Upvotes: 2

Views: 176

Answers (1)

Ralf
Ralf

Reputation: 1813

Assuming you know the windowId of the window to scroll and you stored it in the variable g:scrollWinId:

let curWinId = win_getid()
call win_gotoid(g:scrollWinId)
normal! G
call win_gotoid(curWinId)

I'm not aware that there is a simple function in Vim script or a autocmd that could be used.

BTW: You might want to use appendbufline instead of setbufline.

Upvotes: 3

Related Questions