preservim / vim-textobj-quote

Use ‘curly’ quote characters in Vim
Other
123 stars 6 forks source link

ReplaceWithCurly replaces all quotes with right curly #38

Open tomory opened 1 year ago

tomory commented 1 year ago

After doing map <silent> <leader>qc <Plug>ReplaceWithCurly per the README, I tried \qc. Instead of replacing pairs of straight quotes with matching curlies, it instead replaced all straight quotes with right curly quotes.

telemachus commented 1 year ago

I can't reproduce that here. Can you give a sample of text you were using and list exactly what commands you ran and what mode you were in when you ran the commands?

It may also be useful to try starting vim with a minimal vimrc and no other plugins (except vim-textobj-user and vim-textobj-quote).

For example, save this as vimrc (no dot in that filename).

set vif=NONE
set nocompatible
filetype on
packadd vim-textobj-user
packadd vim-textobj-quote

function! StartQuote()
    call textobj#quote#init()
    map <silent> ; <Plug>ReplaceWithCurly
    map <silent> \ <Plug>ReplaceWithStraight
endfunction

augroup test
    autocmd!
    autocmd FileType markdown call StartQuote()
augroup END

And edit this (as foo.md).

This is a test. "This is only a test."

Start up vim with this command: vim --noplugin -u vimrc foo.md

You should be able to swap the quotes around the second sentence from normal mode and visual mode using \ and ;.