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

Comments

Projects
None yet
2 participants
@DamienCassou
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Apr 7, 2016

Owner

I can send a pull request if you want.

That would be fine, thanks.

Owner

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

Make sure user keybindings are respected
* 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 #466.
@DamienCassou

This comment has been minimized.

Show comment
Hide comment
@DamienCassou

DamienCassou Apr 7, 2016

Contributor

Can we close this one?

Contributor

DamienCassou commented Apr 7, 2016

Can we close this one?

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Apr 7, 2016

Owner

Of course, thanks.

Owner

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