Tuesday, August 27, 2013

Re: Certain commands undock & shift window

On Sat, Aug 24, 2013 at 11:33 PM, AndyHancock wrote:
>On Saturday, August 24, 2013 8:04:48 PM UTC-4, Tony Mechelynck wrote:
>> Adding or removing a tabpage shouldn't change the size of Vim…
>> unless it also causes the tab bar to appear or disappear. Setting
>> 'showtabline' to 2 (not the default) will make the tab bar remain
>> always present, even when there is only one tab. You might then
>> customize 'tabline' (for a text-style tabline: in Console mode or
>> with go-=e) or 'guitablabel' (in GUI mode with go+=e) to display
>> more than the default. I display "a:b/c filename.ext" where a, b
>> and c are numbers, meaning "Tab #a: window b of c" and are
>> displayed in colour.
>>
>> Adding or removing a scrollbar (not only the bottom one, but also
>> the left and/or right ones) will increase the size of Vim in that
>> directokin by the width of the scrollbar. This is intentional in
>> order to keep the number of 'lines' and 'columns' constant for the
>> text. To avoid that, you may want to always display all three
>> scrollbars, menubar and toolbar:
>>
>> set go-=b go -=l go-=r go -=L go-=R go-=m go-=T go+=blrTm
>>
>> but it isn't really pretty. Or you could :set wrap and never use
>> the bottom scrollbar. The paired vertical scrollbars are useful
>> when there is a vertical split but otherwise not so much, so
>> normally I use rL (as part og gimrLtc). This, however, will
>> slightly modify the width of gvim when adding or removing a
>> vertical split (unless of course it is Maximized but that isn't
>> what you want).
>
> Tony, that was extremely helpful. I chose the simplest method and
> hard coded the following into my vimrc:
>
> set guioptions+=b guioptions-=e
>
> Actually, I use to map ctrl-H to call:
>
> func! ToggleHscroll()
> if &wrap
> set nowrap
> set guioptions+=b
> else
> set wrap
> while &guioptions =~ 'b'
> set guioptions-=b
> endwhile
> endif
> endfunction
>
> and now that has simplified to
>
> set guioptions+=b guioptions-=e
> func! ToggleHscroll()
> set wrap! wrap?
> endfunction
>
> I can create/delete tabs and toggle wrap without fear now. It takes
> up vertical space, but it's worth it. I can't believe the years it
> took me to post this.

Stupid me. There is no need for a function for one command. I can just map ctrl-H to

:set wrap! wrap?<CR>

On a different but related note, it's turning out to be harder to avoid changes to the window size than I thought (and that is the source of the undocking problem described in this thread). That is, if you like vertical scroll bars and switch around your window splitting alot. For example, for vertical split windows with scrollbars, you'd use a scrollbar on the left edge for the left window and a scrollbar on the right edge for the right window. But say you decide to move the left window to the top (ctrl-W followed by K in normal mode). Then, both windows have scrollbars along the right edge, and with no more need for a scrollbar along the left edge, poof, the overall gvim window size changes. I'm sure it's just a matter of perusing the scrollbar documentation to see what alternatives there are to a scrollbar along the left edge for a vertically split window (which I will do), but it's a pity that this has to be forgone.

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