Files
.emacs.d/lisp/init-window.el

134 lines
4.1 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;;; init-window.el --- windows manage packages -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(use-package window
:straight nil
:config
(setq switch-to-buffer-obey-display-actions t))
(use-package popper
:defines
popper-echo-dispatch-actions
:commands
popper-group-by-directory
:hook
(after-init . popper-mode)
:init
(setq popper-reference-buffers
'("\\*Messages\\*"
"Output\\*$" "\\*Pp Eval Output\\*$"
"\\*Compile-Log\\*"
"\\*Completions\\*"
"\\*Warnings\\*"
"\\*Flymake diagnostics.*\\*"
"\\*Async Shell Command\\*"
"\\*Apropos\\*"
"\\*Backtrace\\*"
"\\*prodigy\\*"
"\\*Calendar\\*"
"\\*Holidays\\*"
"\\*Embark Actions\\*"
"\\*Finder\\*"
"\\*Kill Ring\\*"
"\\*Embark Export:.*\\*"
"\\*Edit Annotation.*\\*"
"\\*Flutter\\*"
"\\*Ibuffer\\*"
"^\\*Finder-"
"Buffers\\*$"
"^\\*Geiser"
"\\*gptel-Kimi-Code\\*"
"^\\*sly"
"\\*gptel-agent:.*\\*"
"^magit"
"\\*discomfort\\*"
"\\*eww bookmarks\\*"
"\\*eww history\\*"
"\\*Proced\\*"
bookmark-bmenu-mode
lsp-bridge-ref-mode
comint-mode
compilation-mode
help-mode helpful-mode
tabulated-list-mode
Buffer-menu-mode
occur-mode
gnus-article-mode devdocs-mode
grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode
ivy-occur-mode ivy-occur-grep-mode
process-menu-mode list-environment-mode cargo-process-mode
youdao-dictionary-mode osx-dictionary-mode fanyi-mode
gptel-mode
ibuffer-mode
"^\\*eshell.*\\*.*$" eshell-mode
".*eshell\\*$"
"^\\*shell.*\\*.*$" shell-mode
"^\\*terminal.*\\*.*$" term-mode
"^\\*vterm.*\\*.*$" vterm-mode
"^\\*eat.*\\*.*$" eat-mode
"\\*DAP Templates\\*$" dap-server-log-mode
"\\*ELP Profiling Restuls\\*" profiler-report-mode
"\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$"
"\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$"
"\\*[Wo]*Man.*\\*$"
"\\*ert\\*$" overseer-buffer-mode
"\\*gud-debug\\*$"
"\\*lsp-help\\*$" "\\*lsp session\\*$"
"\\*quickrun\\*$"
"\\*tldr\\*$"
"\\*vc-.*\\*$"
"\\*eldoc\\*"
"^\\*elfeed-entry\\*$"
"^\\*macro expansion\\**"
"\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*" "^CAPTURE-" "\\*Org Note\\*"
"\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
"\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
"\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
"\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
rustic-cargo-outdated-mode rustic-cargo-test-mode
"^\\*\\[D\\] FILE backlinks for" "^\\*Denote HEADING backlinks for"))
(when (display-grayscale-p)
(setq popper-mode-line
'("[POP]")))
(setq popper-echo-dispatch-actions t)
(setq popper-group-function nil)
:config
(popper-echo-mode 1)
(with-no-warnings
(defun my-popper-fit-window-height (win)
"Determine the height of popup window WIN by fitting it to the buffer's content."
(fit-window-to-buffer
win
(floor (frame-height) 3)
(floor (frame-height) 3)))
(setq popper-window-height #'my-popper-fit-window-height)
(defun popper-close-window-hack (&rest _)
"Close popper window via `C-g'."
;; `C-g' can deactivate region
(when (and (called-interactively-p 'interactive)
(not (region-active-p))
popper-open-popup-alist)
(let ((window (caar popper-open-popup-alist)))
(when (window-live-p window)
(delete-window window)))))
(advice-add #'keyboard-quit :before #'popper-close-window-hack)))
;; es-windos快速管理窗口
(use-package es-windows)
(provide 'init-window)
;;; init-window.el ends here