Wednesday, January 1, 2014

Re: Retaining window layout

On 01/01/14 05:01, Dejan Ranisavljevic wrote:
> I have been using vim for past 2,3 years, but there are still some issues i am not able to come over.
>
> I find it really convenient to have windows managed manually. I tried buffkill for some time,
> but it doesn't work always as expected.
>
> To be more precise, lets say i am working on something, and i have 2 splits, one for editing source file,
> and one for editing test file. Often i have to open something else so i override whichever split window with new one, and when i delete that buffer i loose windows split, this is what i didn't want, i know to close window, but why does deleting a buffer has to close a window? and i haven't found how to overcome elegantly. Anyone could suggest me a good approach?
>
> Ideally i would delete that new buffer and get a previous buffer i was working on.
>
> This weird behavior also occurs to me using Nerdtree, I open new vim instance, i toggle nerdtree open a file, i bd, i still have window from that deleted buffer, but when i open file again and bd, i loose that window. And i am left with nerdtree window only.
>


Instead of :e foobar … :bdel, use :new foobar … :x. This will open your
additional file in an additional window, retaining the two windows you
had before, and at the end :x would save your changes in that third
window and close it, leaving you with the two windows you had before.

You may or may not like my "Rolodex Vim" setting, to open the active
window to the maximum height, with status lines of other windows
(squashed to zero height) at top and bottom acting like the index tabs
of a Rolodex (vertical splits are not affected):

" set up Rolodex Vim
if has("windows")
" this one must be set before loading files
" or running a session script
" in case we want to open many windows
set wmh=0
if has("autocmd")
augroup rolodex
au VimEnter * set noea wh=99999 hh=99999 cwh=99999
augroup END
else
set noea wh=99999 hh=99999 cwh=99999
endif
endif

The :if has() wrappers are there so that snippet will run with no errors
in any Vim version, even Tiny where :if…:endif is treated as a nestable
comment.
If another autocommand group is active at that point of your vimrc, put
its name instead of END in the second :augroup command, of course.


Best regards,
Tony.
--
When someone says "I want a programming language in which I need only
say what I wish done," give him a lollipop.

--
--
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/groups/opt_out.

No comments: