关闭magit模式提交格式

Ina*_*thi 3 git emacs magit

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

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

Phi*_*hil 6

将以下内容添加到您的.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)
Run Code Online (Sandbox Code Playgroud)

至于字体颜色,我建议你将光标移动到感兴趣的文本,执行M-x customize-face,并使用对话框.

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

(set-face-foreground 'git-commit-summary-face "white")
Run Code Online (Sandbox Code Playgroud)

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


Joh*_*ohn 6

在最新的 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)
Run Code Online (Sandbox Code Playgroud)