Thursday, January 4, 2018

Re: buttype == quickfix plus WinEnter

On Thu, Jan 4, 2018 at 12:00 PM, Axel Bender <wiereneuer@gmail.com> wrote:
> I would like to set the (unfortunately global) scrolloff option dynamically.
> To accomplish that, I use the following construct (simplified):
>
> autocmd BufEnter * call SetScrollOff()
>
> function SetScrollOff()
> let &scrolloff = &buftype == "quickfix" ? 3 : 5
> endfunc
>
> This approach works fine for non-quickfix windows.
> However, when entering the quickfix window *for the first time* with e.g. :qf, scrolloff is not getting set.
> When entering the quickfix window the next time, the approach works as intended.
>
> Do I use the wrong
> a) event,
> b) comparison?
>

Try (untested)

au BufEnter,BufNew * if &buftype == 'quickfix' | set
so=3 | else | set so=5 | endif

(all on one line of course)

Best regards,
Tony.

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