nvim/lua/plugins/spectre.lua

28 lines
868 B
Lua

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,
}