Browse Source

Emacs: Add window maximize toggle

master
Riyyi 2 years ago
parent
commit
847537257e
  1. 19
      .config/emacs/config.org

19
.config/emacs/config.org

@ -553,6 +553,23 @@ Functions that only use built-in Emacs functionality.
(set-fringe-mode '(nil . 0))
(set-fringe-mode 0)))
;; Reference: https://gist.github.com/mads-hartmann/3402786#gistcomment-4263171
(defun dot/toggle-window-maximize ()
"Toggle window maximize."
(interactive)
(save-excursion
(if (and (= 1 (length (cl-remove-if
(lambda (w)
(or (and (fboundp 'treemacs-is-treemacs-window?)
(treemacs-is-treemacs-window? w))
(and (bound-and-true-p neo-global--window)
(eq neo-global--window w))))
(window-list))))
(assoc ?_ register-alist))
(jump-to-register ?_)
(window-configuration-to-register ?_)
(delete-other-windows))))
(defun dot/M-x (command)
"Prompt and execute COMMAND."
(interactive "CCommand: ")
@ -1064,6 +1081,7 @@ General.el ~leader key binds.
"t j" '(centaur-tabs-select-end-tab :which-key "Tab select first")
"t k" '(centaur-tabs-select-beg-tab :which-key "Tab select last")
"t l" '(centaur-tabs-forward-group :which-key "Tab forward group")
"t m" '(dot/toggle-window-maximize :which-key "Toggle window maximize")
"t n" '(neotree-toggle-in-project-root :which-key "Toggle Neotree")
"t s" '(dot/flyspell-toggle :which-key "Toggle spell checker")
"t w" '(visual-line-mode :which-key "Toggle line wrapping")
@ -1108,6 +1126,7 @@ General.el ~leader key binds.
"w j" '(windmove-down :which-key "Focus window down")
"w k" '(windmove-up :which-key "Focus window up")
"w l" '(windmove-right :which-key "Focus window right")
"w m" '(dot/toggle-window-maximize :which-key "Toggle window maximize")
"w o" '(delete-other-windows :which-key "Close other windows")
"w s" '(split-follow-horizontally :which-key "Split horizontal")
"w v" '(split-follow-vertically :which-key "Split vertical")

Loading…
Cancel
Save