Wednesday, October 1, 2014

Re: double the columns in vim on vertical split

On Tuesday, September 30, 2014 10:39:06 PM UTC-5, kamaraju kusumanchi wrote:
> I use set columns=80 in ~/.gvimrc . This works great when I open a single file in gvim. However, if I do a vertical split to open another file, I want the new gvim window size to be 160 columns so that each file has 80 columns dedicated for it.
>
> Currently, the size of gvim windows stays the same even after vertical split which allocates 40 columns to each file. Since this is too small, I will then have to manually maximize the window.
>
> Any suggestions on how to automatically double the number of columns after a :vs?
>
>

Maybe something like this?

autocmd WinEnter * if winwidth(0) < 80 | set columns+=80 | wincmd = | endif

This will, any time you enter a new window, check the width being too small, resize the Vim window, and then resize all the windows inside Vim to equal size.

If you only want it to fire at window creation, then use another autocmd to set a "w:created" variable, which you can check in this autocmd. See http://vim.wikia.com/wiki/Detect_window_creation_with_WinEnter for more detail on that method.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: