vim-surround icon indicating copy to clipboard operation
vim-surround copied to clipboard

Latex smart quotes surround

Open tbelaire opened this issue 9 years ago • 5 comments

I would like it if there was some sort of support for latex smart quotes which look like

``word''

as I would like to be able to go from

words words "quoted words"

to

words words ``quoted words''

with something like cs"s, for _s_mart quotes I guess. I'm not sure what the most memorable shortcut would be.

tbelaire avatar May 21 '16 00:05 tbelaire

this would be a great feature if possible

dragonxlwang avatar Aug 29 '16 18:08 dragonxlwang

I keep the following lines in my ~/.vim/ftplugin/after/tex.vim:

if exists('g:loaded_surround')
    " vim-surround: q for `foo' and Q for ``foo''
    let b:surround_{char2nr('q')} = "`\r'"
    let b:surround_{char2nr('Q')} = "``\r''"
endif

This lets me do cs'q to change

'foobar' to `foobar'

and cs"Q to change

"foobar" to ``foobar''

or other such combinations.

ajzafar avatar Sep 12 '16 18:09 ajzafar

@ajzafar Your workaround does not seem to work for me when attempting to do anything but add the characters. Can you confirm that changing and deleting the custom quote characters work for you?

lafrenierejm avatar Dec 31 '16 05:12 lafrenierejm

@lafrenierejm Oh, no, that's a limitation of surround. Custom targets don't exist, but custom replacements do.

ajzafar avatar Jan 21 '17 22:01 ajzafar

@ajzafar Alright. I might dig around in the source some to see if support for custom targets can be added.

lafrenierejm avatar Jan 22 '17 20:01 lafrenierejm