Hey, I have been converting my keymaps from vim.api.nvim_set_keymap
to vim.keymap.set
and I didn’t find a way to “Escape” visual mode and execute a lua command with pure lua.
E.g: vim.keymap.set('v', '<leader>rf', '<Esc><cmd>lua require("telescope").extensions.refactoring.refactors()<CR>')
havent tested it but how about
vim.keymap.set("v", "<leader>rf", function()
vim.api.nvim_input "<Esc>"
require("telescope").extensions.refactoring.refactors()
end)
If you use a function I don’t think that vim.api.nvim_input("<Esc>")
is necessary. I think this does the work.
vim.keymap.set("v", "<leader>rf", function()
require("telescope").extensions.refactoring.refactors()
end)
There is also:
vim.fn.feedkeys(':','nx')