I would like to use fzf in Kakoune with bat to have color and line numbers in preview files. I installed also ‘bat’ and the name to call it is ‘batcat’, so I did an alias to use ‘bat’.
I set Kakoune with :
plug "andreyorst/fzf.kak" config %{
} defer fzf-file %{
set-option global fzf_highlight_command 'Bat' # I tried also with 'batcat' and 'bat'.
}
But I have always no color and line numbers (this is working in terminal with commands or fzf settings)
bat somefile will add colors but bat somefile | cat will not because the output is not a terminal.
That’s the conventional behavior. You probably want bat --color=always
Hi, do you get colors when using fzf_file_command as opposed to fzf_grep_command? I had to set fzf_grep_preview_command (I think it’s undocumented) to get colors in previews when grepping for text. My configuration:
plug "andreyorst/fzf.kak" config %{
map global user f ": fzf-mode<ret>" -docstring "fzf"
} defer fzf-file %{
set-option global fzf_file_command 'rg'
set-option global fzf_highlight_command 'bat'
} defer fzf-grep %{
set-option global fzf_grep_command 'rg'
set-option global fzf_grep_preview_command 'bat'
}
I tried again and finally it is working well also on my side to have the color.
There is also the highlight line to show where the grep has found the string.
The plugin is plugin archive but it seems to work well and is stable enough to be used.
I would like to keep it simple by not using a plugin.
But, I can not make it working from a simple shell script with fzf-tmux or using Peneira plugin :