kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
3.18k stars 62 forks source link

Make keymap for surrounding words with quotations #134

Closed dlvhdr closed 2 years ago

dlvhdr commented 2 years ago

Checklist

Is your feature request related to a problem? Please describe. I'm trying to set the following keymap: vim.keymap.set("n", '<Leader>"', 'ysiW"', { silent = true }) I want it to surround words with quotations. Maybe I just don't know how to write this keymap.

smjonas commented 2 years ago

You could use vim.keymap.set('n', '<Leader>"', '<cmd>norm ysiW"<cr>')

dlvhdr commented 2 years ago

Thank you, I'll check that out!

kylechui commented 2 years ago

What Jonas sent should work; an alternative keymap is the following:

vim.keymap.set("n", '<Leader>"', 'ysiW"', { remap = true })

or

vim.keymap.set("n", '<Leader>"', function()
    return 'ysiW"'
end, { remap = true, expr = true })