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

Subsystems: the rest

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:40

Jeff King [off-list ref] writes:
On Mon, Sep 11, 2006 at 08:08:13PM -0600, Tom Prince wrote:
quoted
quoted
+  1. Copy commit-syntax.vim to vim's syntax directory:
+     $ cp commit-syntax.vim $HOME/.vim/syntax/gitcommit.vim
It would be more obvious if you could do cp gitcomit.vim $HOME/.vim/syntax/
It would be with only one file, but you could just as easily have a
.vim/ftplugin/gitcommit.vim file (I think there are others, too). If you
want to give it the "proper" name, it should probably be
syntax/gitcommit.vim.
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?

diff --git a/contrib/vim/README b/contrib/vim/README
index bad0a05..f574cc8 100644
--- a/contrib/vim/README
+++ b/contrib/vim/README
@@ -1,6 +1,6 @@
 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 gitcommit.vim to vim's syntax directory:
+     $ cp 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/gitcommit.vim
similarity index 100%
rename from contrib/vim/commit-syntax.vim
rename to contrib/vim/gitcommit.vim

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

From: Jeff King <hidden>
Date: 2016-06-15 22:42:40

On Tue, Sep 12, 2006 at 11:12:08PM -0700, Junio C Hamano wrote:
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

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

From: Tom Prince <hidden>
Date: 2016-06-15 22:42:40

On Wed, Sep 13, 2006 at 02:25:57AM -0400, Jeff King wrote:
 
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):
Much clearer. I had glanced at the readme and did
cp commit-syntax.vim ~/.vim/syntax
and it took me a minute or so to figure what was wrong.

  Tom
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help