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

bind SPC m to comma #300

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/dotspacemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')"
(defvar dotspacemacs-leader-key "SPC"
"The leader key.")

(defvar dotspacemacs-major-mode-leader-key ","
"The leader key for major mode.")

(defvar dotspacemacs-command-key ":"
"The key used for Evil commands (ex-commands) and Emacs commands (M-x).
By default the command key is `:' so ex-commands are executed like in Vim
Expand Down
9 changes: 9 additions & 0 deletions spacemacs/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ a key sequence. NAME is a symbol name used as the prefix command."
"Remove the evil-leader binding from the passed MAP."
(spacemacs/activate-evil-leader-for-maps `(,map)))

(defun spacemacs/activate-major-mode-leader ()
"Bind major mode key map to `dotspacemacs-major-mode-leader-key'."
(setq mode-map (cdr (assoc major-mode evil-leader--mode-maps)))
(when mode-map
(setq major-mode-map (lookup-key mode-map (kbd "m")))
(define-key evil-normal-state-local-map
(kbd dotspacemacs-major-mode-leader-key) major-mode-map)
))

(defmacro spacemacs|evilify (map &rest body)
"Add `hjkl' navigation, search and visual state to MAP and set additional
bindings contained in BODY."
Expand Down
6 changes: 5 additions & 1 deletion spacemacs/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,11 @@ determine the state to enable when escaping from the insert state.")
;; experimental: invoke leader with "jk" in insert mode
(when dotspacemacs-feature-toggle-leader-on-jk
(key-chord-define evil-insert-state-map (kbd "jk")
evil-leader--default-map)))))
evil-leader--default-map))
;; experimental: map SPC m to ,
(when dotspacemacs-major-mode-leader-key
(add-hook 'after-change-major-mode-hook 'spacemacs/activate-major-mode-leader))
)))

(defun spacemacs/init-evil-lisp-state ()
(use-package evil-lisp-state
Expand Down