如题,我安装好了writeroom,也能开启,但是希望打开emcas的时候自动进入这个模式 然后我写作的时候(主要是markdown),打开buff的时候都自动是writeroom模式。
网上有个六年前的答案,我试验了,不行。
谢谢!
如题,我安装好了writeroom,也能开启,但是希望打开emcas的时候自动进入这个模式 然后我写作的时候(主要是markdown),打开buff的时候都自动是writeroom模式。
网上有个六年前的答案,我试验了,不行。
谢谢!
首先, 在配置中开启 global-writeroom-mode
.
(global-writeroom-mode 1)
接着, 在某些模式下开启(无效情况下)/关闭(有效想关闭)writeroom, 使用add-hook, 比如
# agenda mode 开启 writeroom
(add-hook 'org-agenda-mode-hook (lambda() (writeroom-mode)))
# telega mode 开启 writeroom
(add-hook 'telega-root-mode-hook (lambda () (writeroom-mode 1)))
# java mode 的时候不要开启 writeoom
(add-hook 'java-mode-hook (lambda () (writeroom-mode nil)))
推荐一下 GitHub - amosbird/realign-mode.el
minibuffer 也能居中,适合习惯长时间保持居中的用户。
可控性很高,用我加的配置举个例子,做了延迟加载、窄窗口不居中。
(use-package realign-mode
:commands realign-mode
:init (run-with-idle-timer 1 nil 'realign-mode)
:config
;; (setq split-width-threshold 150)
(push #'claude/realign-need-padding-p
realign-need-padding-predicates)
(push #'claude/realign-ignore-window-p
realign-ignore-window-predicates))
(defun claude/realign-ignore-window-p (window)
(let* ((buffer (window-buffer window))
(buffname (string-trim (buffer-name buffer))))
(or (equal buffname "*spacemacs*")
(equal buffname "*rime-posframe*")
(equal buffname "*flycheck-posframe-buffer*")
(equal buffname "*Ediff Control Panel*")
(equal (with-current-buffer buffer major-mode) 'telega-chat-mode)
(equal (with-current-buffer buffer major-mode) 'mu4e-view-mode)
(equal (with-current-buffer buffer major-mode) 'mu4e-compose-mode))))
(defun claude/realign-need-padding-p (window)
"No padding in narrow frame."
(and (numberp split-width-threshold)
(> (frame-width) split-width-threshold)))
谢谢!解决了,还学习了啥是hook!感谢!
还想再问个问题,whrite的全屏模式左右两边有那个换行的提示,还有下面有一道横线,这些都能去掉吗?能不能有一个完全的全屏呢?
谢谢
我常年开着 writeroom-mode,除了居中其它提示都关了,你可以参考下我的配置:
(use-package writeroom-mode
:ensure t
:hook (emacs-startup . global-writeroom-mode)
:config
(setq writeroom-width 128
writeroom-bottom-divider-width 0
writeroom-fringes-outside-margins t
writeroom-fullscreen-effect nil
writeroom-major-modes '(text-mode prog-mode conf-mode special-mode Info-mode dired-mode)
writeroom-maximize-window nil
writeroom-mode-line t
writeroom-mode-line-toggle-position 'mode-line-format))
谢谢,按照你说的,设置了一下,OK啦。