How to override any helm source customized keymap?

111 views
Skip to first unread message

Amos Bird

unread,
May 19, 2016, 6:54:48 AM5/19/16
to emacs-helm
I'd like to make this keybinding configuration effective in every helm session. How can I achieve this?

  (with-eval-after-load 'helm
    (define-key helm-map (kbd "C-w") '
backward-kill-word)
   
(define-key helm-map (kbd "C-u") '(lambda () (interactive) (kill-line 0)))
    (define-key helm-map (kbd "ESC") '
helm-keyboard-quit)
   
(define-key helm-map (kbd "C-h") 'delete-backward-char))Enter code here...

I know these bindings are useful in emacs, but I really want to change them. Is it possible? Currently I have to do this

  (with-eval-after-load 'helm-locate
    (define-key helm-generic-files-map (kbd "C-w") '
backward-kill-word)
   
(define-key helm-generic-files-map (kbd "C-u") '(lambda () (interactive) (kill-line 0)))
    (define-key helm-generic-files-map (kbd "C-h") '
delete-backward-char))

 
(with-eval-after-load 'helm-buffer
    (define-key helm-buffer-map (kbd "C-w") '
backward-kill-word)
   
(define-key helm-buffer-map (kbd "C-u") '(lambda () (interactive) (kill-line 0)))
    (define-key helm-buffer-map (kbd "C-h") '
delete-backward-char))

 
(with-eval-after-load 'helm-projectile
    (define-key helm-projectile-find-file-map (kbd "C-w") '
backward-kill-word)
   
(define-key helm-projectile-find-file-map (kbd "C-u") '(lambda () (interactive) (kill-line 0)))
    (define-key helm-projectile-find-file-map (kbd "C-h") '
delete-backward-char)
   
(define-key helm-projectile-projects-map (kbd "C-w") 'backward-kill-word)
    (define-key helm-projectile-projects-map (kbd "C-u") '
(lambda () (interactive) (kill-line 0)))
   
(define-key helm-projectile-projects-map (kbd "C-h") 'delete-backward-char))
Enter code here...


Thierry Volpiatto

unread,
May 19, 2016, 2:19:20 PM5/19/16
to emacs...@googlegroups.com

Amos Bird <amos...@gmail.com> writes:

> I'd like to make this keybinding configuration effective in every helm
> session. How can I achieve this?

Unless your bindings are really specific to a keymap, use only helm-map,
no need to define-key for each map (consider helm-map as something like
a helm global-map).

And as I told you on github, the bindings you choose are really bad, but
well that's your choice ;-)

> (with-eval-after-load 'helm
> (define-key helm-map (kbd "C-w") 'backward-kill-word)
> (define-key helm-map (kbd "C-u") '(lambda () (interactive) (kill-line 0)))
> (define-key helm-map (kbd "ESC") 'helm-keyboard-quit)
> (define-key helm-map (kbd "C-h") 'delete-backward-char))Enter code here...

So only this should be needed, also no need to use with-eval-after-load
if you have required helm-config just before.

--
Thierry

Amos Bird

unread,
May 19, 2016, 10:21:05 PM5/19/16
to emacs-helm
I'm using the spacemacs configuration. Defining keys on the global helm map is not working. That's why I'm seeking help here :-).

Thierry Volpiatto

unread,
May 19, 2016, 11:49:08 PM5/19/16
to emacs...@googlegroups.com

Amos Bird <amos...@gmail.com> writes:

> I'm using the spacemacs configuration.

So you have to ask at Spacemacs, I know nothing about Spacemacs.

--
Thierry

AhLeung Cheng

unread,
Jun 5, 2016, 2:59:28 PM6/5/16
to emacs-helm
How about using "bind-key*" to override them?

Reply all
Reply to author
Forward
0 new messages