tags: added grep_cword|CWORD|visual

main
bhagwan 2 years ago
parent 23267bfb8e
commit dcebd33a88

@ -200,6 +200,9 @@ vim.api.nvim_set_keymap('n', '<c-P>',
| `spell_suggest` | spelling suggestions |
| `tags` | project tags |
| `tags_grep` | grep project tags |
| `tags_grep_cword` | tag search word under cursor |
| `tags_grep_cWORD` | tag search WORD under cursor |
| `tags_grep_visual` | tag search visual selection |
| `tags_live_grep` | live grep project tags |
| `btags` | buffer tags |
| `filetypes` | neovim filetypes |

@ -233,6 +233,9 @@ MISC *fzf-lua-misc*
| `spell_suggest` | spelling suggestions |
| `tags` | project tags |
| `tags_grep` | grep project tags |
| `tags_grep_cword` | tag search word under cursor |
| `tags_grep_cWORD` | tag search WORD under cursor |
| `tags_grep_visual` | tag search visual selection |
| `tags_live_grep` | live grep project tags |
| `btags` | buffer tags |
| `filetypes` | neovim filetypes |

@ -111,8 +111,11 @@ M.colorschemes = require'fzf-lua.providers.colorschemes'.colorschemes
M.tags = require'fzf-lua.providers.tags'.tags
M.btags = require'fzf-lua.providers.tags'.btags
M.tags_grep = require'fzf-lua.providers.tags'.tags_grep
M.tags_live_grep = require'fzf-lua.providers.tags'.tags_live_grep
M.tags_grep = require'fzf-lua.providers.tags'.grep
M.tags_grep_cword = require'fzf-lua.providers.tags'.grep_cword
M.tags_grep_CWORD = require'fzf-lua.providers.tags'.grep_cWORD
M.tags_grep_visual = require'fzf-lua.providers.tags'.grep_visual
M.tags_live_grep = require'fzf-lua.providers.tags'.live_grep
M.tags_old = require'fzf-lua.providers.tags'.tags_old
M.btags_old = require'fzf-lua.providers.tags'.btags_old
M.jumps = require'fzf-lua.providers.nvim'.jumps

@ -194,10 +194,7 @@ end
-- multi threaded (multi-process actually) version
M.live_grep_mt = function(opts)
-- do not normalize when called from 'tags_live_grep'
if not opts or not opts._normalized then
opts = config.normalize_opts(opts, config.globals.grep)
end
opts = config.normalize_opts(opts, config.globals.grep)
if not opts then return end

@ -224,7 +224,7 @@ local function tags(opts)
path.relative(opts._curr_file, opts.cwd or vim.loop.cwd())
opts.cmd = opts.cmd or get_tags_cmd(opts)
local contents = core.mt_cmd_wrapper(opts)
opts = core.set_header(opts, 2)
opts = core.set_header(opts)
opts = core.set_fzf_field_index(opts)
return core.fzf_files(opts, contents)
end
@ -246,7 +246,7 @@ M.btags = function(opts)
return tags(opts)
end
M.tags_grep = function(opts)
M.grep = function(opts)
opts = opts or {}
if not opts.search then
@ -256,7 +256,7 @@ M.tags_grep = function(opts)
return M.tags(opts)
end
M.tags_live_grep = function(opts)
M.live_grep = function(opts)
opts = config.normalize_opts(opts, config.globals.tags)
if not opts then return end
opts.lgrep = true
@ -264,4 +264,22 @@ M.tags_live_grep = function(opts)
return tags(opts)
end
M.grep_cword = function(opts)
if not opts then opts = {} end
opts.search = vim.fn.expand("<cword>")
return M.grep(opts)
end
M.grep_cWORD = function(opts)
if not opts then opts = {} end
opts.search = vim.fn.expand("<cWORD>")
return M.grep(opts)
end
M.grep_visual = function(opts)
if not opts then opts = {} end
opts.search = utils.get_visual_selection()
return M.grep(opts)
end
return M

Loading…
Cancel
Save