Add doom/{increase,decrease,reset}-font commands
Borrows the idea from zoom-frm (see #1389).
This commit is contained in:
parent
ef4106dae8
commit
0f0fdbc00c
8 changed files with 124 additions and 51 deletions
|
@ -22,9 +22,9 @@
|
|||
"<C-mouse-4>" #'text-scale-increase
|
||||
"<C-mouse-5>" #'text-scale-decrease
|
||||
"<C-down-mouse-2>" (λ! (text-scale-set 0))
|
||||
"M-+" (λ! (text-scale-set 0))
|
||||
"M-=" #'text-scale-increase
|
||||
"M--" #'text-scale-decrease
|
||||
"M-+" #'doom/reset-font-size
|
||||
"M-=" #'doom/increase-font-size
|
||||
"M--" #'doom/decrease-font-size
|
||||
;; Editor related bindings
|
||||
[remap newline] #'newline-and-indent
|
||||
"C-j" #'+default/newline
|
||||
|
|
|
@ -162,9 +162,9 @@
|
|||
"s-v" #'yank
|
||||
"s-s" #'save-buffer
|
||||
;; Buffer-local font scaling
|
||||
"s-+" (λ! (text-scale-set 0))
|
||||
"s-=" #'text-scale-increase
|
||||
"s--" #'text-scale-decrease
|
||||
"s-+" #'doom/reset-font-size
|
||||
"s-=" #'doom/increase-font-size
|
||||
"s--" #'doom/decrease-font-size
|
||||
;; Conventional text-editing keys & motions
|
||||
"s-a" #'mark-whole-buffer
|
||||
:g "s-/" (λ! (save-excursion (comment-line 1)))
|
||||
|
|
|
@ -11,18 +11,22 @@
|
|||
|
||||
|
||||
(defvar +modeline--old-bar-height nil)
|
||||
;;;###autoload
|
||||
(defun +modeline|resize-for-big-font ()
|
||||
"Adjust the modeline's height when `doom-big-font-mode' is enabled. This was
|
||||
made to be added to `doom-big-font-mode-hook'."
|
||||
(defun +modeline|resize-for-font ()
|
||||
"Adjust the modeline's height when the font size is changed by
|
||||
`doom/increase-font-size' or `doom/decrease-font-size'.
|
||||
|
||||
Meant for `doom-change-font-size-hook'."
|
||||
(unless +modeline--old-bar-height
|
||||
(setq +modeline--old-bar-height doom-modeline-height))
|
||||
(let ((default-height +modeline--old-bar-height))
|
||||
(if doom-big-font-mode
|
||||
(let* ((font-size (font-get doom-font :size))
|
||||
(big-size (font-get doom-big-font :size))
|
||||
(ratio (/ (float big-size) font-size)))
|
||||
(setq doom-modeline-height (ceiling (* default-height ratio 0.75))))
|
||||
(let ((default-height +modeline--old-bar-height)
|
||||
(scale (or (frame-parameter nil 'font-scale) 0)))
|
||||
(if (> scale 0)
|
||||
(let* ((font-size (string-to-number
|
||||
(aref (doom--font-name (frame-parameter nil 'font)
|
||||
(selected-frame))
|
||||
xlfd-regexp-pixelsize-subnum)))
|
||||
(scale (frame-parameter nil 'font-scale)))
|
||||
(setq doom-modeline-height (+ default-height (* scale doom-font-increment))))
|
||||
(setq doom-modeline-height default-height))
|
||||
;; already has a variable watcher in Emacs 26+
|
||||
(unless EMACS26+ (doom-modeline-refresh-bars))))
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
(add-hook 'doom-modeline-mode-hook #'size-indication-mode) ; filesize in modeline
|
||||
(add-hook 'doom-modeline-mode-hook #'column-number-mode) ; cursor column in modeline
|
||||
|
||||
(add-hook 'doom-big-font-mode-hook #'+modeline|resize-for-big-font)
|
||||
(add-hook 'doom-change-font-size-hook #'+modeline|resize-for-font)
|
||||
(add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars)
|
||||
|
||||
(add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue