簡體   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