blueyed / vim-diminactive

Vim plugin to dim inactive windows
339 stars 10 forks source link

Use :set syntax=OFF #6

Closed chrisfarms closed 10 years ago

chrisfarms commented 10 years ago

Less of an issue, and more of a recommendation.

I've found that keeping syntax highlighting enabled only for the active buffer adds greatly to the effect.

Just need to add set syntax=ON and set syntax=OFF to the :Enter and :Leave funcs.

blueyed commented 10 years ago

Nice idea!

  1. It is a bit problematic with just :sp though, or when the same buffer is visible several times in general: syntax is local to the buffer, and not the window.. this would need some extra handling.
  2. It should not re-activate / override syntax, if the user has set it manually (e.g. to disable it for large files). (might be done)

FWIW: I have also tried using :syntax clear and :syntax on, but this appears to cause more flickering and even interfered with vim-airline somehow.

I have create a new branch use-syntax. You are welcome to test it.

There's an option to toggle this (would be off by default probably), and a another new setting (g:diminactive_use_colorcolumn), which allows to use the syntax method only.

blueyed commented 10 years ago

I should have addressed all the issues mentioned above. Turned out to be a bit more complex.. ;)

Feedback is welcome! I will probably merge it into master in the next days.

chrisfarms commented 10 years ago

Yeah it was a tad more complex indeed ... WinEnter seems to be a fickle event with some strange side effects ... I clearly don't fully understand the full implications of hooking it as my day of random window movements and shifting buffers has shown!

I settled for keeping it simple after the craziness got too much :)

fun! FocusBuffer()
        silent! set syntax=ON
endfun
fun! DimBuffer()
        silent! set syntax=OFF
endfun
augroup DimInactive
        au!
        au BufEnter * call FocusBuffer()
        au BufLeave * call DimBuffer()
augroup END

I've installed your branch ... so will give it a day of abuse tomorrow.

blueyed commented 10 years ago

I've just pushed a new commit, with major improvements/fixes. Make sure to pull any updates.