doom-modeline - 源自doom emacs 的 mode-line

doom-modeline 发布有段时间了。之前在reddit发了个帖子,却忘了在emacs-china发布,特此补上。doom-modeline 源自doom emacs,但做了一些增强和修改,目前已经集成到Centuar Emacs 中,喜欢的朋友可以尝试下,你可以将它应用到任意主题中,不过效果最好的还是搭配doom-themes

I’d like announce a new fancy modeline according to DOOM emacs, which is named doom-modeline, and already been the part of Centaur Emacs now.

The original idea is from doom-modeline on its own package. hlissner seems no time on this requirement, so I created myself. The most of codes are from DOOM emacs. Thanks to hlissner!

It’s available on melpa. If you like it, please try. Any questions or issues, please submit the issues online.

Feature

The DOOM modeline was designed for minimalism, and offers:

  • A match count panel (for anzu, iedit, evil-search and evil-substitute)
  • An indicator for recording a macro
  • Local python/ruby/go version in the major-mode
  • A customizable mode-line height (see doom-modeline-height)
  • An error/warning count segment for flycheck
  • A workspace number segment for eyebrowse
  • A window number segment for winum and window-numbering
  • An indicator for evil state

Install

Manual

From melpa, M-x package-install RET doom-modeline RET.

In init.el,

(require 'doom-modeline)
(doom-modeline-init)

Use-package

(use-package doom-modeline
      :ensure t
      :defer t
      :hook (after-init . doom-modeline-init))

This package requires the fonts included with all-the-icons to be installed. Run M-x all-the-icons-install-fonts to do so.

Screenshots

modeline

search

subst

macro

version errors

evil normal state evil emacs state

evil insert sate evil viusal state

evil motion state evil operator state

6 个赞

第四幅图 q > 这个是啥意思呀

看 message 应该是定义 macro?

EDIT:doom真好看

这是evil-mode下定义macro的状态,正常模式下直接显示为Marco

感觉终端下很朴素啊

是的,很多feature只在UI下才有效,主要是字符、图标的限制。

可以在 frame 宽度比较小的时候,隐藏文件路径和文件名吗?这样不会挡住 flycheck 的错误提示,谢谢

请试试这个配置

(setq doom-modeline-buffer-file-name-style 'file-name)

详细查看变量doom-modeline-buffer-file-name-style.

1 个赞

另外,我建议你可以试试zoom

好的,谢谢推荐。

求助,在daemon模式下,mode-line字符显示不出来,请问该怎么办?

安装all-the-font了吗?README里有方法

安装过了,不用daemon是正常的。

daemon下不支持all-the-font。如果要用,请直接在terminal下启动。

@seagle0128 多谢你的回复,这个问题我应该是放错了地方。这个mode-line是你的另一个项目中出现的问题 Centaur Emacs

另外,这个mode-line我也试过,当emacs启动时显示正常,一旦拖放一个文件进去就不对了,变成一片空白,是不是我的姿势不对?

附上配置文件 `

;; init melpa
(require 'package)
(setq  package-enable-at-startup nil
package-archives '(
("gnu"      .   "http://elpa.emacs-china.org/gnu/")
("melpa"    .   "http://elpa.emacs-china.org/melpa/")
("org"      .   "http://elpa.emacs-china.org/org/")))
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; (add-to-list 'load-path "~/.emacs.d/themes/")
(set-file-name-coding-system 'gbk)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (tango-dark)))
'(package-selected-packages (quote (doom-modeline))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(require 'doom-modeline)
(doom-modeline-init)
`

你是在Windows下用的Emacs,对吗?是什么版本? 拖进去的文件是什么mode?是所有文件拖进去都出现问题?如果直接使用C-x C-f 打开相同文件呢?另外,Message` buffer中有什么error或者warning吗?

是windows10,1803专业版,GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30,拖放txt,org文件都不行,C-x C-f也不行。出错信息如下:

Error during redisplay: (eval (doom-modeline-format--main)) signaled (invalid-regexp "Trailing backslash") [17 times]

启动后执行eval-region

(doom-modeline-def-modeline 'main
                            '(window-number bar matches " " buffer-info buffer-position  " " selection-info)
                            '(global buffer-encoding major-mode process vcs flycheck))

或者

(doom-modeline-def-modeline 'main
                            '(workspace-number window-number bar evil-state " " buffer-position  " " selection-info)
                            '(buffer-encoding major-mode vcs flycheck))

@seagle0128 多谢,问题解决了

可是有新问题,加载all-the-icons,中文字体就得出错,我抄了一段你的cnfont设置,就不行,去掉这一段就没事

你是用的哪一个配置解决的?排除下是哪一个有问题。

cnfonts按照你自己的环境配置就好了。