From be11d4400996c2862c5d839733b3277d9c63b9bf Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Wed, 10 Dec 2014 22:12:19 -0500 Subject: [PATCH] Fixes #236 custom ex-command and M-x command key New variable: dotspacemacs-command-key --- contrib/smex/packages.el | 2 +- core/dotspacemacs.el | 5 +++++ core/templates/.spacemacs.template | 5 +++++ spacemacs/packages.el | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/contrib/smex/packages.el b/contrib/smex/packages.el index 675a7dfc4..e6997bf0b 100644 --- a/contrib/smex/packages.el +++ b/contrib/smex/packages.el @@ -32,7 +32,7 @@ which require an initialization must be listed explicitly in the list.") (key-chord-define ido-completion-map (kbd "jk") (cdr (assoc 'ido-mode evil-leader--mode-maps)))) - (evil-leader/set-key ":" 'spacemacs/smex) + (evil-leader/set-key dotspacemacs-command-key 'spacemacs/smex) (evil-leader/set-key "m:" 'spacemacs/smex-major-mode-commands) (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "M-X") 'smex) diff --git a/core/dotspacemacs.el b/core/dotspacemacs.el index 64a64dcb3..cfb73f581 100644 --- a/core/dotspacemacs.el +++ b/core/dotspacemacs.el @@ -13,6 +13,11 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')" (defvar dotspacemacs-leader-key "SPC" "The leader key.") +(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 ` :'.") + (defvar dotspacemacs-guide-key-delay 0.4 "Guide-key delay in seconds.") diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 8f8dbb362..bc65db6d0 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -23,6 +23,11 @@ dotspacemacs-default-theme 'solarized-light ;; The leader key dotspacemacs-leader-key "SPC" + ;; 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 ":" ;; Guide-key delay in seconds. The Guide-key is the popup buffer listing ;; the commands bound to the current keystrokes. dotspacemacs-guide-key-delay 0.4 diff --git a/spacemacs/packages.el b/spacemacs/packages.el index a4cbd97f0..50d60350b 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -602,6 +602,8 @@ determine the state to enable when escaping from the insert state.") (let ((state (intern (format "evil-%s-state" spacemacs-last-base-state)))) (funcall state)))) + ;; evil ex-command key + (global-set-key (kbd dotspacemacs-command-key) 'evil-ex) ;; Make evil-mode up/down operate in screen lines instead of logical lines (define-key evil-normal-state-map "j" 'evil-next-visual-line) (define-key evil-normal-state-map "k" 'evil-previous-visual-line) @@ -1149,7 +1151,7 @@ determine the state to enable when escaping from the insert state.") helm-buffers-fuzzy-matching t helm-always-two-windows t) (evil-leader/set-key - ":" 'helm-M-x + dotspacemacs-command-key 'helm-M-x "bs" 'helm-mini "sl" 'helm-semantic-or-imenu "hb" 'helm-bookmarks