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

ivy-minibuffer-map doesn't respect user bindings #466

Closed
DamienCassou opened this issue Apr 7, 2016 · 3 comments
Closed

ivy-minibuffer-map doesn't respect user bindings #466

DamienCassou opened this issue Apr 7, 2016 · 3 comments

Comments

@DamienCassou
Copy link
Contributor

@DamienCassou DamienCassou commented Apr 7, 2016

I use my own bindings for beginning-of-defun and end-of-defun:

(bind-key* "<S-left>" #'beginning-of-buffer)
(bind-key* "<S-right>" #'end-of-buffer)

But ivy-minibuffer-map keeps on binding ivy-beginning-of-buffer and ivy-end-of-buffer to their original keystrokes M-< and M->. Fortunately, there is an easy way to fix that:

(setq ivy-minibuffer-map
      (let ((map (make-sparse-keymap)))
      [...]
-    (define-key map (kbd "M-<") 'ivy-beginning-of-buffer)
-    (define-key map (kbd "M->") 'ivy-end-of-buffer)
+    (define-key map (vector 'remap 'beginning-of-buffer) 'ivy-beginning-of-buffer)
+    (define-key map (vector 'remap 'end-of-buffer) 'ivy-end-of-buffer)
     [...]

This means: "bind ivy-beginning-of-buffer to the same keystroke as beginning-of-buffer" and is described in elisp remapping command. With this in place, for me, ivy-beginning-of-buffer will be bound to S-<left> instead of M-<.

I can send a pull request if you want.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Apr 7, 2016

I can send a pull request if you want.

That would be fine, thanks.

DamienCassou added a commit to DamienCassou/swiper that referenced this issue Apr 7, 2016
* ivy.el: Make sure user keybindings are reused in ivy-minibuffer-map.
  Without this patch, if the user specifies his own keybinding for a
  standard command (e.g., `beginning-of-buffer`, normally bound to
  `M-<`), ivy keeps using the default keybinding (e.g., `M-<`) in
  ivy-minibuffer-map instead of the user-specified one.

* ivy-test.el: Add corresponding test

Fix issue abo-abo#466.
@DamienCassou
Copy link
Contributor Author

@DamienCassou DamienCassou commented Apr 7, 2016

Can we close this one?

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Apr 7, 2016

Of course, thanks.

@abo-abo abo-abo closed this Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.