繁体   English   中英

关闭magit模式提交格式

[英]Turning off magit-mode commit formatting

最近版本的Magit( Mx magit-versionmagit-20131222.850 )我目前正在使用在提交消息上强制执行某些恼人的属性,并将它们奇怪地着色。 具体来说,它会自动断开一定长度的线条并将第一个线条变为绿色。

有没有办法禁用它,并使其像旧的哑提交消息窗口一样? 我没有看到任何相关的Mx customize-mode ,所以我认为该解决方案将涉及一些elisp

将以下内容添加到.emacs

(add-hook 'git-commit-mode-hook
          '(lambda () (auto-fill-mode 0))
          ;; append rather than prepend to git-commit-mode-hook, since the
          ;; thing that turns auto-fill-mode on in the first place is itself
          ;; another hook on git-commit-mode.
          t)

至于字体颜色,我建议你将光标移动到感兴趣的文本,做Mx customize-face ,然后使用对话框。

但是,您可以在原始elisp中执行以下操作:

(set-face-foreground 'git-commit-summary-face "white")

(通常,您可以将光标移动到感兴趣的文本并执行Mx describe-face以了解您要修改的面部。)

在最新的magit版本中(我使用Magit 20190122.503)你需要使用git-commit-setup-hook来完成这项工作:

(add-hook 'git-commit-setup-hook 'turn-off-auto-fill
          ;; append to end of git-commit-setup-hook to ensure our hook trumps others.
          t)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM