diff --git a/contrib/pcre2el/packages.el b/contrib/pcre2el/packages.el index 2a83aa55f..cf22d7e10 100644 --- a/contrib/pcre2el/packages.el +++ b/contrib/pcre2el/packages.el @@ -11,8 +11,7 @@ :init (progn ;; - (define-prefix-command 'pcre2el-prefix) - (evil-leader/set-key "R" 'pcre2el-prefix) + (spacemacs/declare-prefix "R" "pcre2el") (evil-leader/set-key "R/" 'rxt-explain "Rc" 'rxt-convert-syntax diff --git a/contrib/perspectives/packages.el b/contrib/perspectives/packages.el index 6a183e369..52f2d1faf 100644 --- a/contrib/perspectives/packages.el +++ b/contrib/perspectives/packages.el @@ -34,10 +34,8 @@ which require an initialization must be listed explicitly in the list.") (custom-persp "@org" (find-file (first org-agenda-files)))) - (define-prefix-command 'perspectives-prefix) - (evil-leader/set-key "P" 'perspectives-prefix) - (define-prefix-command 'perspectives-custom-prefix) - (evil-leader/set-key "Po" 'perspectives-custom-prefix) + (spacemacs/declare-prefix "P" "perspectives") + (spacemacs/declare-prefix "Po" "custom-perspectives") (evil-leader/set-key "Pa" 'persp-add-buffer "PA" 'persp-set-buffer diff --git a/spacemacs/config.el b/spacemacs/config.el index d9b417933..e0a441ea0 100644 --- a/spacemacs/config.el +++ b/spacemacs/config.el @@ -1,3 +1,37 @@ +(setq spacemacs/key-binding-prefixes '(("a" . "applications") + ("as" . "applications-shells") + ("b" . "buffers") + ("bm" . "buffers-move") + ("c" . "comments") + ("e" . "errors") + ("f" . "files") + ("fe" . "files-emacs/spacemacs") + ("g" . "git/versions-control") + ("gc" . "smeargle") + ("h" . "helm/help/highlight") + ("hd" . "help-describe") + ("i" . "insertion") + ("j" . "join/split") + ("n" . "narrow/numbers") + ("p" . "projects") + ("p4" . "perforce") + ("r" . "registers/rings") + ("s" . "search/symbol") + ("sr" . "symbol-range") + ("S" . "spelling") + ("t" . "toggles") + ("tm" . "toggles-modeline") + ("T" . "themes") + ("w" . "windows") + ("wp" . "windows-popup") + ("ws" . "windows-size") + ("x" . "text") + ("xd" . "text-delete") + ("xg" . "text-google-translate") + ("xm" . "text-move") + ("xt" . "text-transpose") + ("xw" . "text-words") + ("z" . "z"))) ;; --------------------------------------------------------------------------- ;; Navigation ;; --------------------------------------------------------------------------- diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el index 14bc7711a..057697b88 100644 --- a/spacemacs/funcs.el +++ b/spacemacs/funcs.el @@ -48,6 +48,16 @@ (defun system-is-mswindows () (string-equal system-type "windows-nt")) +(defvar spacemacs/prefix-command-string "group:" + "Prefix string for prefix commands.") + +(defun spacemacs/declare-prefix (prefix name) + "Declare a prefix PREFIX. PREFIX is a string describing +a key sequence. NAME is a symbol name used as the prefix command." + (let ((command (intern (concat spacemacs/prefix-command-string name)))) + (define-prefix-command command) + (evil-leader/set-key prefix command))) + ;; From http://stackoverflow.com/a/18796138 ;; Cycle through this set of themes (defvar spacemacs-themes '(solarized-light diff --git a/spacemacs/packages.el b/spacemacs/packages.el index ec551c78b..049ef793c 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -619,43 +619,8 @@ determine the state to enable when escaping from the insert state.") evil-leader/leader "SPC" evil-leader/non-normal-prefix "s-") ;; give name to spacemacs prefixes - (dolist (x '(("a" . "applications") - ("as" . "applications-shells") - ("b" . "buffers") - ("bm" . "buffers-move") - ("c" . "comments") - ("e" . "errors") - ("f" . "files") - ("fe" . "files-emacs/spacemacs") - ("g" . "git/versions-control") - ("gc" . "smeargle") - ("h" . "helm/help/highlight") - ("hd" . "help-describe") - ("i" . "insert") - ("j" . "join/split") - ("n" . "narrow/numbers") - ("p" . "projects") - ("p4" . "perforce") - ("r" . "registers/rings") - ("s" . "search/symbol") - ("sr" . "symbol-range") - ("S" . "spelling") - ("t" . "toggles") - ("tm" . "toggles-modeline") - ("w" . "windows") - ("wp" . "windows-popup") - ("ws" . "windows-size") - ("x" . "text") - ("xd" . "text-delete") - ("xg" . "text-google-translate") - ("xm" . "text-move") - ("xt" . "text-transpose") - ("xw" . "text-words") - ("z" . "z"))) - (let ((key (car x)) - (prefix-command (intern (format "%s-prefix" (cdr x))))) - (define-prefix-command prefix-command) - (evil-leader/set-key key prefix-command))) + (mapc (lambda (x) (spacemacs/declare-prefix (car x) (cdr x))) + spacemacs/key-binding-prefixes) (global-evil-leader-mode)) :config (progn @@ -1135,6 +1100,8 @@ determine the state to enable when escaping from the insert state.") ;; graphical envrionment ;; guide-key-tip/enabled (if window-system t) guide-key-tip/enabled nil) + (setq guide-key/highlight-command-regexp + (cons spacemacs/prefix-command-string font-lock-warning-face)) (guide-key-mode 1) (spacemacs//diminish guide-key-mode " Ⓖ"))))