Add spectre plugin

This commit is contained in:
Evie Litherland-Smith 2023-06-06 15:51:03 +01:00
parent 8be5da1fbc
commit 25921919d1

27
lua/plugins/spectre.lua Normal file
View file

@ -0,0 +1,27 @@
return {
"nvim-pack/nvim-spectre",
cmd = "Spectre",
dependencies = { "nvim-lua/plenary.nvim" },
init = function()
vim.keymap.set("n", "<leader>S", '<cmd>lua require("spectre").open()<CR>', { desc = "Open Spectre" })
vim.keymap.set(
"n",
"<leader>sw",
'<cmd>lua require("spectre").open_visual({select_word=true})<CR>',
{ desc = "Search current word" }
)
vim.keymap.set(
"v",
"<leader>sw",
'<esc><cmd>lua require("spectre").open_visual()<CR>',
{ desc = "Search current word" }
)
vim.keymap.set(
"n",
"<leader>sp",
'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>',
{ desc = "Search on current file" }
)
end,
config = true,
}