{"id":1426,"date":"2023-06-02T16:10:50","date_gmt":"2023-06-02T06:40:50","guid":{"rendered":"https:\/\/ale.chenonetta.com\/blog\/?p=1426"},"modified":"2025-01-29T13:21:29","modified_gmt":"2025-01-29T03:51:29","slug":"vim-syntax-highlighting-for-commit-messages","status":"publish","type":"post","link":"https:\/\/ale.chenonetta.com\/blog\/2023\/06\/vim-syntax-highlighting-for-commit-messages\/","title":{"rendered":"Vim syntax highlighting for commit messages"},"content":{"rendered":"\n<p>Parking this info here for my future-self to reference.<\/p>\n\n\n\n<p>Create a vim file, mine is at&nbsp;<code>~\/gitcommithighlight.vim<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">:highlight OverLength ctermbg=red ctermfg=white guibg=red\n\" First line must be 50 characters or less\n:let w:m1=matchadd('OverLength', '\\%1l\\%&gt;50v.\\+', -1)\n\" Second line must be blank\n:let w:m1=matchadd('OverLength', '\\%2l\\%&gt;0v.\\+', -1)\n\" All other lines must be be 72 characters or less\n:let w:m2=matchadd('OverLength', '\\%&gt;2l\\%&gt;72v.\\+', -1)<\/pre>\n\n\n\n<p>Set git\u2019s editor to vim and make it source the above file:<br><code>git config --global core.editor \"$(which vim) -S ~\/gitcommithighlight.vim\"<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Parking this info here for my future-self to reference. Create a vim file, mine is at&nbsp;~\/gitcommithighlight.vim :highlight OverLength ctermbg=red ctermfg=white guibg=red &#8221; First line must be 50 characters or less :let w:m1=matchadd(&#8216;OverLength&#8217;, &#8216;\\%1l\\%&gt;50v.\\+&#8217;, -1) &#8221; Second line must be blank :let w:m1=matchadd(&#8216;OverLength&#8217;, &#8216;\\%2l\\%&gt;0v.\\+&#8217;, -1) &#8221; All other lines must be be 72 characters or less &#8230; <a class=\"more-link\" href=\"https:\/\/ale.chenonetta.com\/blog\/2023\/06\/vim-syntax-highlighting-for-commit-messages\/\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54],"tags":[539,537,540,538],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-admin","4":"post-1426","6":"format-standard","7":"category-code-2","8":"post_tag-cli","9":"post_tag-git","10":"post_tag-snippets","11":"post_tag-vim"},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/posts\/1426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/comments?post=1426"}],"version-history":[{"count":0,"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/posts\/1426\/revisions"}],"wp:attachment":[{"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/media?parent=1426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/categories?post=1426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ale.chenonetta.com\/blog\/wp-json\/wp\/v2\/tags?post=1426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}