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

Cannot bind <leader> <SPC>. #32

Open
gregory-nisbet opened this issue Jan 11, 2016 · 1 comment
Open

Cannot bind <leader> <SPC>. #32

gregory-nisbet opened this issue Jan 11, 2016 · 1 comment

Comments

@gregory-nisbet
Copy link

Using the below configuration file (and the latest version of evil-mode and evil-leader as a submodule in my .emacs/modules directory), I am able to reproduce a bug where <leader> b is defined, but <leader> <SPC> is not. The same weirdness occurs with a leader key of ",".

(require 'cl-lib)
(cl-pushnew "~/.emacs.d/modules/evil-mode" load-path)
(cl-pushnew "~/.emacs.d/modules/evil-leader" load-path)

(require 'evil)
(require 'evil-leader)

(global-evil-leader-mode +1)
(evil-mode +1)
(global-evil-leader-mode +1)
;; set-leader is finicky and doesn't reject keys it doesn't understand
(evil-leader/set-leader "<SPC>")

(evil-leader/set-key (kbd "<SPC>") #'backward-word)
(evil-leader/set-key (kbd "b") #'backward-word)

Here is the section of the output of C-h b related to evil-leader bindings.

`evil-normal-state-local-minor-mode' Minor Mode Bindings:
key             binding
---             -------

SPC     Prefix Command

SPC b       backward-word

Note: as a workaround, modifying the default map directly fixes the problem.

(define-key evil-leader--default-map (kbd "<SPC>") #'backward-word)

Ah! okay. It turns out you have to do

(evil-leader/set-key "SPC" #'backward-word)
@redeemefy
Copy link

I know this is old but thought to share my snippet.

(use-package evil-leader ; ----------------------------------- Set your VIM leader key
  :config
  (global-evil-leader-mode)
  (evil-leader/set-leader "<SPC>") ; ------------------------- Spacebar as leader key
  (evil-leader/set-key
    "cff" 'counsel-find-file ; ------------------------------- Default file search
    "cfz" 'counsel-fzf ; ------------------------------------- Recursive search by file name with fuzzy matching
    "crg" 'counsel-rg ; -------------------------------------- Recursive search by string content with ripgrep
    "csb" 'counsel-switch-buffer ; --------------------------- List buffers with counsel
    "cdf" 'counsel-describe-function ; ----------------------- Describe functions with counsel
    "cdv" 'counsel-describe-variable ; ----------------------- Describe variables with counsel
    "kb" 'kill-buffer ; -------------------------------------- Default kill buffer
    "i" 'swiper ; -------------------------------------------- Isearch current buffer with swiper
    "zsh" 'shell ; ------------------------------------------- Default open shell buffer
    "sb" 'save-buffer ; -------------------------------------- Default save current buffer
    "mx" 'counsel-M-x ; -------------------------------------- Easier access to M-x
    ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants