blueyed / vim-diminactive

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

Vim: terminal window does not dim off #45

Open WeibingChen17 opened 5 years ago

WeibingChen17 commented 5 years ago

In Vim 8.1, a build-in term is support with the command :term. However, term windows does not dim off. Please look into it if you are available. Thanks for your efforts.

blueyed commented 5 years ago

It looks like ColorColumn is not used with terminal windows, but only checked quickly.

I am using Neovim myself mostly, which offers proper highlighting (not requiring the hack of using ColorColumn), and I am using the following myself:

    if 1 && exists('+winhighlight')
      function! s:configure_winhighlight()
        let ft = &filetype
        let bt = &buftype
        " Check white/blacklist.
        if &diff || (index(['dirvish'], ft) == -1
              \ && (index(['nofile', 'nowrite', 'acwrite', 'quickfix', 'help'], bt) != -1
              \     || index(['startify'], ft) != -1))
          set winhighlight=NormalNC:MyNormalWin
        else
          set winhighlight=NormalNC:MyInactiveWin
        endif
      endfunction
      augroup inactive_win
        au!
        au ColorScheme * hi link MyInactiveWin ColorColumn
        au FileType,BufWinEnter * call s:configure_winhighlight()
        if exists('##OptionSet')
          " TODO: does not work with :Gdiff - diffsplit does not trigger it, too!
          au OptionSet diff call s:configure_winhighlight()
        endif
      augroup END
    else
      Plug 'blueyed/vim-diminactive'
      let g:diminactive_enable_focus = 1
      " let g:diminactive_debug = 1
    endif
chipsenkbeil commented 4 years ago

@blueyed, given how well your snippet above works, would it make sense to incorporate that into the plugin itself for special handling in neovim? I found this issue seeking the same solution and am using neovim. For now, I've got your snippet in place of my Plug line for the plugin.

nkgm commented 4 years ago

+1 and thanks for your work.

Only just discovered this after several months of "crippled" Vim highlighting even though I am a Neovim user myself. This should be the default behavior when Neovim is detected, or if there's other considerations, at least documented properly. Right now the README reads:

It will only work with lines containing text (i.e. not ~ (non-lines)).

which shouldn't be an issue for Neovim users.