nvim: Add grepper back

This commit is contained in:
ViViDboarder 2021-09-30 10:59:26 -07:00
parent 9e9defe4e2
commit 24eb10eb7a
3 changed files with 33 additions and 3 deletions

View File

@ -53,6 +53,10 @@ return require('packer').startup(function()
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true})
end,
}
use {
"mhinz/vim-grepper",
config = function() require("plugins.grepper") end,
}
-- UI
use {

View File

@ -0,0 +1,29 @@
-- Grepper settings and shortcuts
vim.g.grepper = {
quickfix = 1,
open = 1,
switch = 0,
jump = 0,
tools = {'git', 'rg', 'ag', 'ack', 'pt', 'grep'},
dir = 'repo,cwd',
}
local map = vim.api.nvim_set_keymap
local opt_silent = {silent = true}
map("n", "gs", "<plug>(GrepperOperator)", opt_silent)
map("x", "gs", "<plug>(GrepperOperator)", opt_silent)
map("n", "<leader>*", ":Grepper -cword -noprompt<cr>", opt_silent)
-- Override Todo command to use Grepper
vim.cmd "command! Todo :Grepper -noprompt -query TODO"
-- Make some shortands for various grep programs
if vim.fn.executable('rg') == 1 then
vim.cmd "command -nargs=+ Rg :GrepperRg <args>"
end
if vim.fn.executable('ag') == 1 then
vim.cmd "command -nargs=+ Ag :GrepperAg <args>"
end
if vim.fn.executable('ack') == 1 then
vim.cmd "command -nargs=+ Ack :GrepperAck <args>"
end

View File

@ -30,9 +30,6 @@ local function config_telescope()
vim.api.nvim_set_keymap("n", "<leader>t", "<cmd>Telescope current_buffer_tags<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>ft", "<cmd>Telescope tags<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>Telescope live_grep<CR>", opts)
vim.cmd "command Rg Telescope live_grep"
vim.cmd "command Grep Telescope live_grep"
end
config_telescope()