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

110 lines
3.6 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 popper
:defines popper-echo-dispatch-actions
:commands popper-group-by-directory
:hook (emacs-startup . 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\\*"
"\\*Embark Actions\\*"
"\\*Finder\\*"
"\\*Kill Ring\\*"
"\\*Embark Export:.*\\*"
"\\*Edit Annotation.*\\*"
"\\*Flutter\\*"
"\\*Ibuffer\\*"
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
"^\\*eshell.*\\*.*$" eshell-mode
"^\\*shell.*\\*.*$" shell-mode
"^\\*terminal.*\\*.*$" term-mode
"^\\*vterm.*\\*.*$" vterm-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*"
"\\*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))
(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)))
;; 安装ace-windows快速切换窗口
(use-package ace-window)
;; es-windos快速管理窗口
(use-package es-windows)
(provide 'init-window)
;;; init-window.el ends here