this post was submitted on 12 Oct 2023
0 points (50.0% liked)

Emacs

314 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

with evil we have the inner or outer object for selecting inside or outside quote with ", `, '

but I rather have everything hapenning in one go, using the q letter for this. (lazyvim sems to have that setup by default which i seems to have got used to it)

It's easy enough to redefine an object like this:

(define-key evil-outer-text-objects-map "q" 'evil-a-double-quote)
(define-key evil-inner-text-objects-map "q" 'evil-inner-double-quote)

which obviously only select the double quotes, anyone would know how to extend this to backquote ` or single quote '

top 3 comments
sorted by: hot top controversial new old
[–] AkiNoHotoke@alien.top 1 points 1 year ago

How does this work? Does the q become a new text object meaning "quoted" in normal mode?

So, can I do cq in normal mode and then "text" becomes "" with the cursor in the middle of the quotes with the mode being changed to insert?

[–] noooit@alien.top 1 points 1 year ago

Try expand region package from elpa.

[–] geza42@alien.top 1 points 1 year ago

There is evil-textobj-anyblock which does a similar thing (you can configure evil-textobj-anyblock-blocks to only use quotes, if you don't like that by default it uses all kinds of blocks)