On 01/04/09 12:01, [email protected] wrote:
>
> Hi,
>
> since on my laptop there is limited size, I use :vsp together with a
> BufEnter function which does vertical resize the current window. So
> each time I place the cursor in the right or left window, it is
> resized to the wanted (larger) width.
>
> However, vertical resize does not work, when the same file is loaded
> in both windows. (It works though, when executed in the command line
> manually and not by the BufEnter function.)

Maybe you don't need an autocommand?

If you set the 'winheight' option, Vim will attempt to make the current 
window no smaller than that value if possible whenever you enter the window.

Notes:
- 'winheight' is not a hard minimum: it maybe larger than the Vim screen 
size. It applies only to the current window
- 'winminheight' is the hard minimum for all windows, it ought to be no 
bigger than the quotient of the Vim screen height by the number of 
split-wndows vertically above each other. Its default value is 1 but it 
is permissible to set it to zero.
- They are both global options. There is a different setting, 
'helpheight', for the soft-minimum-height of a help window.
- To make the current window as high as possible and reduce all others 
to just a status line and nothing else (a behaviour which, for reasons 
which seem obvious to me, I call "Rolodex Vim") use

        :set noequalalways winminheight=0
        :set winheight=99999 helpheight=99999

- Drawback: With Rolodex Vim, ":all" and "vim -o" won't crate more than 
two windows. To avoid that, set these options after all startup windows 
are opened, by means of a VimEnter autocommand. This is what I use in my 
vimrc (as usual, check the help for anything you don't know in this 
snippet):

if has("windows")
     if has("autocmd")
       augroup rolodex
         au VimEnter * set noea wmh=0 wh=99999 hh=99999
       augroup vimrclocal
     else
         set noea wmh=0 wh=99999 hh=99999
     endif
endif

("vimrclocal" is the autocommand group used by all other autocommands 
set before and after that by my vimrc. Other scripts use other group 
names, e.g. the vimrc_example.vim uses vimrcEx, the filetype detection 
mechanism uses filetypedetect, and my homebrew colorscheme uses its 
colorscheme name.)


Best regards,
Tony.
-- 
Q:  How many heterosexual males does it take to screw in a light bulb
     in San Francisco?
A:  Both of them.

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

Reply via email to