diff --git a/lua/mappings.lua b/lua/mappings.lua index 267bc02..85294d7 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -57,3 +57,15 @@ vim.cmd('set shiftwidth=4') vim.cmd('set expandtab') vim.o.hidden = true + +-- wrap selected text in single quotes +vim.keymap.set('x', "'", function() + local text = vim.fn.getreg('"') -- Get the visually selected text + vim.cmd("normal! c'" .. text .. "'") +end, { desc = "Wrap selected text in single quotes" }) + +-- wrap selected text in double quotes +vim.keymap.set('x', '"', function() + local text = vim.fn.getreg('"') -- Get the visually selected text + vim.cmd('normal! c"' .. text .. '"') +end, { desc = "Wrap selected text in double quotes" })