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...
Well, I see that Christian has already supplied you with what appears to
be a more complete solution, so this may not be necessary, but here's a
more simplistic mapping, which reflects my best guess as to what you
were trying to do. It works for both 'wrap' and 'nowrap'. What it does
is shrink the current window so that anything to the right of the cursor
is no longer visible. It does so without altering what is in the first
visible column.
<<<All on one line...>>>
nnoremap <silent> <F9> :if !&wrap\|let rvc = virtcol('.')\|let rc =
col('.')\|exe "norm! g0"\|let lvc = virtcol('.')\|exe "vert resize " .
(rvc - lvc + 1)\|call cursor(0, rc)\|exe "norm! ze"\|else \|exe "vert
resize " . col('.')\|endif<CR>
Brett Stahlman
>
> Thanks!
>
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---