Add function for easy declaration of prefix commands
This commit is contained in:
parent
f1097647da
commit
cac038ab4b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
;; ---------------------------------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 " Ⓖ"))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue