On Mon, October 5, 2009 11:45 pm, Paul wrote:
>
> On Mon, 5 Oct 2009, Brett Stahlman wrote:
>
>> nnoremap <F8> :exe "resize " . (line('.') - line('w0') + 1)<CR>\|zb
>
> Yes, you have the idea. That works for horizontal split. Now, how about
for vertical split? I don't see a column() function...

Try this:

nnoremap <F9> :exe "vert resize " . virtcol('.') | normal 0

I have been thinking about this exercise yesterday a bit. But I came to
the conclusion, there are too many possibilities. E.g. this mapping works,
when your in the left side of the window, but when you are on the right
side, you probably want something like :exe ":vert resize " . winwidth(0)
- virtcol('.') | norm $

The same is probably true for the horizontally resize. The shown command
works well, when you are in the upper window, in the lower window you
probably want something like this:
nnoremap <F8> :exe "resize " . (line('w$') - line('.') + 1)<CR>\|zt


And then there are some settings that might interfer with the function,
like 'sidescrolloff', 'scrolloff', 'sidescroll', 'wrap'. And then what
would you want with a more complex window layout? Therefore I give only
some hints, how to do what you want and no possible complex function, that
would take care of all of these cases.

regards,
Christian


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

Reply via email to