junegunn / junegunn/fzf.vim

can't make function fzf#vim#with_preview to work

Open
#1,111 1 comment 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

Category
- [ ] Question
- [ ] Bug

OS
- [ ] Linux

Vim
- [ ] Neovim

I'm using the following configuration for fzf:
47 " fzf intergration
46 set rtp+=~/Documents/Utilites/fzf
45
44 " My mapping for triggering fzf
43 map :Files
42 nnoremap fb :Buffers
41 nnoremap fg :GFiles
40 nnoremap fr :Rg
39 nnoremap ft :Tags
38 nnoremap ff :Files
37 nnoremap fm :Marks
36
35 let g:fzf_tags_command = 'ctags -R'
34
33 " Border color
32 let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } }
31
30 let g:fzf_preview_window = 'right:60%'
29
28 let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline'
27 let $FZF_DEFAULT_COMMAND="rg --files --hidden"
26
25 let g:fzf_colors =
24 \ { 'fg': ['fg', 'Normal'],
23 \ 'bg': ['bg', 'Normal'],
22 \ 'hl': ['fg', 'Comment'],
21 \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
20 \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
19 \ 'hl+': ['fg', 'Statement'],
18 \ 'info': ['fg', 'PreProc'],
17 \ 'border': ['fg', 'Ignore'],
16 \ 'prompt': ['fg', 'Conditional'],
15 \ 'pointer': ['fg', 'Exception'],
14 \ 'marker': ['fg', 'Keyword'],
13 \ 'spinner': ['fg', 'Label'],
12 \ 'header': ['fg', 'Comment'] }
11
10 "Get Files
9 command! -bang -nargs=? -complete=dir Files
8 \ call fzf#vim#files(, {'options': ['--layout=reverse', '--info=inline', '--preview', 'coderay {}']}, 0)
7
6 " Get text in files with Rg
5 command! -bang -nargs=* Rg
4 \ call fzf#vim#grep(
3 \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1,
2 \ fzf#vim#with_preview(), 0)
1
48
1 function! RipgrepFzf(query, fullscreen)
2 let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
3 let initial_command = printf(command_fmt, shellescape(a:query))
4 let reload_command = printf(command_fmt, '{q}')
5 let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
6 call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
7 endfunction
8
9 command! -nargs=* -bang RG call RipgrepFzf(, 0)
10
11 " Git grep
12 command! -bang -nargs=* GGrep
13 \ call fzf#vim#grep(
14 \ 'git grep --line-number '.shellescape(), 0,
15 \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0)

when I was using fzf#vim#with_preview() in command! -bang -nargs=? -complete=dir Files preview window was always empty, and it's also the case in the other commands

but now that I changed the command with
command! -bang -nargs=? -complete=dir Files
8 \ call fzf#vim#files(, {'options': ['--layout=reverse', '--info=inline', '--preview', 'coderay {}']}, 0)
preview works. Do you have a hint what I am doing wrong when I am using with_preview functions?

Thanks.

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.