1

I am just getting into vim and I'm trying to get the preview window for my Rg results to show up with nice looking colors. Currently I have most of the stuff looking nice; here is a picture of where I currently am:

enter image description here

This is in my vimrc for how I setup the Rg with quickfix window:

  command! -bang -nargs=* Rg
    \ call fzf#vim#grep('rg --smart-case --line-number --no-heading -- 
      color=always --colors "path:fg:93,169,245" --colors 
      "line:fg:128,128,128" --colors "match:fg:195,232,141" --no-hidden 
      -- ignore '.shelles    cape(<q-args>),
    \ 0,
    \ fzf#vim#with_preview({'options': '-e --delimiter : --nth 3..'}),
    \ <bang>0)

What settings could I tweak in order to get the preview window to be consistent with the normal text in the editor? Any help would be appreciated.

  • 1
    I would suggest you to use leaderf(plugin like fzf) with popup window, it looks the same as original. I haven't tried with rg, only with lines. I tend to believe it works. – eyal karni Dec 21 '19 at 14:08
  • 1
    I wonder if it’s not all the color settings you’re passing to rg? I don’t know fzf all that well, but it can be difficult to properly color text thats not going to an actual terminal (eg when its being captured into a file/by a function call) – D. Ben Knoble Dec 21 '19 at 14:28
1

If installed, fzf vim uses bat to add syntax highlighting to the preview. bat comes with several themes available. You can choose a theme by setting the BAT_THEME environment variable. For example, you can add this line to your .bashrc or .zshrc to set the TwoDark theme:

 export BAT_THEME="TwoDark"

To preview the available themes run in your shell:

bat --list-themes

You can also add your own themes in case you are not happy with the available ones (as explained here).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.