feat: restore search + rename mappgins
This commit is contained in:
@@ -128,30 +128,8 @@ map("v", "<leader>ca", function()
|
|||||||
vim.lsp.buf.code_action()
|
vim.lsp.buf.code_action()
|
||||||
end, { desc = "LSP code action" })
|
end, { desc = "LSP code action" })
|
||||||
map("n", "<leader>r", function()
|
map("n", "<leader>r", function()
|
||||||
-- when rename opens the prompt, this autocommand will trigger
|
|
||||||
-- it will "press" CTRL-F to enter the command-line window `:h cmdwin`
|
|
||||||
-- in this window I can use normal mode keybindings
|
|
||||||
local cmdId
|
|
||||||
cmdId = vim.api.nvim_create_autocmd({ "CmdlineEnter" }, {
|
|
||||||
callback = function()
|
|
||||||
local key = vim.api.nvim_replace_termcodes("<C-f>", true, false, true)
|
|
||||||
vim.api.nvim_feedkeys(key, "c", false)
|
|
||||||
vim.api.nvim_feedkeys("0", "n", false)
|
|
||||||
-- autocmd was triggered and so we can remove the ID and return true to delete the autocmd
|
|
||||||
cmdId = nil
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
vim.lsp.buf.rename()
|
vim.lsp.buf.rename()
|
||||||
-- if LPS couldn't trigger rename on the symbol, clear the autocmd
|
end, { desc = "LSP rename" })
|
||||||
vim.defer_fn(function()
|
|
||||||
-- the cmdId is not nil only if the LSP failed to rename
|
|
||||||
if cmdId then
|
|
||||||
vim.api.nvim_del_autocmd(cmdId)
|
|
||||||
end
|
|
||||||
end, 500)
|
|
||||||
end, { desc = "Rename symbol" })
|
|
||||||
|
|
||||||
map("n", "<leader>wa", function()
|
map("n", "<leader>wa", function()
|
||||||
vim.lsp.buf.add_workspace_folder()
|
vim.lsp.buf.add_workspace_folder()
|
||||||
end, { desc = "Add workspace folder" })
|
end, { desc = "Add workspace folder" })
|
||||||
@@ -178,6 +156,7 @@ map("n", "<Leader>cdo", ":DapStepOver<CR>")
|
|||||||
|
|
||||||
---- Telescope find ----
|
---- Telescope find ----
|
||||||
|
|
||||||
|
map("n", "<leader>F", "<cmd> Telescope resume <CR>", { desc = "Resume las search" })
|
||||||
map("n", "<leader>ff", "<cmd> Telescope find_files <CR>", { desc = "Find files" })
|
map("n", "<leader>ff", "<cmd> Telescope find_files <CR>", { desc = "Find files" })
|
||||||
map("n", "<leader>fa", "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", { desc = "Find all" })
|
map("n", "<leader>fa", "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", { desc = "Find all" })
|
||||||
map("n", "<leader>fw", "<cmd> Telescope live_grep <CR>", { desc = "Live grep" })
|
map("n", "<leader>fw", "<cmd> Telescope live_grep <CR>", { desc = "Live grep" })
|
||||||
|
|||||||
Reference in New Issue
Block a user