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

29 lines
808 B
Lua
Raw 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
}
local map = vim.api.nvim_set_keymap
2021-12-15 17:37:51 +00:00
local opt_silent = { silent = true }
2021-09-30 17:59:26 +00:00
map("n", "gs", "<plug>(GrepperOperator)", opt_silent)
map("x", "gs", "<plug>(GrepperOperator)", opt_silent)
-- Override Todo command to use Grepper
2021-12-15 17:37:51 +00:00
vim.cmd("command! Todo :Grepper -noprompt -query TODO")
2021-09-30 17:59:26 +00:00
-- Make some shortands for various grep programs
2021-12-15 17:37:51 +00:00
if vim.fn.executable("rg") == 1 then
vim.cmd("command -nargs=+ Rg :GrepperRg <args>")
2021-09-30 17:59:26 +00:00
end
2021-12-15 17:37:51 +00:00
if vim.fn.executable("ag") == 1 then
vim.cmd("command -nargs=+ Ag :GrepperAg <args>")
2021-09-30 17:59:26 +00:00
end
2021-12-15 17:37:51 +00:00
if vim.fn.executable("ack") == 1 then
vim.cmd("command -nargs=+ Ack :GrepperAck <args>")
2021-09-30 17:59:26 +00:00
end