cofi / evil-leader

<leader> key for evil
GNU General Public License v3.0
315 stars 22 forks source link

Support for maps that use more that one key #6

Closed yardsale8 closed 11 years ago

yardsale8 commented 11 years ago

I did a little bit of testing and it appears that that maps of more than one key are not supported. This is a request for support of maps such as

(evil-leader/set-key "nt" 'nav-toggle)

cofi commented 11 years ago

Which Emacs version do you use? Emacs23.4.1 and Emacs24.3.1 don't show this problem. On a recent snapshot I can reproduce but I don't think that behavior is intentional.

So in short: Such support exists as long as define-key does support it.

As a workaround you can define a keymap for "n":

(evil-leader/set-key "n" (let ((map (make-sparse-keymap)))
                           (define-key map (kbd "t") 'nav-toggle)
                           map))
yardsale8 commented 11 years ago

Thanks for the response. I have been trying many different combinations on windows lately and i am not sure which configuration i was using when i tested. Just tried it again and it worked this time with cygwin emacs-win32 24.3.1.

Sorry for wasting your time and thanks helping make emacs more like vim! On May 3, 2013 5:26 PM, "Michael Markert" notifications@github.com wrote:

Which Emacs version do you use? Emacs23.4.1 and Emacs24.3.1 don't show this problem. On a recent snapshot I can reproduce but I don't think that behavior is intentional.

So in short: Such support exists as long as define-key does support it.

As a workaround you can define a keymap for "n":

(evil-leader/set-key "n" (let ((map (make-sparse-keymap))) (define-key map (kbd "t") 'nav-toggle) map))

— Reply to this email directly or view it on GitHubhttps://github.com/cofi/evil-leader/issues/6#issuecomment-17421558 .

cofi commented 11 years ago

Nothing wasted, now it's documented here ;)

asheshambasta commented 5 years ago

I can reproduce this with something like:


(use-package evil-leader 
  :pin melpa 
  :config (global-evil-leader-mode) 
          (evil-leader/set-leader "<SPC>")
          ;; global leader keys 
          (evil-leader/set-key 

            ;; handling buffers 
            "pf" 'projectile-find-file
            ;; "p s g" 'projectile-grep
            "<SPC> k" 'kill-current-buffer
            "<SPC> b" 'ido-switch-buffer 

            ;; flycheck
            "m" 'flycheck-next-error
            "n" 'flycheck-previous-error

            ;; magit 
            "g" 'magit-status 
            "<SPC> =" 'magit-push-current-to-pushremote
            "<SPC> +" 'magit-push-matching

            "x" 'smex 
            "<SPC> x" 'smex-major-mode-commands

            ;; all frame-manipulations are double prefixed with the leader key.
            "<SPC> m" 'make-frame
            "<SPC> d" 'delete-frame
            "<SPC> ]" 'dired-sidebar-toggle-sidebar
            "<SPC> [" 'ace-window
          )
          ;; mode specific bindings don't seem to be working correctly. 
          ;; (evil-leader/set-key-for-mode 'magit-mode 
          ;; )
          ;; (evil-leader/set-key-for-mode 'flycheck-mode 
          ;; )
          (evil-leader/set-key-for-mode 'haskell-mode 
            "s" 'brittany-format-buffer-file ;; format and save the buffer.
            "r" 'intero-repl-load
          )
          (evil-leader/set-key-for-mode 'intero-repl-mode
            "z" 'intero-repl-switch-back
          )
)

Emacs: GNU Emacs 27.0.50


Actually, scratch that. I had to restart emacs for some reason, and now things work as expected.