diff --git a/README.md b/README.md index a46505d..3174c67 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ so you can omit it if you use a plugin manager that doesn't support hooks. - [fzf][fzf-main] 0.23.0 or above - For syntax-highlighted preview, install [bat](https://github.com/sharkdp/bat) -- `:GF?` will use [delta](https://github.com/dandavison/delta) if available +- If [delta](https://github.com/dandavison/delta) is available, `:GF?`, + `:Commits` and `:BCommits` will use it to format `git diff` output. to format `git diff` output - `Ag` requires [The Silver Searcher (ag)][ag] - `Rg` requires [ripgrep (rg)][rg] diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index b259835..b56a2a6 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -1221,8 +1221,9 @@ function! s:commits(buffer_local, args) endif if !s:is_win && &columns > s:wide + let suffix = executable('delta') ? '| delta' : '--color=always' call extend(options.options, - \ ['--preview', 'echo {} | grep -o "[a-f0-9]\{7,\}" | head -1 | xargs git show --format=format: --color=always | head -1000']) + \ ['--preview', 'echo {} | grep -o "[a-f0-9]\{7,\}" | head -1 | xargs git show --format=format: ' . suffix]) endif return s:fzf(a:buffer_local ? 'bcommits' : 'commits', options, a:args) diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index ab1ec5f..2641683 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -1,4 +1,4 @@ -fzf-vim.txt fzf-vim Last change: December 12 2020 +fzf-vim.txt fzf-vim Last change: December 14 2020 FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc* ============================================================================== @@ -92,7 +92,8 @@ so you can omit it if you use a plugin manager that doesn't support hooks. - {fzf}{1} 0.23.0 or above - For syntax-highlighted preview, install {bat}{5} - - `:GF?` will use {delta}{6} if available to format `git diff` output + - If {delta}{6} is available, `:GF?`, `:Commits` and `:BCommits` will use it to + format `git diff` output. to format `git diff` output - `Ag` requires {The Silver Searcher (ag)}{7} - `Rg` requires {ripgrep (rg)}{8} - `Tags` and `Helptags` require Perl