spacemacs(-base): Translate micro-states to use new macro
1. spacemacs: scroll 2. spacemacs-base: paste 3. spacemacs-base: macrostep 4. spacemacs-base: transparency 5. spacemacs-base: scale-font 6. spacemacs-base: wind-manip 7. spacemacs-base: buffer 8. spacemacs: symbol-highlight 9. spacemacs: move-text 10. spacemacs: zoom-frm 11. spacemacs: evil-numbers
This commit is contained in:
parent
13c41947b1
commit
dbd9725c39
|
@ -134,6 +134,10 @@ used."
|
|||
"Return the name of the micro-state function."
|
||||
(intern (format "spacemacs/%S-micro-state" name)))
|
||||
|
||||
(defun spacemacs//micro-state-body-func-name (name)
|
||||
"Return the name of the micro-state function."
|
||||
(intern (format "spacemacs/%S-micro-state/body" name)))
|
||||
|
||||
(defun spacemacs//micro-state-auto-execute (bindings)
|
||||
"Auto execute the binding corresponding to `this-command-keys'."
|
||||
`(let* ((key (substring (this-command-keys)
|
||||
|
@ -303,6 +307,7 @@ All properties supported by `spacemacs//create-key-binding-form' can be
|
|||
used."
|
||||
(declare (indent 1))
|
||||
(let* ((func (spacemacs//micro-state-func-name name))
|
||||
(body-func (spacemacs//micro-state-body-func-name name))
|
||||
(entry-binding (spacemacs/mplist-get props :entry-binding))
|
||||
(bindings (spacemacs/mplist-get props :bindings))
|
||||
(doc (or (plist-get props :doc) "\n"))
|
||||
|
@ -311,7 +316,7 @@ used."
|
|||
(exit-sexp (plist-get props :on-exit))
|
||||
(hint (plist-get props :hint))
|
||||
(foreign-keys (plist-get props :foreign-keys))
|
||||
(bindkeys (spacemacs//create-key-binding-form props func)))
|
||||
(bindkeys (spacemacs//create-key-binding-form props body-func)))
|
||||
`(progn
|
||||
(defhydra ,func
|
||||
(,(car entry-binding) ,(cadr entry-binding)
|
||||
|
|
|
@ -371,16 +371,14 @@
|
|||
|
||||
;; Buffer micro state
|
||||
|
||||
(spacemacs|define-micro-state buffer
|
||||
:doc "[n]ext [p]revious [K]ill [q]uit"
|
||||
:disable-evil-leader t
|
||||
:evil-leader "b."
|
||||
(spacemacs|define-micro-state-2 buffer
|
||||
:bindings
|
||||
("K" kill-this-buffer)
|
||||
("n" spacemacs/next-useful-buffer)
|
||||
("N" spacemacs/previous-useful-buffer)
|
||||
("p" spacemacs/previous-useful-buffer)
|
||||
("q" nil :exit t))
|
||||
("n" spacemacs/next-useful-buffer "next")
|
||||
("N" spacemacs/previous-useful-buffer "previous")
|
||||
("p" spacemacs/previous-useful-buffer "previous")
|
||||
("K" kill-this-buffer "kill")
|
||||
("q" nil "quit" :exit t))
|
||||
(spacemacs/set-leader-keys "b." 'spacemacs/buffer-micro-state/body)
|
||||
|
||||
;; end of Buffer micro state
|
||||
|
||||
|
@ -406,104 +404,66 @@
|
|||
(interactive "p")
|
||||
(enlarge-window delta t))
|
||||
|
||||
(defun spacemacs//window-manipulation-full-doc ()
|
||||
"Full documentation for window manipulation micro-state."
|
||||
(spacemacs|define-micro-state-2 window-manipulation
|
||||
:doc
|
||||
"
|
||||
[?] display this help
|
||||
[0,9] go to numbered window
|
||||
[-] [/] [s] [v] [S] [V] split windows below|right and focus
|
||||
[c] [C] close current|other windows
|
||||
[g] toggle golden-ratio
|
||||
[h] [j] [k] [l] go to left|bottom|top|right
|
||||
[H] [J] [K] [L] move windows to far/very left|bottom|top|right
|
||||
[[] []] [{] [}] shrink/enlarge horizontally and vertically respectively
|
||||
[o] [w] other frame|window
|
||||
[R] rotate windows
|
||||
[u] [U] restore previous|next window layout")
|
||||
|
||||
(defun spacemacs//window-manipulation-move-doc ()
|
||||
"Help string for moving between windows"
|
||||
(concat "[h] [j] [k] [l] to move focus, "
|
||||
"[H] [J] [K] [L] to move window, "
|
||||
"[R]otate windows, other [f]rame, other [w]indow"))
|
||||
|
||||
(defun spacemacs//window-manipulation-resize-doc ()
|
||||
"Dynamic help string when resizing windows."
|
||||
(format
|
||||
(concat "[%sx%s] Resize window: [[] []] shrink/enlarge horizontally, "
|
||||
"[{] [}] shrink/enlarge vertically.")
|
||||
(window-total-width) (window-total-height)))
|
||||
|
||||
(defun spacemacs//window-manipulation-split-doc ()
|
||||
"Help string for moving between windows"
|
||||
(concat "[-], [s] to split horizontally, [/], [v] to split vertically, "
|
||||
"[S], [V] to split and focus"))
|
||||
|
||||
(defun spacemacs//window-manipulation-number-doc ()
|
||||
"Help string for selecting window with number."
|
||||
(format "(selected window #%s) press [0,9] to select the corresponding numbered window."
|
||||
(window-numbering-get-number-string)))
|
||||
|
||||
(defun spacemacs//window-manipulation-layout-doc ()
|
||||
"Help string for layout manipulation"
|
||||
(concat "[c]lose window, [C]lose other windows, "
|
||||
"[u]ndo window layout, [U] redo window layout."))
|
||||
|
||||
(defun spacemacs//window-manipulation-gratio-doc ()
|
||||
"Help string for golden ratio"
|
||||
(format "(golden-ratio %s) toggle with [g]"
|
||||
(if (symbol-value golden-ratio-mode) "enabled" "disabled")))
|
||||
|
||||
(spacemacs|define-micro-state window-manipulation
|
||||
:doc "[?] for help"
|
||||
:evil-leader "w."
|
||||
:use-minibuffer t
|
||||
^^^^ Go to/Move Window
|
||||
^^^^ -----------------
|
||||
^^ _k_/_K_^^ [_0_,_9_] go to window N [_s_/_S_] split horizontally/and focus
|
||||
^^^^ |^^^^ [_o_/_w_] go to other frame/window [_v_/_V_] split vertically/and focus
|
||||
_h_/_H_ --+-- _l_/_L_ [_u_/_U_] restore prev/next layout [_[_/_]_] shrink/enlarge horizontally
|
||||
^^^^ |^^^^ [_R_]^^ rotate windows [_{_/_}_] shrink/enlarge horizontally
|
||||
^^ _j_/_J_^^ [_g_]^^ toggle golden-ratio [_c_/_C_] close current/other windows
|
||||
^^^^^^^^ [_q_]^^ quit
|
||||
"
|
||||
:bindings
|
||||
("?" nil :doc (spacemacs//window-manipulation-full-doc))
|
||||
("0" select-window-0 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("1" select-window-1 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("2" select-window-2 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("3" select-window-3 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("4" select-window-4 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("5" select-window-5 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("6" select-window-6 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("7" select-window-7 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("8" select-window-8 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("9" select-window-9 :doc (spacemacs//window-manipulation-number-doc))
|
||||
("-" split-window-below-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
||||
("/" split-window-right-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
||||
("[" spacemacs/shrink-window-horizontally :doc (spacemacs//window-manipulation-resize-doc))
|
||||
("]" spacemacs/enlarge-window-horizontally :doc (spacemacs//window-manipulation-resize-doc))
|
||||
("{" spacemacs/shrink-window :doc (spacemacs//window-manipulation-resize-doc))
|
||||
("}" spacemacs/enlarge-window :doc (spacemacs//window-manipulation-resize-doc))
|
||||
("c" delete-window :doc (spacemacs//window-manipulation-layout-doc))
|
||||
("C" delete-other-windows :doc (spacemacs//window-manipulation-layout-doc))
|
||||
("g" spacemacs/toggle-golden-ratio :doc (spacemacs//window-manipulation-gratio-doc))
|
||||
("h" evil-window-left :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<left>" evil-window-left :doc (spacemacs//window-manipulation-move-doc))
|
||||
("j" evil-window-down :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<down>" evil-window-down :doc (spacemacs//window-manipulation-move-doc))
|
||||
("k" evil-window-up :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<up>" evil-window-up :doc (spacemacs//window-manipulation-move-doc))
|
||||
("l" evil-window-right :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<right>" evil-window-right :doc (spacemacs//window-manipulation-move-doc))
|
||||
("H" evil-window-move-far-left :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<S-left>" evil-window-move-far-left :doc (spacemacs//window-manipulation-move-doc))
|
||||
("J" evil-window-move-very-bottom :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<S-down>" evil-window-move-very-bottom :doc (spacemacs//window-manipulation-move-doc))
|
||||
("K" evil-window-move-very-top :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<S-up>" evil-window-move-very-top :doc (spacemacs//window-manipulation-move-doc))
|
||||
("L" evil-window-move-far-right :doc (spacemacs//window-manipulation-move-doc))
|
||||
("<S-right>" evil-window-move-far-right :doc (spacemacs//window-manipulation-move-doc))
|
||||
("o" other-frame :doc (spacemacs//window-manipulation-move-doc))
|
||||
("R" spacemacs/rotate-windows :doc (spacemacs//window-manipulation-move-doc))
|
||||
("s" split-window-below :doc (spacemacs//window-manipulation-split-doc))
|
||||
("S" split-window-below-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
||||
("u" winner-undo :doc (spacemacs//window-manipulation-layout-doc))
|
||||
("U" winner-redo :doc (spacemacs//window-manipulation-layout-doc))
|
||||
("v" split-window-right :doc (spacemacs//window-manipulation-split-doc))
|
||||
("V" split-window-right-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
||||
("w" other-window :doc (spacemacs//window-manipulation-move-doc)))
|
||||
("q" nil :exit t)
|
||||
("0" select-window-0)
|
||||
("1" select-window-1)
|
||||
("2" select-window-2)
|
||||
("3" select-window-3)
|
||||
("4" select-window-4)
|
||||
("5" select-window-5)
|
||||
("6" select-window-6)
|
||||
("7" select-window-7)
|
||||
("8" select-window-8)
|
||||
("9" select-window-9)
|
||||
("-" split-window-below-and-focus)
|
||||
("/" split-window-right-and-focus)
|
||||
("[" spacemacs/shrink-window-horizontally)
|
||||
("]" spacemacs/enlarge-window-horizontally)
|
||||
("{" spacemacs/shrink-window)
|
||||
("}" spacemacs/enlarge-window)
|
||||
("c" delete-window)
|
||||
("C" delete-other-windows)
|
||||
("g" spacemacs/toggle-golden-ratio)
|
||||
("h" evil-window-left)
|
||||
("<left>" evil-window-left)
|
||||
("j" evil-window-down)
|
||||
("<down>" evil-window-down)
|
||||
("k" evil-window-up)
|
||||
("<up>" evil-window-up)
|
||||
("l" evil-window-right)
|
||||
("<right>" evil-window-right)
|
||||
("H" evil-window-move-far-left)
|
||||
("<S-left>" evil-window-move-far-left)
|
||||
("J" evil-window-move-very-bottom)
|
||||
("<S-down>" evil-window-move-very-bottom)
|
||||
("K" evil-window-move-very-top)
|
||||
("<S-up>" evil-window-move-very-top)
|
||||
("L" evil-window-move-far-right)
|
||||
("<S-right>" evil-window-move-far-right)
|
||||
("o" other-frame)
|
||||
("R" spacemacs/rotate-windows)
|
||||
("s" split-window-below)
|
||||
("S" split-window-below-and-focus)
|
||||
("u" winner-undo)
|
||||
("U" winner-redo)
|
||||
("v" split-window-right)
|
||||
("V" split-window-right-and-focus)
|
||||
("w" other-window))
|
||||
(spacemacs/set-leader-keys "w."
|
||||
'spacemacs/window-manipulation-micro-state/body)
|
||||
|
||||
;; end of Window Manipulation Micro State
|
||||
|
||||
|
@ -535,15 +495,15 @@ otherwise it is scaled down."
|
|||
(interactive)
|
||||
(spacemacs/scale-up-or-down-font-size 0))
|
||||
|
||||
(spacemacs|define-micro-state scale-font
|
||||
:doc "[+/=] scale up [-] scale down [0] reset font [q]uit"
|
||||
:evil-leader "zx"
|
||||
(spacemacs|define-micro-state-2 scale-font
|
||||
:doc "\n[_+_/_=_] scale up [_-_] scale down [_0_] reset font [_q_] quit"
|
||||
:bindings
|
||||
("+" spacemacs/scale-up-font)
|
||||
("=" spacemacs/scale-up-font)
|
||||
("-" spacemacs/scale-down-font)
|
||||
("0" spacemacs/reset-font-size)
|
||||
("q" nil :exit t))
|
||||
(spacemacs/set-leader-keys "zx" 'spacemacs/scale-font-micro-state/body)
|
||||
|
||||
;; end of Text Manipulation Micro State
|
||||
|
||||
|
@ -560,10 +520,7 @@ otherwise it is scaled down."
|
|||
frame 'alpha
|
||||
(if (not (equal alpha dotfile-setting))
|
||||
dotfile-setting
|
||||
'(100 . 100))))
|
||||
;; Immediately enter the micro-state, but also keep toggle
|
||||
;; accessible from helm-spacemacs-help
|
||||
(spacemacs/scale-transparency-micro-state))
|
||||
'(100 . 100)))))
|
||||
|
||||
(defun spacemacs/increase-transparency ()
|
||||
"Increase transparency of current frame."
|
||||
|
@ -583,12 +540,13 @@ otherwise it is scaled down."
|
|||
(set-frame-parameter (selected-frame) 'alpha
|
||||
(cons decreased-alpha decreased-alpha)))))
|
||||
|
||||
(spacemacs|define-micro-state scale-transparency
|
||||
:doc "[+] increase [-] decrease [T] toggle transparency [q] quit"
|
||||
(spacemacs|define-micro-state-2 scale-transparency
|
||||
:bindings
|
||||
("+" spacemacs/increase-transparency)
|
||||
("-" spacemacs/decrease-transparency)
|
||||
("T" spacemacs/toggle-transparency)
|
||||
("q" nil :exit t))
|
||||
("+" spacemacs/increase-transparency "increase")
|
||||
("-" spacemacs/decrease-transparency "decrease")
|
||||
("T" spacemacs/toggle-transparency "toggle")
|
||||
("q" nil "quit" :exit t))
|
||||
(spacemacs/set-leader-keys "TT"
|
||||
'spacemacs/scale-transparency-micro-state/spacemacs/toggle-transparency)
|
||||
|
||||
;; end of Transparency Micro State
|
||||
|
|
|
@ -323,56 +323,32 @@ Example: (evil-map visual \"<\" \"<gv\")"
|
|||
(evil-next-visual-line)
|
||||
(let ((recenter-redisplay nil))
|
||||
(recenter nil)))
|
||||
(spacemacs|define-micro-state scroll
|
||||
:doc "[,] page up [.] page down [<] half page up [>] half page down"
|
||||
:execute-binding-on-enter t
|
||||
:evil-leader "n." "n," "n<" "n>"
|
||||
(spacemacs|define-micro-state-2 scroll
|
||||
:bindings
|
||||
;; page
|
||||
("," evil-scroll-page-up)
|
||||
("." evil-scroll-page-down)
|
||||
("," evil-scroll-page-up "page up")
|
||||
("." evil-scroll-page-down "page down")
|
||||
;; half page
|
||||
("<" spacemacs/scroll-half-page-up)
|
||||
(">" spacemacs/scroll-half-page-down))
|
||||
|
||||
;; support for auto-indentation inhibition on universal argument
|
||||
(spacemacs|advise-commands
|
||||
"handle-indent" (evil-paste-before evil-paste-after) around
|
||||
"Handle the universal prefix argument for auto-indentation."
|
||||
(let ((prefix (ad-get-arg 0)))
|
||||
(ad-set-arg 0 (unless (equal '(4) prefix) prefix))
|
||||
ad-do-it
|
||||
(ad-set-arg 0 prefix)))
|
||||
("<" spacemacs/scroll-half-page-up "half page up")
|
||||
(">" spacemacs/scroll-half-page-down "half page down"))
|
||||
(spacemacs/set-leader-keys
|
||||
"n," 'spacemacs/scroll-micro-state/evil-scroll-page-up
|
||||
"n." 'spacemacs/scroll-micro-state/evil-scroll-page-down
|
||||
"n<" 'spacemacs/scroll-micro-state/spacemacs/scroll-half-page-up
|
||||
"n>" 'spacemacs/scroll-micro-state/spacemacs/scroll-half-page-down)
|
||||
|
||||
;; pasting micro-state
|
||||
(spacemacs|advise-commands
|
||||
"paste-micro-state"
|
||||
(evil-paste-before evil-paste-after evil-visual-paste) after
|
||||
"Initate the paste micro-state."
|
||||
(unless (or (evil-ex-p)
|
||||
(eq 'evil-paste-from-register this-command))
|
||||
(spacemacs/paste-micro-state)))
|
||||
(defun spacemacs//paste-ms-doc ()
|
||||
"The documentation for the paste micro-state."
|
||||
(format (concat "[%s/%s] Type [p] or [P] to paste the previous or "
|
||||
"next copied text, [.] to paste the same text")
|
||||
(length kill-ring-yank-pointer) (length kill-ring)))
|
||||
(spacemacs|define-micro-state paste
|
||||
:doc (spacemacs//paste-ms-doc)
|
||||
:use-minibuffer t
|
||||
(spacemacs|define-micro-state-2 paste
|
||||
:doc "\n[%s(length kill-ring-yank-pointer)/%s(length kill-ring)] \
|
||||
[_J_/_K_] cycles through yanked text, [_p_/_P_] pastes the same text above or \
|
||||
below. Anything else exits."
|
||||
:bindings
|
||||
("p" evil-paste-pop)
|
||||
("P" evil-paste-pop-next))
|
||||
(unless dotspacemacs-enable-paste-micro-state
|
||||
(ad-disable-advice 'evil-paste-before 'after
|
||||
'evil-paste-before-paste-micro-state)
|
||||
(ad-activate 'evil-paste-before)
|
||||
(ad-disable-advice 'evil-paste-after 'after
|
||||
'evil-paste-after-paste-micro-state)
|
||||
(ad-activate 'evil-paste-after)
|
||||
(ad-disable-advice 'evil-visual-paste 'after
|
||||
'evil-visual-paste-paste-micro-state)
|
||||
(ad-activate 'evil-visual-paste))
|
||||
("J" evil-paste-pop)
|
||||
("K" evil-paste-pop-next)
|
||||
("p" evil-paste-after)
|
||||
("P" evil-paste-before))
|
||||
(when dotspacemacs-enable-paste-micro-state
|
||||
(define-key evil-normal-state-map "p" 'spacemacs/paste-micro-state/evil-paste-after)
|
||||
(define-key evil-normal-state-map "P" 'spacemacs/paste-micro-state/evil-paste-before))
|
||||
|
||||
;; define text objects
|
||||
(defmacro spacemacs|define-text-object (key name start end)
|
||||
|
@ -702,13 +678,12 @@ Example: (evil-map visual \"<\" \"<gv\")"
|
|||
[v] open in a new vertical split
|
||||
[q] quit")
|
||||
|
||||
(spacemacs|define-micro-state ido-navigation
|
||||
:persistent t
|
||||
:disable-evil-leader t
|
||||
(spacemacs|define-micro-state-2 ido-navigation
|
||||
:foreign-keys run
|
||||
:on-enter (spacemacs//ido-navigation-ms-on-enter)
|
||||
:on-exit (spacemacs//ido-navigation-ms-on-exit)
|
||||
:bindings
|
||||
("?" nil :doc (spacemacs//ido-navigation-ms-full-doc))
|
||||
;;("?" nil (spacemacs//ido-navigation-ms-full-doc))
|
||||
("<RET>" ido-exit-minibuffer :exit t)
|
||||
("<escape>" nil :exit t)
|
||||
("e" ido-select-text :exit t)
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
(if spacemacs-last-ahs-highlight-p
|
||||
(progn (goto-char (nth 1 spacemacs-last-ahs-highlight-p))
|
||||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(spacemacs/symbol-highlight-micro-state))
|
||||
(spacemacs/symbol-highlight-micro-state/body))
|
||||
(message "No symbol has been searched for now.")))
|
||||
|
||||
(defun spacemacs/integrate-evil-search (forward)
|
||||
|
@ -281,17 +281,15 @@
|
|||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(when (configuration-layer/package-usedp 'evil-jumper)
|
||||
(evil-set-jump))
|
||||
(spacemacs/symbol-highlight-micro-state)
|
||||
(ahs-forward)
|
||||
)
|
||||
(spacemacs/symbol-highlight-micro-state/body)
|
||||
(ahs-forward))
|
||||
(progn
|
||||
(spacemacs/integrate-evil-search nil)
|
||||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(when (configuration-layer/package-usedp 'evil-jumper)
|
||||
(evil-set-jump))
|
||||
(spacemacs/symbol-highlight-micro-state)
|
||||
(ahs-backward)
|
||||
)))
|
||||
(spacemacs/symbol-highlight-micro-state/body)
|
||||
(ahs-backward))))
|
||||
|
||||
(with-eval-after-load 'evil
|
||||
(define-key evil-motion-state-map (kbd "*")
|
||||
|
@ -304,7 +302,7 @@
|
|||
(interactive)
|
||||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(setq spacemacs-last-ahs-highlight-p (ahs-highlight-p))
|
||||
(spacemacs/symbol-highlight-micro-state)
|
||||
(spacemacs/symbol-highlight-micro-state/body)
|
||||
(spacemacs/integrate-evil-search nil))
|
||||
|
||||
(defun spacemacs//ahs-ms-on-exit ()
|
||||
|
@ -335,38 +333,44 @@
|
|||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(setq spacemacs-last-ahs-highlight-p (ahs-highlight-p))))))
|
||||
|
||||
(spacemacs|define-micro-state symbol-highlight
|
||||
:doc (let* ((i 0)
|
||||
(overlay-count (length ahs-overlay-list))
|
||||
(overlay (format "%s" (nth i ahs-overlay-list)))
|
||||
(current-overlay (format "%s" ahs-current-overlay))
|
||||
(st (ahs-stat))
|
||||
(plighter (ahs-current-plugin-prop 'lighter))
|
||||
(plugin (format " <%s> " (cond ((string= plighter "HS") "D")
|
||||
((string= plighter "HSA") "B")
|
||||
((string= plighter "HSD") "F"))))
|
||||
(propplugin (propertize plugin 'face
|
||||
`(:foreground "#ffffff"
|
||||
:background ,(face-attribute
|
||||
'ahs-plugin-defalt-face :foreground)))))
|
||||
(while (not (string= overlay current-overlay))
|
||||
(setq i (1+ i))
|
||||
(setq overlay (format "%s" (nth i ahs-overlay-list))))
|
||||
(let* ((x/y (format "(%s/%s)" (- overlay-count i) overlay-count))
|
||||
(propx/y (propertize x/y 'face ahs-plugin-whole-buffer-face))
|
||||
(hidden (if (< 0 (- overlay-count (nth 4 st))) "*" ""))
|
||||
(prophidden (propertize hidden 'face '(:weight bold))))
|
||||
(format "%s %s%s [n] find next [N/p] find previous [e] edit [r] range [R] reset [d/D] definition [/] find in project [f] find in files [b] find in opened buffers [q] exit"
|
||||
propplugin propx/y prophidden)))
|
||||
:on-exit (spacemacs//ahs-ms-on-exit)
|
||||
(defun symbol-highlight-doc ()
|
||||
(let* ((i 0)
|
||||
(overlay-count (length ahs-overlay-list))
|
||||
(overlay (format "%s" (nth i ahs-overlay-list)))
|
||||
(current-overlay (format "%s" ahs-current-overlay))
|
||||
(st (ahs-stat))
|
||||
(plighter (ahs-current-plugin-prop 'lighter))
|
||||
(plugin (format " <%s> " (cond ((string= plighter "HS") "D")
|
||||
((string= plighter "HSA") "B")
|
||||
((string= plighter "HSD") "F"))))
|
||||
(propplugin (propertize plugin 'face
|
||||
`(:foreground "#ffffff"
|
||||
:background ,(face-attribute
|
||||
'ahs-plugin-defalt-face :foreground)))))
|
||||
(while (not (string= overlay current-overlay))
|
||||
(setq i (1+ i))
|
||||
(setq overlay (format "%s" (nth i ahs-overlay-list))))
|
||||
(let* ((x/y (format "(%s/%s)" (- overlay-count i) overlay-count))
|
||||
(propx/y (propertize x/y 'face ahs-plugin-whole-buffer-face))
|
||||
(hidden (if (< 0 (- overlay-count (nth 4 st))) "*" ""))
|
||||
(prophidden (propertize hidden 'face '(:weight bold))))
|
||||
(format "%s %s%s" propplugin propx/y prophidden))))
|
||||
|
||||
(defun ahs-to-iedit ()
|
||||
(interactive)
|
||||
(if (configuration-layer/package-usedp 'evil-iedit-state)
|
||||
(evil-iedit-state/iedit-mode)
|
||||
(ahs-edit-mode t)))
|
||||
|
||||
(spacemacs|define-micro-state-2 symbol-highlight
|
||||
:doc "
|
||||
%s(symbol-highlight-doc) [_n_] forward [_N_ or p] backward [_R_] restart [_e_] iedit [_b_] search buffers
|
||||
%s(make-string (length (symbol-highlight-doc)) 32) [_d_/_D_] fwd/bwd definition [_r_] change range [_/_] search proj [_f_] search files"
|
||||
:before-exit (spacemacs//ahs-ms-on-exit)
|
||||
:bindings
|
||||
("d" ahs-forward-definition)
|
||||
("D" ahs-backward-definition)
|
||||
("e" nil
|
||||
:post (if (configuration-layer/package-usedp 'evil-iedit-state)
|
||||
(evil-iedit-state/iedit-mode)
|
||||
(ahs-edit-mode t))
|
||||
:exit t)
|
||||
("e" ahs-to-iedit :exit t)
|
||||
("n" spacemacs/quick-ahs-forward)
|
||||
("N" spacemacs/quick-ahs-backward)
|
||||
("p" spacemacs/quick-ahs-backward)
|
||||
|
@ -375,7 +379,15 @@
|
|||
("/" spacemacs/helm-project-smart-do-search-region-or-symbol :exit t)
|
||||
("b" spacemacs/helm-buffers-smart-do-search-region-or-symbol :exit t)
|
||||
("f" spacemacs/helm-files-smart-do-search-region-or-symbol :exit t)
|
||||
("q" nil :exit t)))))
|
||||
("q" nil :exit t))
|
||||
|
||||
(defun spacemacs/symbol-highlight ()
|
||||
"Highlight the symbol under point with `auto-highlight-symbol'."
|
||||
(interactive)
|
||||
(spacemacs/ahs-highlight-now-wrapper)
|
||||
(setq spacemacs-last-ahs-highlight-p (ahs-highlight-p))
|
||||
(spacemacs/symbol-highlight-micro-state/body)
|
||||
(spacemacs/integrate-evil-search nil)))))
|
||||
|
||||
(defun spacemacs/init-avy ()
|
||||
(use-package avy
|
||||
|
@ -654,33 +666,16 @@
|
|||
(use-package evil-numbers
|
||||
:config
|
||||
(progn
|
||||
(defun spacemacs/evil-numbers-micro-state-doc ()
|
||||
"Display a short documentation in the mini buffer."
|
||||
(spacemacs/echo "+/= to increase the value or - to decrease it"))
|
||||
|
||||
(defun spacemacs/evil-numbers-micro-state-overlay-map ()
|
||||
"Set a temporary overlay map to easily increase or decrease a number"
|
||||
(set-temporary-overlay-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (kbd "+") 'spacemacs/evil-numbers-increase)
|
||||
(define-key map (kbd "=") 'spacemacs/evil-numbers-increase)
|
||||
(define-key map (kbd "-") 'spacemacs/evil-numbers-decrease)
|
||||
map) t)
|
||||
(spacemacs/evil-numbers-micro-state-doc))
|
||||
|
||||
(defun spacemacs/evil-numbers-increase (amount &optional no-region)
|
||||
"Increase number at point."
|
||||
(interactive "p*")
|
||||
(evil-numbers/inc-at-pt amount no-region)
|
||||
(spacemacs/evil-numbers-micro-state-overlay-map))
|
||||
(defun spacemacs/evil-numbers-decrease (amount)
|
||||
"Decrease number at point."
|
||||
(interactive "p*")
|
||||
(evil-numbers/dec-at-pt amount)
|
||||
(spacemacs/evil-numbers-micro-state-overlay-map))
|
||||
(spacemacs/set-leader-keys "n+" 'spacemacs/evil-numbers-increase)
|
||||
(spacemacs/set-leader-keys "n=" 'spacemacs/evil-numbers-increase)
|
||||
(spacemacs/set-leader-keys "n-" 'spacemacs/evil-numbers-decrease))))
|
||||
(spacemacs|define-micro-state-2 evil-numbers
|
||||
:doc "\n[_+_/_=_] increase number [_-_] decrease"
|
||||
:bindings
|
||||
("+" evil-numbers/inc-at-pt)
|
||||
("=" evil-numbers/inc-at-pt)
|
||||
("-" evil-numbers/dec-at-pt))
|
||||
(spacemacs/set-leader-keys
|
||||
"n+" 'spacemacs/evil-numbers-micro-state/evil-numbers/inc-at-pt
|
||||
"n=" 'spacemacs/evil-numbers-micro-state/evil-numbers/inc-at-pt
|
||||
"n-" 'spacemacs/evil-numbers-micro-state/evil-numbers/dec-at-pt))))
|
||||
|
||||
(defun spacemacs/init-evil-search-highlight-persist ()
|
||||
(use-package evil-search-highlight-persist
|
||||
|
@ -1188,14 +1183,13 @@ on whether the spacemacs-ivy layer is used or not, with
|
|||
(use-package move-text
|
||||
:defer t
|
||||
:init
|
||||
(spacemacs|define-micro-state move-text
|
||||
:doc "[J] move down [K] move up"
|
||||
:use-minibuffer t
|
||||
:execute-binding-on-enter t
|
||||
:evil-leader "xJ" "xK"
|
||||
(spacemacs|define-micro-state-2 move-text
|
||||
:bindings
|
||||
("J" move-text-down)
|
||||
("K" move-text-up))))
|
||||
("J" move-text-down "move down")
|
||||
("K" move-text-up "move up"))
|
||||
(spacemacs/set-leader-keys
|
||||
"xJ" 'spacemacs/move-text-micro-state/move-text-down
|
||||
"xK" 'spacemacs/move-text-micro-state/move-text-up)))
|
||||
|
||||
(defun spacemacs/init-neotree ()
|
||||
(use-package neotree
|
||||
|
@ -1628,16 +1622,16 @@ on whether the spacemacs-ivy layer is used or not, with
|
|||
zoom-frm-in)
|
||||
:init
|
||||
(progn
|
||||
(spacemacs|define-micro-state zoom-frm
|
||||
:doc "[+/=] zoom frame in [-] zoom frame out [0] reset zoom [q]uit"
|
||||
:evil-leader "zf"
|
||||
:use-minibuffer t
|
||||
(spacemacs|define-micro-state-2 zoom-frm
|
||||
:doc "
|
||||
[_+_/_=_] zoom frame in [_-_] zoom frame out [_0_] reset zoom [_q_] quit"
|
||||
:bindings
|
||||
("+" spacemacs/zoom-frm-in :post (spacemacs//zoom-frm-powerline-reset))
|
||||
("=" spacemacs/zoom-frm-in :post (spacemacs//zoom-frm-powerline-reset))
|
||||
("-" spacemacs/zoom-frm-out :post (spacemacs//zoom-frm-powerline-reset))
|
||||
("0" spacemacs/zoom-frm-unzoom :post (spacemacs//zoom-frm-powerline-reset))
|
||||
("+" spacemacs/zoom-frm-in)
|
||||
("=" spacemacs/zoom-frm-in)
|
||||
("-" spacemacs/zoom-frm-out)
|
||||
("0" spacemacs/zoom-frm-unzoom)
|
||||
("q" nil :exit t))
|
||||
(spacemacs/set-leader-keys "zf" 'spacemacs/zoom-frm-micro-state/body)
|
||||
|
||||
(defun spacemacs//zoom-frm-powerline-reset ()
|
||||
(when (fboundp 'powerline-reset)
|
||||
|
@ -1662,17 +1656,20 @@ on whether the spacemacs-ivy layer is used or not, with
|
|||
(defun spacemacs/zoom-frm-in ()
|
||||
"zoom in frame, but keep the same pixel size"
|
||||
(interactive)
|
||||
(spacemacs//zoom-frm-do 1))
|
||||
(spacemacs//zoom-frm-do 1)
|
||||
(spacemacs//zoom-frm-powerline-reset))
|
||||
|
||||
(defun spacemacs/zoom-frm-out ()
|
||||
"zoom out frame, but keep the same pixel size"
|
||||
(interactive)
|
||||
(spacemacs//zoom-frm-do -1))
|
||||
(spacemacs//zoom-frm-do -1)
|
||||
(spacemacs//zoom-frm-powerline-reset))
|
||||
|
||||
(defun spacemacs/zoom-frm-unzoom ()
|
||||
"Unzoom current frame, keeping the same pixel size"
|
||||
(interactive)
|
||||
(spacemacs//zoom-frm-do 0))
|
||||
(spacemacs//zoom-frm-do 0)
|
||||
(spacemacs//zoom-frm-powerline-reset))
|
||||
|
||||
;; Font size, either with ctrl + mouse wheel
|
||||
(global-set-key (kbd "<C-wheel-up>") 'spacemacs/zoom-frm-in)
|
||||
|
|
|
@ -107,17 +107,17 @@
|
|||
:init
|
||||
(progn
|
||||
(evil-define-key 'normal macrostep-keymap "q" 'macrostep-collapse-all)
|
||||
(spacemacs|define-micro-state macrostep
|
||||
:doc "[e] expand [c] collapse [n/N] next/previous [q] quit"
|
||||
:disable-evil-leader t
|
||||
:persistent t
|
||||
:evil-leader-for-mode (emacs-lisp-mode . "dm")
|
||||
(spacemacs|define-micro-state-2 macrostep
|
||||
:doc "\n[_e_] expand [_c_] collapse [_n_/_N_] next/previous [_q_] quit"
|
||||
:foreign-keys run
|
||||
:bindings
|
||||
("e" macrostep-expand)
|
||||
("c" macrostep-collapse)
|
||||
("n" macrostep-next-macro)
|
||||
("N" macrostep-prev-macro)
|
||||
("q" macrostep-collapse-all :exit t)))))
|
||||
("q" macrostep-collapse-all :exit t))
|
||||
(spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode
|
||||
"dm" 'spacemacs/macrostep-micro-state/body))))
|
||||
|
||||
(defun emacs-lisp/post-init-evil ()
|
||||
(add-hook 'emacs-lisp-mode-hook
|
||||
|
|
Loading…
Reference in New Issue