mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-18 03:26:28 +00:00
nvim: Add grepper back
This commit is contained in:
parent
9e9defe4e2
commit
24eb10eb7a
@ -53,6 +53,10 @@ return require('packer').startup(function()
|
|||||||
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
"mhinz/vim-grepper",
|
||||||
|
config = function() require("plugins.grepper") end,
|
||||||
|
}
|
||||||
|
|
||||||
-- UI
|
-- UI
|
||||||
use {
|
use {
|
||||||
|
29
neovim/lua/plugins/grepper.lua
Normal file
29
neovim/lua/plugins/grepper.lua
Normal 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
|
@ -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>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>ft", "<cmd>Telescope tags<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>Telescope live_grep<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
|
end
|
||||||
|
|
||||||
config_telescope()
|
config_telescope()
|
||||||
|
Loading…
Reference in New Issue
Block a user