Open jtmkrueger opened 10 years ago
They should get dimmed - but only up to 256 chars by default.
Is that what you're seeing?
Try increasing g:diminactive_max_cols
. You can use :DimInactiveRefresh
to refresh/apply it.
Otherwise please provide a screenshot.
I have let g:diminactive_max_cols = 1000
in my .vimrc
, and performed a :DimInactiveRefresh
in vim, and tried reloading vim as well. here's what I'm getting.
So somethings still not right.
I'm wondering if this hack isn't doing what it's supposed to.
From :h 'cc'
:
A maximum of 256 columns are highlighted.
That's why I had the 256 there initially.
blueyed: You would be more than welcome to try to incorporate the following script I've written which will help combat (but not entirely fix) this issue:
if exists('+colorcolumn')
function! InactivateWindow(inactivate)
if a:inactivate == 1
" using 0 as the third parameter lets me still see Search'd patterns in inactive windows.
let w:inactiveWindowMatchId = matchadd("inactiveWindow", "\\%>0v", 0, 9999)
else
if exists("w:inactiveWindowMatchId")
call matchdelete(w:inactiveWindowMatchId)
endif
endif
endfunction
augroup DimInactiveWindows
au!
" For some as-yet-unknown reason, my usage of the diminactive plugin by blueyed makes it
" impossible for me to see search-highlighted text in inactive windows. (Maybe my
" colorscheme setup is at fault...) This keeps my Search pattern visible (but only
" changes the background of areas WITH text...). As an added advantage, it highlights
" text beyond the 256 char mark.
au WinLeave * call InactivateWindow(1)
au WinEnter * call InactivateWindow(0)
augroup END
endif
My inactive window is on the left. Notice that I have highlighed the string "123". After the 256th character, you can see that the dark background continues for the left-hand window. (That's also, incidentally, where I can resume seeing highlighted text from my search pattern... I haven't investigated why, yet, so it may not necessarily be a bug - it's probably just a problem with my colorscheme...?)
Yes, it's likely a issue with your colorscheme.
What are you using for inactiveWindow
's highlighting?
Do you see the same issue when using :hi link inactiveWindow ColorColumn
(in your approach)?
The idea is interesting, but it's unfortunate that it won't highlight shorter lines completely.
I'm not sure what you mean by "it won't highlight shorter lines completely"...
As for my inactiveWindow's highlighting, it was set to the same thing as ColorColumn. Linking them didn't fix my Searching issue, but I figured it out anyways: I changed this: hi Search gui=bold guibg=#ffff88
to this: hi Search gui=bold,reverse guifg=#ffff88 guibg=Black
in my colorscheme file.
For whatever reason, it appears that the ColorColumn seems to "take over" the guibg color of Search. Since I'm not sure how to give the Search highlight a higher priority than ColorColumn, I guess I can trick it into keeping a background color for the Searched text by setting the guifg and reversing it. But it looses the foreground color, now. Oh well. That's much less important to me.
Now, when I add your plugin and my script together, ALL of the text in the line is now given the ColorColumn highlight (background highlighting doesn't stop after the 256th character) and I can still see Search'd text in both windows. (Unfortunately, as I mentioned before, it still stops highlighting after the final character of the line. But at least, it's a step in the direction of @jtmkrueger's request.)
Here's a "before" screenshot (with only the vim-diminactive plugin) (I'm using ColorColumn for both your plugin and my script, now and I reset ColorColumn to the default color (by commenting out all references to it in my colorscheme file) so I can see the effect better in the screenshots.):
And here's an "after" screenshot (with both the vim-diminactive plugin and my script):
For the sake of clarity, here's the final working version of my script, in case if you wish to incorporate it into your plugin somehow:
if exists('+colorcolumn')
function! InactivateWindow(inactivate)
if a:inactivate == 1
" using 0 as the third parameter lets me still see Search'd patterns in inactive windows.
let w:inactiveWindowMatchId = matchadd("ColorColumn", "\\%>0v", 0, 9999)
else
if exists("w:inactiveWindowMatchId")
call matchdelete(w:inactiveWindowMatchId)
endif
endif
endfunction
augroup DimInactiveWindows
au!
"This highlights text beyond the 256 char mark, but it only changes the background of areas WITH text...
au WinLeave * call InactivateWindow(1)
au WinEnter * call InactivateWindow(0)
augroup END
endif
I'm not sure what you mean by "it won't highlight shorter lines completely"...
It only highlights the visible characters, not up to the end of the line in Vim.
Now, when I add your plugin and my script together, ALL of the text in the line is now given the ColorColumn highlight
Ah, you mean to use this additionally - makes sense.
Thanks for your suggestion, and the detailed explanation with screenshots!
Do you feel like creating a PR for this? Otherwise I'll look into this later myself.
I'm pretty new to github, so although I'd love to attempt a PR, I'm not sure I have the time to figure out how that all works, right now.
Plus, your plugin has come a long way from the simple version I found on stackoverflow! :) That's great, but that also means that it has more complexity than I have time to learn at the moment. I think I'll need to leave this one up to you or someone else.
Thanks for the great plugin, though! :)
@blueyed has this been incorporated in the latest release? I am still seeing an issue with my search highlight where the inactive window search disappears.
@gmhawash No, not any updates recently. PRs are welcome, but I'd rather spent the time on adding this to Neovim/Vim proper.
Not a blocker, but it would be really nice if wrapped lines also dimmed.