Thursday, January 4, 2018

buttype == quickfix plus WinEnter

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?

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