vim-settings/neovim/lua/plugins/grepper.lua

30 lines
971 B
Lua
Raw Permalink Normal View History

2021-09-30 17:59:26 +00:00
-- Grepper settings and shortcuts
vim.g.grepper = {
quickfix = 1,
open = 1,
switch = 0,
jump = 0,
2021-12-15 17:37:51 +00:00
tools = { "git", "rg", "ag", "ack", "pt", "grep" },
dir = "repo,cwd",
2021-09-30 17:59:26 +00:00
}
require("utils").keymap_set({ "n", "x" }, "gs", "<plug>(GrepperOperator)", {
silent = true,
noremap = false,
desc = "Grepper",
})
2021-09-30 17:59:26 +00:00
-- Override Todo command to use Grepper
2024-05-29 20:16:28 +00:00
vim.api.nvim_create_user_command("Todo", ":Grepper -noprompt -query TODO", { desc = "Search for TODO tags" })
2021-09-30 17:59:26 +00:00
-- Make some shortands for various grep programs
2024-05-29 20:16:28 +00:00
if vim.fn.executable("rg") == 1 then
vim.api.nvim_create_user_command("Rg", ":GrepperRg <args>", { nargs = "+", desc = "Ripgrep" })
end
if vim.fn.executable("ag") == 1 then
vim.api.nvim_create_user_command("Ag", ":GrepperAg <args>", { nargs = "+", desc = "Silversearcher" })
end
if vim.fn.executable("ack") == 1 then
vim.api.nvim_create_user_command("Ack", ":GrepperAck <args>", { nargs = "+", desc = "Ack search" })
2021-09-30 17:59:26 +00:00
end