Git Product home page Git Product logo

Comments (3)

junegunn avatar junegunn commented on August 18, 2024 2

Is it limited to current directory only using :Rg [PATTERN]

Yes. The default implementation of :Rg command treats the whole arguments as a single pattern string.

This allows you to omit quotes when you search for a query with spaces or quote characters. I find it extremely useful when searching for lines that print logs.

:Rg cannot proceed
:Rg "Failed to

But you can override this behavior by redefining :Rg command or defining a command with a different name, so each argument is directly passed to the ripgrep process.

command! -complete=file -bang -nargs=* Rg
  \ call fzf#vim#grep("rg --with-filename --column --line-number --no-heading --color=always --smart-case -- ".<q-args>, fzf#vim#with_preview(), <bang>0)

Note

Compared to this original :Rg,

  • --with-filename was added so that the file name is always printed even when you pass a file path
  • fzf#shellescape around <q-args> is removed

With this version, you can do something like :Rg pattern ./location/to/file.extension, but :Rg (no arguments), :Rg cannot proceed (query string with spaces), :Rg "Failed to (query string with quote characters), etc will no longer work. So you probably want to define it with a different name.

from fzf.vim.

junegunn avatar junegunn commented on August 18, 2024 1

RG is taken. https://github.com/junegunn/fzf.vim?tab=readme-ov-file#commands

from fzf.vim.

denilsonsa avatar denilsonsa commented on August 18, 2024

Idea: this seems to be a common use-case. Can fzf.vim add a new command called :RG that behaves like that?

In other words, out-of-the-box people will have :Rg that behaves as usual, and :RG that allows specifying files.

from fzf.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.