2009/10/26 Hari Krishna Dara <[email protected]>:
>
> On Sun, Oct 25, 2009 at 7:23 PM, winterTTr <[email protected]> wrote:
>>
>> Hi ,
>> I have a question about how to modify the buffer option directly without
>> focus to that buffer or even showing that buffer.
>> OK , i explain my need via a specific case.
>>
>> For example , the window show as below
>>
>> --------------------------------
>> |              |               |
>> | win1      |    win2     |
>> | buf 1      |   buf2      |
>> |              |               |
>> |              |               |
>> --------------------------------
>>
>> the window is split into two part , as win1 and win2
>> within which show the buffer 1 ( buf1) and buffer2 ( buf2 )
>> And , now we focus at win2
>>
>> If i want to change the option ( ex, setlocal nonumber ) to the buffer1
>> with vim script. we "always" deal with this case like this :
>> 1. focus to the win1 ( :1wincmd w )
>> 2. execute the vim command ( :setlocal nonumber )
>> 3. restore the focus ( :2wincmd w )
>>
>> When there need to be an update ,
>> ( a command need to be executed or a option need to be set )
>> whenever  i press some key , the focus always need to be changed
>> during the operation, which make the screen flicker frequently .
>>
>> So , i want to know that , is it possible to set the option or execute
>> a command to a buffer without focus to the buffer or even show it
>> (ex, the buffer is hidden )
>>
>> Although I know the vim command is always targeted for the
>> "current buffer/window" , but sometimes the flickering screen
>> indeed bother me a lot.
>>
>> Is there a good way to deal with my need ?
>> And any suggestions are greatly appreciated.
>
> If you are scripting, and need to change a buffer local option, you
> could always use setbufvar() with the buffer number (e.g.,
> setbufvar(10, '&number', 0)). Regarding executing commands, I don't
> think there is a way to do that without switching the focus to that
> buffer. However:
> - the default 'lazyredraw' should avoid any flickering. If you are
> seeing flickering, then may be you don't have it set.
> - for buffers that are not currently shown, you can create a temp
> split window to show them and close the window when done. Again,
> 'lazyredraw' should avoid flickering.

Thanks you so much for your suggestion.

Although it feels a pity that we can't "send" some command to a buffer
to let them run,
setbufvar & lazyredraw indeed make great improvement to the screen performance.

>
> --
> HTH,
> Hari
>>
>> >
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to