Open captbaritone opened 11 years ago
I have added some code to the bottom of DWM_Stack()
which will cycle through all the windows, putting each one at the top so that we can be sure all the windows are actually stacked even if we started win a non-standard window layout. The upshot is, that focusing a window will put us into the DWN layout no matter what the layout was before.
Here is the code I have added:
" Get the number of the current window so we can come back here
let l:curwin=winnr()
" Cycle through all the windows, putting each one at the bottom
let l:i=1
while l:i <= winnr('$')
1wincmd w
wincmd J
let l:i += 1
endwhile
" Return to the window we started in
exec l:curwin . "wincmd w"
It feels like a bit of a hack, but I don't see any better way to do it. If this is functionality you are interested in, I can generate a pull request.
Edit: Just saw that @jdonaldson has already done this on his one commit to his fork and his approach is slightly cleaner. I have updated by code accordingly.
The commit from @jdonaldson unfortunately breaks more situations than it fixes. So there's no fix to that for now...
it seems it doesn't work now,the window didn't split,and if I split it manually it's not what it should be,and C-N is conflicted with something.
@ellrywych What is not working?
@spolu maybe I shouldn't post that reply in this thread. It says "Windows are always organised as follows:
" windows are not shown like that neither I start vim nor I split windows by my own.
Should I just put dwm.vim in plugin path and it will work? Simply I don't know how to make it look like that screenshot .
@ellrywych This does not belong to that stream at all indeed.
You should split your windows with C-N if it does not work maybe it's because you already binded C-N... Normal :split are not affected by dwm.vim
Thank you @spolu @captbaritone
Hopefully, I'm just missing something here, but if I follow the following steps, I end up with three equal vertical splits rather than one focused split and the other two stacked on the right:
vim
:split
<C-Space>
:split
<C-Space>
If I then move to one of the three equal panes, and focus that pane, the correct layout is returned. It looks like it has something to do with splitting the focused pane and then focusing the new split. Similarly, if I split a non-focused pane and then focus, the correct layout is maintained.
I have tested this on MacVim, and Vim (7.3) on OSX and Ubuntu.
Edit: I've looked into this further, and it looks like this plugin makes no attempt to organize splits that are outside of it's expected layout. Would that be outside of the scope of this plugin, or a welcome improvement?