diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index 120f35a09..eb9dd15e8 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -116,6 +116,9 @@ pressing ` m`. Set it to `nil` to disable it.") (defvar dotspacemacs-major-mode-emacs-leader-key "C-M-m" "Major mode leader key accessible in `emacs state' and `insert state'") +(defvar dotspacemacs-emacs-command-key "SPC" + "The key used for Emacs commands (M-x) (after pressing on the leader key).") + (defvar dotspacemacs-distinguish-gui-tab nil "If non nil, distinguish C-i and tab in the GUI version of emacs.") @@ -132,11 +135,6 @@ emacs.") "Default font. `powerline-scale' allows to quickly tweak the mode-line size to make separators look not too crappy.") -(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 -with `:' and Emacs commands are executed with ` :'.") - (defvaralias 'dotspacemacs-remap-Y-to-y$ 'evil-want-Y-yank-to-eol "If non nil `Y' is remapped to `y$'.") @@ -533,7 +531,7 @@ error recovery." (spacemacs//test-var (lambda (x) (or (null x) (stringp x))) 'dotspacemacs-major-mode-emacs-leader-key "is a string or nil") - (spacemacs//test-var 'stringp 'dotspacemacs-command-key "is a string") + (spacemacs//test-var 'stringp 'dotspacemacs-emacs-command-key "is a string") (insert (format (concat "** RESULTS: " "[[file:%s::dotspacemacs/init][dotspacemacs/init]] " diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 91688a1ed..3922fae6c 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -120,6 +120,9 @@ values." ;; Major mode leader key accessible in `emacs state' and `insert state'. ;; (default "C-M-m) dotspacemacs-major-mode-emacs-leader-key "C-M-m" + ;; The key used for Emacs commands (M-x) (after pressing on the leader key). + ;; (default "SPC") + dotspacemacs-emacs-command-key "SPC" ;; These variables control whether separate commands are bound in the GUI to ;; the key pairs C-i, TAB and C-m, RET. ;; Setting it to a non-nil value, allows for separate commands under @@ -128,11 +131,6 @@ values." ;; works in the GUI. (default nil) dotspacemacs-distinguish-gui-tab nil ;; (Not implemented) dotspacemacs-distinguish-gui-ret nil - ;; The command 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 - ;; with `:' and Emacs commands are executed with ` :'. - dotspacemacs-command-key ":" ;; If non nil `Y' is remapped to `y$'. (default t) dotspacemacs-remap-Y-to-y$ t ;; Name of the default layout (default "Default") diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index f192ad86c..d62541e00 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -1161,12 +1161,11 @@ state= to press quickly ~jj~ and inadvertently escape to =normal state=. | Command | Key Binding | |------------------+-------------| | Vim (ex-command) | ~:~ | -| Emacs (M-x) | ~SPC :~ | +| Emacs (M-x) | ~SPC SPC~ | + +The emacs command key ~SPC~ (executed after the leader key) can be changed +with the variable =dotspacemacs-emacs-command-key= of your =~/.spacemacs=. -The command key ~:~ can be easily changed with the variable -=dotspacemacs-command-key= of your =~/.spacemacs=. Note that is will change both -~:~ and ~SPC :~ bindings to keep the symmetry between Vim and Emacs. A good key -can be ~,~ for example. *** Leader key On top of =Vim= modes (modes are called states in Spacemacs) there is a diff --git a/layers/+distribution/spacemacs-base/packages.el b/layers/+distribution/spacemacs-base/packages.el index d762d8d72..571832cce 100644 --- a/layers/+distribution/spacemacs-base/packages.el +++ b/layers/+distribution/spacemacs-base/packages.el @@ -226,10 +226,6 @@ (progn ;; bind function keys - ;; evil ex-command key - (define-key evil-normal-state-map (kbd dotspacemacs-command-key) 'evil-ex) - (define-key evil-visual-state-map (kbd dotspacemacs-command-key) 'evil-ex) - (define-key evil-motion-state-map (kbd dotspacemacs-command-key) 'evil-ex) ;; Make the current definition and/or comment visible. (define-key evil-normal-state-map "zf" 'reposition-window) ;; toggle maximize buffer @@ -695,7 +691,8 @@ Removes the automatic guessing of the initial value based on thing at point. " (add-hook 'emacs-startup-hook (lambda () (unless (configuration-layer/package-usedp 'smex) - (spacemacs/set-leader-keys dotspacemacs-command-key 'helm-M-x)))) + (spacemacs/set-leader-keys + dotspacemacs-emacs-command-key 'helm-M-x)))) (defun spacemacs//hide-cursor-in-helm-buffer () "Hide the cursor in helm buffers." @@ -1493,7 +1490,7 @@ ARG non nil means that the editing style is `vim'." (dolist (leader-key `(,dotspacemacs-leader-key ,dotspacemacs-emacs-leader-key)) (which-key-add-key-based-replacements (concat leader-key " m") "major mode commands" - (concat leader-key " " dotspacemacs-command-key) "M-x")) + (concat leader-key " " dotspacemacs-emacs-command-key) "M-x")) (which-key-declare-prefixes dotspacemacs-leader-key '("root" . "Spacemacs root") dotspacemacs-emacs-leader-key '("root" . "Spacemacs root") diff --git a/layers/smex/packages.el b/layers/smex/packages.el index 7c13ff1d1..82acbdbc5 100644 --- a/layers/smex/packages.el +++ b/layers/smex/packages.el @@ -36,7 +36,7 @@ ;; define the key binding at the very end in order to allow the user ;; to overwrite any key binding (add-hook 'emacs-startup-hook - (lambda () (spacemacs/set-leader-keys dotspacemacs-command-key - 'spacemacs/smex))) + (lambda () (spacemacs/set-leader-keys + dotspacemacs-emacs-command-key 'spacemacs/smex))) (spacemacs/set-leader-keys ":" 'spacemacs/smex-major-mode-commands) - (global-set-key (kbd "M-x") 'spacemacs/smex)))) + (global-set-key (kbd "M-x") 'spacemacs/smex))))