git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] contrib/vim: add syntax highlighting file for commits

From
Jeff King <peff@peff.net>
Date
Sep 13, 2006, 06:25 UTC
Message-ID
<20060913062557.GA4783@coredump.intra.peff.net>
In-Reply-To
<7vy7so9txj.fsf@assigned-by-dhcp.cox.net>
On Tue, Sep 12, 2006 at 11:12:08PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> I am not a vim user, but my reading of Tom's comment is that he
> thinks it would have been nicer if the file the patch adds were
> named gitcommit.vim, not commit-syntax.vim.  As you seem to
> agree that the preferred name for this file when deployed is
> gitcommit.vim, how about something like this on top of your
> patch perhaps?

My point was that there may be many files named gitcommit.vim; the directory they appear in under your .vim directory has significance. If we add another such file, they will conflict in the flattened namespace of contrib/vim. See below (which also adds the necessary mkdir command):

-- >8 -- contrib/vim: give commit-syntax a more sensible name

diff --git a/contrib/vim/README b/contrib/vim/README
index bad0a05..9e7881f 100644
--- a/contrib/vim/README
+++ b/contrib/vim/README
@@ -1,6 +1,7 @@
 To syntax highlight git's commit messages, you need to:
-  1. Copy commit-syntax.vim to vim's syntax directory:
-     $ cp commit-syntax.vim $HOME/.vim/syntax/gitcommit.vim
+  1. Copy syntax/gitcommit.vim to vim's syntax directory:
+     $ mkdir -p $HOME/.vim/syntax
+     $ cp syntax/gitcommit.vim $HOME/.vim/syntax
   2. Auto-detect the editing of git commit files:
      $ cat >>$HOME/.vimrc <<'EOF'
      autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit
diff --git a/contrib/vim/commit-syntax.vim b/contrib/vim/syntax/gitcommit.vim
similarity index 100%
rename from contrib/vim/commit-syntax.vim
rename to contrib/vim/syntax/gitcommit.vim
Previous: Junio C HamanoNext: Tom Prince
Message 5 of 6 in “contrib/vim: add syntax highlighting file for commits”
  1. contrib/vim: add syntax highlighting file for commitsJeff King, Sep 11, 2006
  2. Tom PrinceSep 12, 2006
  3. Jeff KingSep 12, 2006
  4. Junio C HamanoSep 13, 2006
  5. Jeff KingSep 13, 2006
  6. Tom PrinceSep 13, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.