Use --gap option for rendering g:fzf_vim.grep_multi_line = 2+

Requires fzf 0.56.0

https://github.com/junegunn/fzf/releases/tag/v0.56.0
This commit is contained in:
Junegunn Choi
2024-10-29 14:09:00 +09:00
parent ec75ffbfd5
commit 556f45e79a
3 changed files with 23 additions and 8 deletions

View File

@@ -180,7 +180,7 @@ let g:fzf_vim.preview_window = []
let g:fzf_vim.buffers_jump = 1
" [Ag|Rg|RG] Display path on a separate line for narrow screens (default: 0)
" * Requires Perl and fzf 0.53.0 or later
" * Requires Perl and fzf 0.56.0 or later
let g:fzf_vim.grep_multi_line = 0
" PATH:LINE:COL:LINE
let g:fzf_vim.grep_multi_line = 1
@@ -189,7 +189,7 @@ let g:fzf_vim.grep_multi_line = 1
let g:fzf_vim.grep_multi_line = 2
" PATH:LINE:COL:
" LINE
" (empty line)
" (empty line between items using --gap option)
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'

View File

@@ -94,7 +94,7 @@ function! s:escape_for_bash(path)
return escape(path, ' ')
endfunction
let s:min_version = '0.53.0'
let s:min_version = '0.56.0'
let s:is_win = has('win32') || has('win64')
let s:is_wsl_bash = s:is_win && (exepath('bash') =~? 'Windows[/\\]system32[/\\]bash.exe$')
let s:layout_keys = ['window', 'up', 'down', 'left', 'right']
@@ -881,7 +881,7 @@ function! s:ag_handler(name, lines)
return
endif
let multi_line = min([s:conf('grep_multi_line', 0), 2])
let multi_line = min([s:conf('grep_multi_line', 0), 1])
let lines = []
if multi_line && executable('perl')
for idx in range(1, len(a:lines), multi_line + 1)
@@ -938,9 +938,12 @@ function! s:grep_multi_line(opts)
let multi_line = s:conf('grep_multi_line', 0)
if multi_line && executable('perl')
let opts = copy(a:opts)
let opts.options = extend(copy(opts.options), ['--read0', '--highlight-line'])
let delim = multi_line > 1 ? '\n\0' : '\0'
return [opts, printf(" | perl -pe 's/\\n/%s/; s/^([^:]+:){2,3}/$&\\n /'", delim)]
let extra = ['--read0', '--highlight-line']
if multi_line > 1
call extend(extra, ['--gap', multi_line - 1])
endif
let opts.options = extend(copy(opts.options), extra)
return [opts, printf(" | perl -pe 's/\\n/%s/; s/^([^:]+:){2,3}/$&\\n /'", '\0')]
endif
return [a:opts, '']

View File

@@ -1,4 +1,4 @@
fzf-vim.txt fzf-vim Last change: April 25 2024
fzf-vim.txt fzf-vim Last change: October 29 2024
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
==============================================================================
@@ -231,6 +231,18 @@ Command-level options~
" [Buffers] Jump to the existing window if possible
let g:fzf_vim.buffers_jump = 1
" [Ag|Rg|RG] Display path on a separate line for narrow screens (default: 0)
" * Requires Perl and fzf 0.56.0 or later
let g:fzf_vim.grep_multi_line = 0
" PATH:LINE:COL:LINE
let g:fzf_vim.grep_multi_line = 1
" PATH:LINE:COL:
" LINE
let g:fzf_vim.grep_multi_line = 2
" PATH:LINE:COL:
" LINE
" (empty line between items using --gap option)
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'