make scale font microstate use spacemacs microstate maco

This commit is contained in:
Rich Alesi 2015-03-25 22:51:29 -07:00 committed by syl20bnr
parent 89e648ec39
commit 88dfabb335
2 changed files with 11 additions and 25 deletions

View file

@ -652,24 +652,7 @@ toggling fullscreen."
'maximized)
'fullboth)))))
;;; begin scale font micro-state
(defun spacemacs/scale-font-size-overlay-map ()
"Set a temporary overlay map to easily change the font size."
(set-temporary-overlay-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "+") 'spacemacs/scale-up-font)
(define-key map (kbd "-") 'spacemacs/scale-down-font)
(define-key map (kbd "=") 'spacemacs/reset-font-size)
map) t))
(defun spacemacs/font-scaling-micro-state-doc ()
"Display a short documentation in the mini buffer."
(echo "Scale Font micro-state:
+ to scale up
- to scale down
= to reset
Press any other key to exit."))
;;; begin scale font functions
(defun spacemacs/scale-up-or-down-font-size (direction)
"Scale the font. If DIRECTION is positive or zero the font is scaled up,
@ -680,9 +663,7 @@ otherwise it is scaled down."
(text-scale-set 0)
(if (< direction 0)
(text-scale-decrease scale)
(text-scale-increase scale))))
(spacemacs/scale-font-size-overlay-map)
(spacemacs/font-scaling-micro-state-doc))
(text-scale-increase scale)))))
(defun spacemacs/scale-up-font ()
"Scale up the font."
@ -699,7 +680,7 @@ otherwise it is scaled down."
(interactive)
(spacemacs/scale-up-or-down-font-size 0))
;;; end scale font micro-state
;;; end scale font microstate
(defmacro spacemacs|diminish (mode unicode &optional ascii)
"Diminish MODE name in mode line to UNICODE or ASCII depending on the value

View file

@ -283,10 +283,15 @@ Ensure that helm is required before calling FUNC."
"w/" 'split-window-right
"w=" 'balance-windows)
;; text -----------------------------------------------------------------------
(spacemacs|define-micro-state scale-font
:doc "Scale Font [+] scale up [-] scale down [=] reset font"
:evil-leader "zx"
:use-minibuffer t
:bindings
("+" spacemacs/scale-up-font)
("-" spacemacs/scale-down-font)
("=" spacemacs/reset-font-size))
(evil-leader/set-key
"zx=" 'spacemacs/reset-font-size
"zx+" 'spacemacs/scale-up-font
"zx-" 'spacemacs/scale-down-font
"xdw" 'delete-trailing-whitespace
"xtc" 'transpose-chars
"xtl" 'transpose-lines