On Friday, October 5, 2012 3:51:49 AM UTC-5, Andy Wokula wrote: > Am 05.10.2012 10:26, schrieb Brandon Coleman: > > > On Thursday, October 4, 2012 8:35:40 PM UTC-5, Ben Fritz wrote: > > >> On Thursday, October 4, 2012 7:06:22 PM UTC-5, Brandon Coleman wrote: > > >>> I had the idea of creating a command that would "link" two windows > > >>> together so that whatever buffer is loaded in window 1 would be in > > >>> the window 5 on tab 2. The problem with this idea is that there is > > >>> not a unique ID for each window, So I came up with the proof of > > >>> concept unique number patch below. > > >>> But first a few question: > > >>> Is this something that is implemented and I just missed the code? > > >>> Is this the correct way to implement a unique window ID? > > >>> Would the VIM community be open to accepting a patch if I brought > > >>> this code up to standards? > > >> > > >> Can you tell us why you think you need unique window IDs? This seems > > >> like something that could be done with a mixture of buffer-local, > > >> window-local, and/or tab-local variables or options. > > > > > > 1. bufnr() is unique, but winnr() and tabpagenr() are not.. I feel > > > that this is confusing and unexpected from the point of view of > > > someone creating a vim script. > > > > > > 2. The real problem for me is that find_win_by_winnr(4,null) returns > > > the fourth window in the current page. I can't find and work with a > > > specific window. > > > > > >> At the very least, you should certainly not REPLACE the existing > > >> window number. The window number is set in a predictable way and can > > >> be used to switch to specific windows with <C-W><C-W>. Making the > > >> window number unique and static would make this impossible without > > >> first calling a function to figure out what the window number is. > > > > > > This patch should create the function uwinnr(), leaving winnr() alone. > > > > As Ben said ... > > You can "tag" a window by creating a window-local variable and you can > > "tag" a tab page by creating a tab-page-local variable. Both combined > > result in "unique" window ID. > > > > To find the window with this ID again, you have to go through all > > windows in all tab pages (is this what you are worried about?) -- but > > this is only the worst case, when the layout has changed. Of course you > > will check the last remembered tabpagenr+winnr first, then all windows > > in the last remembered tab page, and after that all windows in all tab > > pages. It's something that a vimscript can do. > > > > -- > > Andy > > > > I'd like to know why everybody wants to further bloat Vim's core.
It seems like there should be a standard way of finding a window/buffer/tabpage without every script creating a new way of looping through windows. Having said that, I can understand the need to keep bloat out of the project. I will loop through windows. Brandon -- 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
