Fzf: Search word under current cursor using fzf#grep with ripgrep

Created on 6 Nov 2017  路  3Comments  路  Source: junegunn/fzf

  • Category

    • [x] fzf binary

    • [ ] fzf-tmux script

    • [ ] Key bindings

    • [ ] Completion

    • [x] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [ ] Linux

    • [ ] Mac OS X

    • [x] Windows

    • [ ] Windows Subsystem for Linux

    • [ ] Etc.

  • Shell

    • [ ] bash

    • [ ] zsh

    • [ ] fish

From readme, I can use fzf with rg and map to Find as below, but _can't_ find the same way to find at current cursor. Typing the word under current cursor with Find somehow make it slow.

50 use tags but I find it less accurate than grep, and it makes a tags file.

command! -bang -nargs=* Find
  \ call fzf#vim#grep(
  \   'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
  \   <bang>0 ? fzf#vim#with_preview('up:60%')
  \           : fzf#vim#with_preview('right:50%:hidden', '?'),
  \   <bang>0)
question

Most helpful comment

Typing the word under current cursor with Find somehow make it slow

Yes it's slower. ripgrep or ag are much more efficient than fzf for searching inside files. If you don't provide the initial query, fzf has to load and hold every line in memory to deal with interactive filtering.

You can replace shellescape(<q-args>) with something like shellescape(expand('<cword>')).

All 3 comments

Typing the word under current cursor with Find somehow make it slow

Yes it's slower. ripgrep or ag are much more efficient than fzf for searching inside files. If you don't provide the initial query, fzf has to load and hold every line in memory to deal with interactive filtering.

You can replace shellescape(<q-args>) with something like shellescape(expand('<cword>')).

You can replace shellescape(<q-args>) with something like shellescape(expand('<cword>')).

Thanks, it works now.

Hello, I'm new to fzf.vim,I want to know is it possible jump to the next result of fzf#vim#grep. In other words, when use fzf#vim#grep to find a list of lines,I jump to the second line of the list by press Enter,in this time,I want to jump the third line,could it possible? Thanks advance.I love this plugin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alistaircolling picture alistaircolling  路  3Comments

skamsie picture skamsie  路  3Comments

leonklingele picture leonklingele  路  3Comments

nordlow picture nordlow  路  3Comments

firedev picture firedev  路  3Comments