tpope / vim-surround

surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
https://www.vim.org/scripts/script.php?script_id=1697
13.34k stars 444 forks source link

Smart quotes #189

Open bountonw opened 8 years ago

bountonw commented 8 years ago

Could support for single and double smart quotes be possible?

alerque commented 8 years ago

You might want to check out vim-textobj-quote which integrates support for smart (curly) quotes both into motion commands and with vim-surround.

didoesdigital commented 5 years ago

You can add a custom replacement to your vimrc like this:

let g:surround_{char2nr('“')} = "“\r”"
let g:surround_{char2nr('‘')} = "‘\r’"

That lets you type ysiw“ to wrap a word in curly double quotes or cs'‘ to change straight single quotes to curly single quotes.

Smart Quotes for Smart People shows you keyboard shortcuts to write the curly quotes when you need them.