-
Notifications
You must be signed in to change notification settings - Fork 139
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
Meow-visit only in grabbed region in beacon-mode #553
Comments
If a symbol inside the secondary selection is marked, then beacons will be created, it doesn't matter where you did |
I am aware. It is mostly a convenience thing. If I right now want to change a symbol in a region, I grab it into a secondary selection, then either need to go to the beginning of the region followed by visit; or reverse isearch for the symbol followed by mark-word. I tried out helix for a bit and was amazed how friction less multi select and editing was. This is a really nice way of working, and I was wondering if a similar behavior could be mimicked in meow. |
Hmm... maybe this is a skill issue on my part. After playing around a bit and reading the implementation I realize that I can run visit with an arbitrary regex if I disable sanitization. Maybe the problem I have is that I don't really understand how to get cursors where I want them within the grabbed region. It seems to me that it is only useful in very specific circumstances i.e. change all occurrences of symbol, or change everything in column x. I can't see how to do more elaborate things. Maybe this is a mistake on my side, expecting it to be similar to multiple cursors. |
When you want to apply the same operations to multiple places, there are actually two cases.
Beacon state is only for case 1. For case 2, the common solution with kmacro is to record the operations at the first place, then navigate to each place and apply the macro manually. Compare to how multiple-cursor works, it takes the same amount of effort, it's just different in the order of steps. |
After looking more into the documentation I found some helpful things like make selection, grab region, record macro to play on each line. I think maybe there is a bit of a mental shift that needs to happen on my part. I'm thinking maybe implementing a function like meow-visit, but more similar to how isearch works. |
Meow uses There are several searching packages, e.g. ctrlf, phi-search, etc. It's better to have a solution that works with all of them. |
I think I don't know if it's reasonable to add a function like |
Are you aware of that you can submit your raw input even with |
It is. I'm using vertico, so I can simply press up to deselect the completion. It's mostly as a convenience thing. I use isearch quite a lot for navigation, and it doesn't interact well when a region is active, nor does the result end up selected. Both of these are handled by Maybe a better example would be using a regex like select all numbers in a grabbed region or something. |
Seems like there is an open PR that looks like what I'm talking about #501 |
Don't forget we have |
A good point, as well as regular old macros could probably solve this as well. Maybe a better way of viewing this is that isearch integrates poorly with meow right now. It could probably be improved if mark is cleared before running, but it would be even better if the search term was selected, and even better if it used the search ring so that I can use it the same as other parts of meow. I assume you primarily use I think having both would be really nice. I see a lot of overlap between |
I do use both And you are right, we don't have a nice incremental search integration at the moment. On one side, there are many incremental search packages, it's hard to find a general way to integrate all of them. On the other side, there are a lot features in isearch and its alternatives, it's not enough to just cancel selection before it starts and create selection on the result. |
I think I see some of the problems with just wrapping isearch. I can also see how any change to how isearch works may break how you can use it in insert mode. I really just want a command to make arbitrary selections that integrates with |
I implements some command with isearch as backend
some highlight related variables:
need: #175 (comment) |
If isearch can be integrated then I think this is a good way to go. Is the idea to completely replace the meow search internals with isearch in this case? I created a stripped down version of (defun meow-select (arg)
(interactive "P")
(let* ((reverse arg)
(pos (point))
(prompt (if arg "Select backward: " "Select: "))
(text (read-regexp prompt))
(visit-point (meow--visit-point text reverse)))
(if visit-point
(let* ((m (match-data))
(marker-beg (car m))
(marker-end (cadr m))
(beg (if (> pos visit-point) (marker-position marker-end) (marker-position marker-beg)))
(end (if (> pos visit-point) (marker-position marker-beg) (marker-position marker-end))))
(thread-first
(meow--make-selection '(select . visit) beg end)
(meow--select))
(meow--push-search text)
(meow--ensure-visible)
(meow--highlight-regexp-in-buffer text)
(setq meow--dont-remove-overlay t))
(message "Select: %s failed" text)))) It does more or less what I want it to do, but lack some nice conveniences like: highlighting as you type, case insensitivity etc... I don't know if there is a fancy built in function for doing this or if I'd have to write my own. |
We should take other isearch alternatives into account as well. |
After better understanding how |
Is it possible to limit the symbols in meow-visit to only those within the grabbed selection?
A really nice work flow is to make a selection that I want to edit, grab it, and call visit to make cursors at each occurrence.
The way it is now, all of the other symbols in the document are also included, so after making my selection and calling visit, I end up on the next match, not one in my grab. (This is assuming making the selection top to bottom)
The text was updated successfully, but these errors were encountered: