Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using surround to manipulate quotes is broken when emacs doesn't think you're in a quoted string #56

Open
rolandcrosby opened this issue Jun 17, 2015 · 7 comments

Comments

@rolandcrosby
Copy link

In this text file, with your cursor in the middle of the word 'this':

5'11" tall
change "this" word

attempting to manipulate the surrounding quotes (ds", cs", etc) returns a "No quoted string found" error. In Vim with surround installed, the quotes are correctly detected and manipulated.

I believe this is due to Evil's quote textobject using native Emacs quote parsing, per this thread. Also per that thread, it sounds like Evil itself is not going to change the way quote textobjects are parsed, so a change to make surround behave normally would have to be made in evil-surround itself.

@ninrod
Copy link
Member

ninrod commented Jan 16, 2017

Yes this is related to #92. I think evil-surround should enclose it's scope only inside a line, not multlinewise because it get's hard to know if you are writing a multiline string or not.

@ninrod
Copy link
Member

ninrod commented Dec 2, 2017

@rolandcrosby, this is really hard for evil-surround to deal with. vim surround actually displays disparate behaviour in this regard. Let's take this as an example(cursor on |):

5'11( tall
ch|ange )this' word

ds( will kill the parenthesis in vim-surround. Now if we want to kill quotes in vim-surround with ds', it will not work because they are in different lines. I'm not sure if vim-surround is right. I think evil-surround is right in this case because it treats all cases equally: multilinewise.

I'm not 100% sure of what to do in this case but I'm inclined to leave it as it is.

@ninrod
Copy link
Member

ninrod commented Dec 7, 2017

what do you think @justbur, @edkolev, @wasamasa and @TheBB?

@actionshrimp
Copy link

actionshrimp commented Jul 12, 2018

Interestingly this seems to happen even when there are no literal surrounding characters due (I assume) to the native quote parsing.

With this YAML snippet:

args:
  - '-c'
  - |
    git config --global user.email "[email protected]"
    git config --global user.name "dave"

in yaml-mode, the two lines after the pipe count as quoted, and with the cursor inside the email quotes, doing e.g. di" gives the No quoted string found message.

However if you switch to text-mode, di" works as expected.

@ninrod
Copy link
Member

ninrod commented Jul 12, 2018

@actionshrimp I think that happens because yaml-mode defines a different syntax table for quoted stuff.

@actionshrimp
Copy link

Ah I just realised this is related to evil text-objects rather than surround specifically (I was actually trying to do some surround related operations which sent me off in the wrong place). Sorry for the noise!

@jvtrigueros
Copy link

@actionshrimp I just hit this exact issue in YAML, did you have a workaround for this? Don't mean to hijack, just working in YAML so much and I don't know where else to look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants