Add Telescope mappings to find the current word

This commit is contained in:
Oliver Davies 2024-01-07 22:21:02 +00:00
parent 2e6df3a8bd
commit 47bb1d55db

View file

@ -32,6 +32,25 @@ telescope_mapper("<leader>fh", "help_tags")
telescope_mapper("<leader>fl", "live_grep")
telescope_mapper("<leader>fo", "oldfiles")
local builtin = require "telescope.builtin"
local nmap = require("opdavies.keymap").nmap
nmap {
"<leader>fw",
function()
local word = vim.fn.expand "<cword>"
builtin.grep_string { search = word }
end,
}
nmap {
"<leader>fW",
function()
local word = vim.fn.expand "<cWORD>"
builtin.grep_string { search = word }
end,
}
telescope_mapper("<leader>gp", "grep_prompt")
telescope_mapper("<leader>ds", "lsp_document_symbols")