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

Add swiper-backward command #1172

Closed
vspinu opened this issue Aug 23, 2017 · 8 comments
Closed

Add swiper-backward command #1172

vspinu opened this issue Aug 23, 2017 · 8 comments

Comments

@vspinu
Copy link

@vspinu vspinu commented Aug 23, 2017

It's would be great to have a counterpart of isearch-backward in swiper.

The discussion of it, and a proposed solution, could be found in #412. That solution is inherently fragile as most of it is a direct copy-paste of the swiper code. So even small changes to the internals of swiper are likely to break that solution. I guess a small incision to the swiper code could fix this without much ado.

@manuel-uberti
Copy link
Contributor

@manuel-uberti manuel-uberti commented Sep 3, 2017

I guess a small incision to the swiper code could fix this without much ado.

Could you open a PR with it? I am interested to see this kind of command.

@bbatsov
Copy link

@bbatsov bbatsov commented Feb 4, 2018

I was wondering if a such command exists, now I know it doesn't. :-)

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Feb 4, 2018

@vspinu Any chance on PR?

@vspinu
Copy link
Author

@vspinu vspinu commented Feb 4, 2018

No, not really, sorry. This part didn't quite stick with me, so I am back to usual isearch interface for the moment.

@andschwa
Copy link
Contributor

@andschwa andschwa commented Jul 8, 2019

Now that swiper-isearch exists it seems even more relevant to have swiper-isearch-backward.

jrosdahl added a commit to jrosdahl/swiper that referenced this issue Jul 13, 2019
jrosdahl added a commit to jrosdahl/swiper that referenced this issue Jul 13, 2019
@abo-abo abo-abo closed this in ee5dacf Jul 16, 2019
@SreenivasVRao
Copy link

@SreenivasVRao SreenivasVRao commented May 22, 2020

Hi guys, thanks for this feature! :)

Can you tell me how I should remap C-r within swiper? I don't want it in the global keymap...

I tried
(global-unset-key (kbd "C-r")) (define-key ivy-minibuffer-map (kbd "C-r") 'swiper-isearch-backward)

didn't work...

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented May 23, 2020

@SreenivasVRao You should use swiper-map, which has priority over ivy-minibuffer-map.

@SreenivasVRao
Copy link

@SreenivasVRao SreenivasVRao commented May 23, 2020

That caused some other problems. I looked at the key map and saw that C-s was bound to 'swiper-C-s

So I went ahead and wrote a 'swiper-C-r - Think this would be useful, but it assumes that people want C-s and C-r bound within swiper - which I know is not always the case.

(defun swiper-C-r (&optional arg)
  "Move cursor vertically down ARG candidates.
If the input is empty, select the previous history element instead."
  (interactive "p")
  (if (string= ivy-text "")
      (ivy-next-history-element 1)
    (ivy-previous-line arg)))

astoff added a commit to astoff/swiper that referenced this issue 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
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants