Friday, October 26, 2012

Re: Tmux-style window resizing in vim?

On Friday, October 26, 2012 11:05:30 AM UTC-5, Jimmy Wu wrote:
> On Fri, Oct 26, 2012 at 11:50 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
>
> > What if you have 3 windows? Which separator should be acted on then?
>
> With 3 pane splits in tmux version 1.6, it appears the behavior is to
> always move the bottom/right separator of the currently active pane,
> except for the bottom/right-most pane which uses the top/left
> separator.
>
> (Note: tmux pane ~ vim window; tmux window ~ vim tab page)

So perhaps something like the following (untested) will do what you want:

func! MyResize()
let curwindow = winnr()

" if bottommost window, resize window just above, otherwise current window
wincmd j
if winnr() == curwindow
wincmd k
else
wincmd p
endif
resize +1

" restore current window
exec curwindow.'wincmd w'
endfun
nnoremap <A-j> :call MyResize()<CR>

You'd need to do a new function for each resize direction of course.

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

No comments: