Friday, September 12, 2014

Re: ruler vs statusline

On 2014-09-12, Bee wrote:
> On Friday, September 12, 2014 2:01:25 PM UTC-7, Gary Johnson wrote:
> > I have my vimrc set up so that if the full Vim window height
> > is 25 lines or less, I use the ruler; otherwise I use the statusline.
>
> I assume that is an autocmd, will you show the command?

Here it is. Note that the VimResized autocommand sets 'laststatus'
to 2 when the window is resized larger, but does set 'laststatus' to
1 when the window is resized smaller. That's because one of my
plugins also sets 'laststatus' to 2 based on other factors and I
don't want window resizing to interfere with that. I resize default
windows larger or smaller, but I hardly ever resize a large window
to less than the default height, so that has never been a problem.
That behavior can easily be changed, though.

if &lines > 25
set laststatus=2
endif
au GUIEnter * if &lines > 25 | set laststatus=2 | endif
" When running the GUI, the number of lines
" isn't known until the GUI is opened.
if exists("##VimResized")
" 'laststatus' may have been set to 2 by ctags plugin. Don't set it back
" to 1 or set it to 2 if already 2 (or 0).
au VimResized * if &lines > 25 && &laststatus == 1 | set laststatus=2 | endif
endif
set ruler

Regards,
Gary

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

Post a Comment