diff --git a/README.md b/README.md index 80c0b45..6bcbde2 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ vim.api.nvim_set_keymap('n', '', | `grep_cword` | search word under cursor | | `grep_cWORD` | search WORD under cursor | | `grep_visual` | search visual selection | +| `grep_project` | search all project lines (fzf.vim's `:Rg`) | | `grep_curbuf` | live grep current buffer | | `live_grep` | live grep current project | | `live_grep_resume` | live grep continue last search | diff --git a/doc/fzf-lua.txt b/doc/fzf-lua.txt index 8e3876a..4eed8dc 100644 --- a/doc/fzf-lua.txt +++ b/doc/fzf-lua.txt @@ -172,6 +172,7 @@ SEARCH *fzf-lua-search* | `grep_cword` | search word under cursor | | `grep_cWORD` | search WORD under cursor | | `grep_visual` | search visual selection | +| `grep_project` | search all project lines (fzf.vim's `:Rg`) | | `grep_curbuf` | live grep current buffer | | `live_grep` | live grep current project | | `live_grep_resume` | live grep continue last search | diff --git a/lua/fzf-lua/init.lua b/lua/fzf-lua/init.lua index 0b9d874..c15e0ba 100644 --- a/lua/fzf-lua/init.lua +++ b/lua/fzf-lua/init.lua @@ -100,6 +100,7 @@ M.grep_cword = require'fzf-lua.providers.grep'.grep_cword M.grep_cWORD = require'fzf-lua.providers.grep'.grep_cWORD M.grep_visual = require'fzf-lua.providers.grep'.grep_visual M.grep_curbuf = require'fzf-lua.providers.grep'.grep_curbuf +M.grep_project = require'fzf-lua.providers.grep'.grep_project M.git_files = require'fzf-lua.providers.git'.files M.git_status = require'fzf-lua.providers.git'.status M.git_commits = require'fzf-lua.providers.git'.commits diff --git a/lua/fzf-lua/providers/grep.lua b/lua/fzf-lua/providers/grep.lua index 03ee035..5ae2801 100644 --- a/lua/fzf-lua/providers/grep.lua +++ b/lua/fzf-lua/providers/grep.lua @@ -340,6 +340,12 @@ M.grep_visual = function(opts) return M.grep(opts) end +M.grep_project = function(opts) + if not opts then opts = {} end + if not opts.search then opts.search = '' end + return M.grep(opts) +end + M.grep_curbuf = function(opts) if not opts then opts = {} end opts.rg_opts = config.globals.grep.rg_opts .. " --with-filename"