junegunn / junegunn/fzf.vim

preview options delimiter with depth breaks preview window

Open
#1,430 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- [ x] I have fzf 0.30.0 or above
- [ x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [ x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [ x] I have read through the manual page of fzf (`man fzf`)
- [ x] I have searched through the existing issues

#### Issue
Preview window does not show the line correctly when used with `'--delimiter', '/', '--with-nth', '-2..']`

#### What I try to achieve
Wrap or shorten long path names so matches can be more readable

example:
image

#### What I tried
I used base confing from [advanced ripgrep integration](https://github.com/junegunn/fzf.vim/blob/master/doc/fzf-vim.txt) then according to this issue https://github.com/junegunn/fzf.vim/issues/741 I add `'--delimiter', '/', '--with-nth', '-2..']` to my config that looks like

```

command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=never --smart-case '.shellescape(), 1,
\ fzf#vim#with_preview(), 0)

function! RipgrepFzf(query, fullscreen)
let command_fmt = 'rg -g "*.yml" -g "*.cs" -g "*.cpp" -g "*.h" --column --line-number --no-heading --color=always --smart-case %s | sed "s/ \{1,\}/ /g" || true'
let initial_command = printf(command_fmt, shellescape(a:query))
let reload_command = printf(command_fmt, '{q}')
let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command, '--delimiter', '/', '--with-nth', '-2..']}
call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction

command! -nargs=* -bang RG call RipgrepFzf(, 0)
]])

```

After that issue looks like this instead showing the line that words placed in it only shows beginning of the file

image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.