'grep_curbuf' is now consistent with 'grep_' cmds, added 'lgrep_curbuf'

main
bhagwan 2 years ago
parent 92e21423a1
commit ac342fcb3b

@ -149,7 +149,8 @@ vim.api.nvim_set_keymap('n', '<c-P>',
| `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 |
| `grep_curbuf` | search current buffer lines |
| `lgrep_curbuf` | live grep current buffer |
| `live_grep` | live grep current project |
| `live_grep_resume` | live grep continue last search |
| `live_grep_glob` | live_grep with `rg --glob` support |

@ -174,7 +174,8 @@ SEARCH *fzf-lua-search*
| `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 |
| `grep_curbuf` | search current buffer lines |
| `lgrep_curbuf` | live grep current buffer |
| `live_grep` | live grep current project |
| `live_grep_resume` | live grep continue last search |
| `live_grep_glob` | live_grep with `rg --glob` support |

@ -96,6 +96,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.lgrep_curbuf = require'fzf-lua.providers.grep'.lgrep_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

@ -352,11 +352,22 @@ M.grep_curbuf = function(opts)
opts.filename = vim.api.nvim_buf_get_name(0)
if #opts.filename > 0 then
opts.filename = path.relative(opts.filename, vim.loop.cwd())
return M.live_grep(opts)
if opts.lgrep then
return M.live_grep(opts)
else
opts.search = ''
return M.grep(opts)
end
else
utils.info("Rg current buffer requires actual file on disk")
return
end
end
M.lgrep_curbuf = function(opts)
if not opts then opts = {} end
opts.lgrep = true
return M.grep_curbuf(opts)
end
return M

Loading…
Cancel
Save