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

Place cursor at the begging of matches (for grep) #2209

Closed
wants to merge 1 commit into from
Closed

Place cursor at the begging of matches (for grep) #2209

wants to merge 1 commit into from

Conversation

ideasman42
Copy link
Contributor

The cursor was being placed after the matches,
adding an extra step if you need to operate on the word, after opening the file with a match.

For example, counsel-rg could go to a symbol, after this, I would like to look-up the users the symbol (or it's declarations). If the point is not at the start of the match, I need to manually jump back every time.

The cursor was being placed after the matches,
adding an extra step if you need to operate on the word, after opening the file with a match.
@abo-abo abo-abo closed this in 73d9f4a Aug 22, 2019
@abo-abo
Copy link
Owner

abo-abo commented Aug 22, 2019

Thanks. I've amended your commit to obey swiper-goto-start-of-match.

@ideasman42
Copy link
Contributor Author

Thanks, I wasn't aware of this option.

Shouldn't this code check the regex succeeds? Since i'ts not guarenteed emacs regex matches ag or rg.

(when (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
  (when swiper-goto-start-of-match
     (goto-char (match-beginning 0))))

@abo-abo
Copy link
Owner

abo-abo commented Aug 22, 2019

Makes sense, thanks.

astoff pushed a commit to astoff/swiper that referenced this pull request Jan 1, 2021
The cursor was being placed after the matches, adding an extra step if
you need to operate on the word, after opening the file with a match.

Fixes abo-abo#2209
astoff pushed a commit to astoff/swiper that referenced this pull request Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants