junegunn / fzf.vim

fzf :heart: vim
MIT License
9.52k stars 582 forks source link

Bug: "fzf#vim#grep(c, 0, spec, 1)": output contains column numbers #1480

Closed vitaly-zdanevich closed 1 year ago

vitaly-zdanevich commented 1 year ago

In this mapping:

nnoremap <leader>e :call SearchWithIgnore()<CR>
" Exclude tests, mocks

function! SearchWithIgnore()
    let c = 'rg
        \ --glob "!*_test.go"
        \ --glob "!*_mock.go"
        \ --glob "!*.gen.go"
        \ --glob "!mock/"
        \ --glob "!mocks/"
        \ --column
        \ --line-number
        \ --no-heading
        \ --color=always
        \ --smart-case
        \ --fixed-strings
        \ -- %s || true'

    let spec = {'options': ['--disabled', '--bind', 'change:reload:'.printf(c, '{q}')]}
    let spec = fzf#vim#with_preview(spec, 'right', 'ctrl-/')
    call fzf#vim#grep(c, 0, spec, 1)
endfunction
junegunn commented 1 year ago

Remove --column in your command. The second argument just tells the function that the output of the command contains column numbers.

But come to think of it, I don't think that the has_column argument is really needed. Let me see..

vitaly-zdanevich commented 1 year ago

I did git pull of this plugin, and edited fzf#vim#grep from (c, 0, spec, 1) to (c, spec, 1) and got no preview :(

junegunn commented 1 year ago

That has nothing to with preview.

FYI https://github.com/junegunn/fzf.vim#example-git-grep-wrapper