-
-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change the highlight of the cursorline inside the preview window? #1179
Comments
I believe this is determined by your bat theme: sharkdp/bat#1457 I'm seeing the same issue while using the |
Skamsie, have you got to the bottom of highlighted line inverted colors issue? I have been messing with this for a couple of evenings now and can't figure what is going on. This is driving me insane. Struggling with color mash of matched lines, especially the long ones. I don't think this has anything to do with the Bat theme. At least highlighted line is colored fine when running FZF as a standalone tool with the same Bat theme. The issue only occurs when using FZF.vim plugin within Vim: E.g. highlighted line in preview window in standalone fzf: The same highlighted line in fzf vim: |
@iamvoidcoder Nope, just got used to it after a while... I uninstalled |
As @jsit pointed out, the highlighting is done by bat itself with its export BAT_THEME="ansi-dark"
bat README.md --highlight-line 1 You might want to test with different themes ( @iamvoidcoder Try running the |
I realise it could be Bat itself. Yet I spent quite a bit of time trying to debug this issue through both Bat & Syntect code and didn't get anywhere. If FZF is run as an external standalone tool in either normal terminal (MacOS standard Terminal or iTerm2) or Neovim built in terminal then Bat line highlight in FZF preview is fine. Line highlight is correct as per current Bat color theme. However FZF.vim plugin preview will show inverted colors for the highlighted line. This is only to do with the highlighted line, other lines in preview are colored as they should and look identical to standalone FZF preview. Bat theme doesn't change anything, I tried them all. It is the same result with all Bat themes. It appears with FZF.vim the highlighted line colors are as follows:
Here are three screens for running FZF in external terminal, nvim internal terminal and nvim as a plugin: FZF standalone, external terminal, export BAT_THEME="default" FZF standalone, nvim :terminal, export BAT_THEME="default" FZF.vim plugin, let $BAT_THEME='default' |
Do you have the latest version of fzf.vim? |
I'm pulling it via vim-plug. PlugUpdate saying fzf.vim is up to date. Also checked the repo just in case, appears to be top of the tree #caf7754:
fzf is also latest:
Bat also latest:
Neovim:
I have just tried on Ubuntu box, just in case. Same issue exactly. Are you saying the highlighted line works ok in fzf.vim preview for you? No inverted foreground->background rainbow colors? |
Interesting, I have just discovered the issue is only present if I overwrite FZF_PREVIEW_COMMAND environment variable in my init.vim.
If I comment this line out the highlighted line colors are back to normal. Which is rather strange because same exactly preview settings with standalone fzf tool work fine. E.g. this shows highlighted line just fine:
Any ideas please? |
If you use that variable, the preview scipt does the highlighting, so you get the different result. let $FZF_PREVIEW_COMMAND = "non-bat-program --with-its-own-options {}"
" We can't just append --highlight-line at the end of the command even if it starts with "bat"
let $FZF_PREVIEW_COMMAND = "bat {} 2> /dev/null || alternative-bat {}" Because of the limitation, the variable is undocumented on purpose. Where did you find it? |
Honestly I don't quite remember where I got it from. I was googling around for a way to overwrite default fzf.vim bat command for a totally different reason when I came across it. The issue is that Bat is not using full 24-bit color when run in context on nvim fzf.vim (MacOS, iTerm2). The colors appear quite a bit off. I attempted to dig this a bit further and I think the issue is that $COLORTERM=truecolor variable is getting lost somehow by the time nvim->fzf->bat gets invoked. So the only solution I found to have 24-bit color in fzf.vim bat preview was:
|
Have you tried setting |
I don't need to add
Yet it looks like somehow by the time Bat gets called $COLORTERM gets lost. I can't explain what is going on but it is evident that adding let $FZF_PREVIEW_COMMAND="COLORTERM=truecolor bat --style=numbers --color=always {}" Removing A mystery. |
Hi @iamvoidcoder, it's rather unrelated to the issue, but can I ask what colorscheme/theme are you using for vim in this comment: #1179 (comment) ? I really love it 😄 |
man fzf
)Is there any way of configuring the highlight of the cursorline inside the
Rg
orAg
preview? I have read this issue and installedbat
and setBAT_THEME
toexport BAT_THEME="ansi-dark"
which should use the default terminal colors. The colors are ok, the problem is the color of the selected text is the same with the text color. Is there a way to change it? or at least set it to underline?The text was updated successfully, but these errors were encountered: