{"thread":{"id":"5941","subject":"[PATCH] be more vim-ish, and also syntax hilight Signed-off-by lines.","startedAt":"2006-10-17T00:31:09Z","lastAt":"2006-10-18T09:46:51Z","messageCount":23,"participants":["Pierre Habouzit","Junio C Hamano","Peter Baumann","Christian MICHON","Petr Baudis","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"28890","messageId":"11610450702261-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":null,"subject":"[PATCH] be more vim-ish, and also syntax hilight Signed-off-by lines.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-17T00:31:09Z","receivedAt":"2006-10-17T00:31:09Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n contrib/vim/syntax/gitcommit.vim |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\nindex a9de09f..d0c6e5d 100644\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ b/contrib/vim/syntax/gitcommit.vim\n@@ -1,3 +1,14 @@\n+\" Vim syntax file\n+\" Language:\tgit commit message\n+\n+\" Quit when a (custom) syntax file was already loaded\n+if exists(\"b:current_syntax\")\n+  finish\n+endif\n+\n+syn region gitSignedOff start=/^Signed-off-by:/ end=/$/ contains=gitAuthor,gitEmail\n+syn region gitAuthor contained start=/\\s/ end=/$/\n+\n syn region gitLine start=/^#/ end=/$/\n syn region gitCommit start=/^# Updated but not checked in:$/ end=/^#$/ contains=gitHead,gitCommitFile\n syn region gitHead contained start=/^#   (.*)/ end=/^#$/\n@@ -8,6 +19,9 @@ syn match gitCommitFile contained /^#\\t.\n syn match gitChangedFile contained /^#\\t.*/hs=s+2\n syn match gitUntrackedFile contained /^#\\t.*/hs=s+2\n \n+hi def link gitSignedOff Keyword\n+hi def link gitAuthor Normal\n+\n hi def link gitLine Comment\n hi def link gitCommit Comment\n hi def link gitChanged Comment\n@@ -16,3 +30,7 @@ hi def link gitUntracked Comment\n hi def link gitCommitFile Type\n hi def link gitChangedFile Constant\n hi def link gitUntrackedFile Constant\n+\n+let b:current_syntax = \"git\"\n+\n+\" vim: ts=8 sw=2\n-- \n1.4.2.3\n"},{"id":"28891","messageId":"11610450701082-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"11610450702261-git-send-email-madcoder@debian.org","subject":"[PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-17T00:31:10Z","receivedAt":"2006-10-17T00:31:10Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n contrib/vim/README                 |    6 ++++\n contrib/vim/ftplugin/gitcommit.vim |   61 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 67 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex 9e7881f..26c1682 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -6,3 +6,9 @@ To syntax highlight git's commit message\n      $ cat >>$HOME/.vimrc <<'EOF'\n      autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n      EOF\n+\n+To use the fancy split-view with the currently commited diff, you need to:\n+  1. Copy ftplugin/gitcommit.vim to vim's ftplugin directory:\n+     $ mkdir -p $HOME/.vim/ftplugin\n+     $ cp ftplugin/gitcommit.vim $HOME/.vim/ftplugin\n+  2. Auto-detect the editing of git commit files (see above).\ndiff --git a/contrib/vim/ftplugin/gitcommit.vim b/contrib/vim/ftplugin/gitcommit.vim\nnew file mode 100644\nindex 0000000..f9efd59\n--- /dev/null\n+++ b/contrib/vim/ftplugin/gitcommit.vim\n@@ -0,0 +1,61 @@\n+if exists(\"b:did_ftplugin\")\n+  finish\n+endif\n+\n+let b:did_ftplugin = 1\n+\n+setlocal tw=74\n+setlocal nowarn nowb\n+\n+\"{{{ function Git_diff_windows\n+\n+function! Git_diff_windows()\n+    let i = 0\n+    let list_of_files = ''\n+\n+    \" drop everything until '#  (will commit)' and the next empty line\n+    while i <= line('$')\n+        let line = getline(i)\n+        if line =~ '^#\\s*(will commit)$'\n+            let i = i + 2\n+            break\n+        endif\n+\n+        let i = i + 1\n+    endwhile\n+\n+    \" read file names until we have EOF or an empty line\n+    while i <= line('$')\n+        let line = getline(i)\n+        if line =~ '^#\\s*[a-z ]*:.*->.*$'\n+            let file = substitute(line, '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+        elseif line =~ '^#\\s*[a-z ]*:'\n+            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+        elseif line =~ '^#\\s*$'\n+            break\n+        endif\n+\n+        let i = i + 1\n+    endwhile\n+\n+    if list_of_files == \"\"\n+        return\n+    endif\n+\n+    rightbelow vnew\n+    silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile\n+    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n+    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n+    setlocal nomodifiable\n+    redraw!\n+    wincmd p\n+    redraw!\n+endfunction\n+\n+\"}}}\n+\n+call Git_diff_windows()\n-- \n1.4.2.3\n"},{"id":"28914","messageId":"7vodsbmlkr.fsf@assigned-by-dhcp.cox.net","threadId":"5941","inReplyTo":"11610450702261-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] be more vim-ish, and also syntax hilight Signed-off-by lines.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-17T07:46:12Z","receivedAt":"2006-10-17T07:46:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'd prefer patches to contrib/ sections to be CC'ed to the\nowners of them (in this case that would be Jeff King) to be\nAcked, since I do not actively maintain anything under contrib/\nmyself.\n\nJeff, are you Ok with Pierre's two patches?\n"},{"id":"28917","messageId":"802d21790610170122j6191ba51l2c39d3bc6a3475b@mail.gmail.com","threadId":"5941","inReplyTo":"11610450701082-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-10-17T08:22:47Z","receivedAt":"2006-10-17T08:22:47Z","isPatch":true,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"2006/10/17, Pierre Habouzit <madcoder@debian.org>:\n> Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n> ---\n>  contrib/vim/README                 |    6 ++++\n>  contrib/vim/ftplugin/gitcommit.vim |   61 ++++++++++++++++++++++++++++++++++++\n>  2 files changed, 67 insertions(+), 0 deletions(-)\n>\n> diff --git a/contrib/vim/README b/contrib/vim/README\n> index 9e7881f..26c1682 100644\n> --- a/contrib/vim/README\n> +++ b/contrib/vim/README\n> @@ -6,3 +6,9 @@ To syntax highlight git's commit message\n>       $ cat >>$HOME/.vimrc <<'EOF'\n>       autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n>       EOF\n> +\n> +To use the fancy split-view with the currently commited diff, you need to:\n> +  1. Copy ftplugin/gitcommit.vim to vim's ftplugin directory:\n> +     $ mkdir -p $HOME/.vim/ftplugin\n> +     $ cp ftplugin/gitcommit.vim $HOME/.vim/ftplugin\n> +  2. Auto-detect the editing of git commit files (see above).\n> diff --git a/contrib/vim/ftplugin/gitcommit.vim b/contrib/vim/ftplugin/gitcommit.vim\n> new file mode 100644\n> index 0000000..f9efd59\n> --- /dev/null\n> +++ b/contrib/vim/ftplugin/gitcommit.vim\n> @@ -0,0 +1,61 @@\n> +if exists(\"b:did_ftplugin\")\n> +  finish\n> +endif\n> +\n> +let b:did_ftplugin = 1\n> +\n> +setlocal tw=74\n> +setlocal nowarn nowb\n> +\n> +\"{{{ function Git_diff_windows\n> +\n> +function! Git_diff_windows()\n> +    let i = 0\n> +    let list_of_files = ''\n> +\n> +    \" drop everything until '#  (will commit)' and the next empty line\n> +    while i <= line('$')\n> +        let line = getline(i)\n> +        if line =~ '^#\\s*(will commit)$'\n> +            let i = i + 2\n> +            break\n> +        endif\n> +\n> +        let i = i + 1\n> +    endwhile\n> +\n> +    \" read file names until we have EOF or an empty line\n> +    while i <= line('$')\n> +        let line = getline(i)\n> +        if line =~ '^#\\s*[a-z ]*:.*->.*$'\n> +            let file = substitute(line, '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '')\n> +            let list_of_files = list_of_files . ' '.file\n> +            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '')\n> +            let list_of_files = list_of_files . ' '.file\n> +        elseif line =~ '^#\\s*[a-z ]*:'\n> +            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$', '\\1', '')\n> +            let list_of_files = list_of_files . ' '.file\n> +        elseif line =~ '^#\\s*$'\n> +            break\n> +        endif\n> +\n> +        let i = i + 1\n> +    endwhile\n> +\n> +    if list_of_files == \"\"\n> +        return\n> +    endif\n> +\n> +    rightbelow vnew\n\nI find it confusing that you split vertically, especially if I work in\n small terminals.\nI would prefere a horizontal split, thats why I changed it to the way\nto the way it is\nhandled in the svn.vim commit case:\n\nbelow new\n\n> +    silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile\n> +    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n> +    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n\nWhy changing directory? I had to remove the cd .. to make it work. Otherwise\ngit diff couldn't find the repository.\n\nGreetings,\n  Peter\n"},{"id":"28937","messageId":"200610171238.04372.madcoder@debian.org","threadId":"5941","inReplyTo":"802d21790610170122j6191ba51l2c39d3bc6a3475b@mail.gmail.com","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-17T10:38:02Z","receivedAt":"2006-10-17T10:38:02Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Le mar 17 octobre 2006 10:22, Peter Baumann a écrit :\n> 2006/10/17, Pierre Habouzit <madcoder@debian.org>:\n> > Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n> > ---\n> >  contrib/vim/README                 |    6 ++++\n> >  contrib/vim/ftplugin/gitcommit.vim |   61\n> > ++++++++++++++++++++++++++++++++++++ 2 files changed, 67\n> > insertions(+), 0 deletions(-)\n> >\n> > diff --git a/contrib/vim/README b/contrib/vim/README\n> > index 9e7881f..26c1682 100644\n> > --- a/contrib/vim/README\n> > +++ b/contrib/vim/README\n> > @@ -6,3 +6,9 @@ To syntax highlight git's commit message\n> >       $ cat >>$HOME/.vimrc <<'EOF'\n> >       autocmd BufNewFile,BufRead COMMIT_EDITMSG set\n> > filetype=gitcommit EOF\n> > +\n> > +To use the fancy split-view with the currently commited diff, you\n> > need to: +  1. Copy ftplugin/gitcommit.vim to vim's ftplugin\n> > directory: +     $ mkdir -p $HOME/.vim/ftplugin\n> > +     $ cp ftplugin/gitcommit.vim $HOME/.vim/ftplugin\n> > +  2. Auto-detect the editing of git commit files (see above).\n> > diff --git a/contrib/vim/ftplugin/gitcommit.vim\n> > b/contrib/vim/ftplugin/gitcommit.vim new file mode 100644\n> > index 0000000..f9efd59\n> > --- /dev/null\n> > +++ b/contrib/vim/ftplugin/gitcommit.vim\n> > @@ -0,0 +1,61 @@\n> > +if exists(\"b:did_ftplugin\")\n> > +  finish\n> > +endif\n> > +\n> > +let b:did_ftplugin = 1\n> > +\n> > +setlocal tw=74\n> > +setlocal nowarn nowb\n> > +\n> > +\"{{{ function Git_diff_windows\n> > +\n> > +function! Git_diff_windows()\n> > +    let i = 0\n> > +    let list_of_files = ''\n> > +\n> > +    \" drop everything until '#  (will commit)' and the next empty\n> > line +    while i <= line('$')\n> > +        let line = getline(i)\n> > +        if line =~ '^#\\s*(will commit)$'\n> > +            let i = i + 2\n> > +            break\n> > +        endif\n> > +\n> > +        let i = i + 1\n> > +    endwhile\n> > +\n> > +    \" read file names until we have EOF or an empty line\n> > +    while i <= line('$')\n> > +        let line = getline(i)\n> > +        if line =~ '^#\\s*[a-z ]*:.*->.*$'\n> > +            let file = substitute(line,\n> > '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '') +            let\n> > list_of_files = list_of_files . ' '.file\n> > +            let file = substitute(line,\n> > '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '') +            let\n> > list_of_files = list_of_files . ' '.file\n> > +        elseif line =~ '^#\\s*[a-z ]*:'\n> > +            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$',\n> > '\\1', '') +            let list_of_files = list_of_files . ' '.file\n> > +        elseif line =~ '^#\\s*$'\n> > +            break\n> > +        endif\n> > +\n> > +        let i = i + 1\n> > +    endwhile\n> > +\n> > +    if list_of_files == \"\"\n> > +        return\n> > +    endif\n> > +\n> > +    rightbelow vnew\n>\n> I find it confusing that you split vertically, especially if I work\n> in small terminals.\n> I would prefere a horizontal split, thats why I changed it to the way\n> to the way it is\n> handled in the svn.vim commit case:\n>\n> below new\n>\n> > +    silent! setlocal ft=diff previewwindow bufhidden=delete\n> > nobackup noswf nobuflisted nowrap buftype=nofile +    exe 'normal\n> > :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\" +   \n> > exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\n> > \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n>\n> Why changing directory? I had to remove the cd .. to make it work.\n> Otherwise git diff couldn't find the repository.\n\nbecause for me, wherever I'm from, the cwd is .git/ but it's maybe due \nto the fact that I use autochdir, I don't know.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"28940","messageId":"802d21790610170359v3f17438dn8009ae9a55b2405c@mail.gmail.com","threadId":"5941","inReplyTo":"200610171238.04372.madcoder@debian.org","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-10-17T10:59:53Z","receivedAt":"2006-10-17T10:59:53Z","isPatch":true,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"2006/10/17, Pierre Habouzit <madcoder@debian.org>:\n> Le mar 17 octobre 2006 10:22, Peter Baumann a écrit :\n> > 2006/10/17, Pierre Habouzit <madcoder@debian.org>:\n> > > Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n> > > ---\n> > >  contrib/vim/README                 |    6 ++++\n> > >  contrib/vim/ftplugin/gitcommit.vim |   61\n> > > ++++++++++++++++++++++++++++++++++++ 2 files changed, 67\n> > > insertions(+), 0 deletions(-)\n> > >\n> > > diff --git a/contrib/vim/README b/contrib/vim/README\n> > > index 9e7881f..26c1682 100644\n> > > --- a/contrib/vim/README\n> > > +++ b/contrib/vim/README\n> > > @@ -6,3 +6,9 @@ To syntax highlight git's commit message\n> > >       $ cat >>$HOME/.vimrc <<'EOF'\n> > >       autocmd BufNewFile,BufRead COMMIT_EDITMSG set\n> > > filetype=gitcommit EOF\n> > > +\n> > > +To use the fancy split-view with the currently commited diff, you\n> > > need to: +  1. Copy ftplugin/gitcommit.vim to vim's ftplugin\n> > > directory: +     $ mkdir -p $HOME/.vim/ftplugin\n> > > +     $ cp ftplugin/gitcommit.vim $HOME/.vim/ftplugin\n> > > +  2. Auto-detect the editing of git commit files (see above).\n> > > diff --git a/contrib/vim/ftplugin/gitcommit.vim\n> > > b/contrib/vim/ftplugin/gitcommit.vim new file mode 100644\n> > > index 0000000..f9efd59\n> > > --- /dev/null\n> > > +++ b/contrib/vim/ftplugin/gitcommit.vim\n> > > @@ -0,0 +1,61 @@\n> > > +if exists(\"b:did_ftplugin\")\n> > > +  finish\n> > > +endif\n> > > +\n> > > +let b:did_ftplugin = 1\n> > > +\n> > > +setlocal tw=74\n> > > +setlocal nowarn nowb\n> > > +\n> > > +\"{{{ function Git_diff_windows\n> > > +\n> > > +function! Git_diff_windows()\n> > > +    let i = 0\n> > > +    let list_of_files = ''\n> > > +\n> > > +    \" drop everything until '#  (will commit)' and the next empty\n> > > line +    while i <= line('$')\n> > > +        let line = getline(i)\n> > > +        if line =~ '^#\\s*(will commit)$'\n> > > +            let i = i + 2\n> > > +            break\n> > > +        endif\n> > > +\n> > > +        let i = i + 1\n> > > +    endwhile\n> > > +\n> > > +    \" read file names until we have EOF or an empty line\n> > > +    while i <= line('$')\n> > > +        let line = getline(i)\n> > > +        if line =~ '^#\\s*[a-z ]*:.*->.*$'\n> > > +            let file = substitute(line,\n> > > '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '') +            let\n> > > list_of_files = list_of_files . ' '.file\n> > > +            let file = substitute(line,\n> > > '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '') +            let\n> > > list_of_files = list_of_files . ' '.file\n> > > +        elseif line =~ '^#\\s*[a-z ]*:'\n> > > +            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$',\n> > > '\\1', '') +            let list_of_files = list_of_files . ' '.file\n> > > +        elseif line =~ '^#\\s*$'\n> > > +            break\n> > > +        endif\n> > > +\n> > > +        let i = i + 1\n> > > +    endwhile\n> > > +\n> > > +    if list_of_files == \"\"\n> > > +        return\n> > > +    endif\n> > > +\n> > > +    rightbelow vnew\n> >\n> > I find it confusing that you split vertically, especially if I work\n> > in small terminals.\n> > I would prefere a horizontal split, thats why I changed it to the way\n> > to the way it is\n> > handled in the svn.vim commit case:\n> >\n> > below new\n> >\n> > > +    silent! setlocal ft=diff previewwindow bufhidden=delete\n> > > nobackup noswf nobuflisted nowrap buftype=nofile +    exe 'normal\n> > > :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\" +\n> > > exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\n> > > \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n> >\n> > Why changing directory? I had to remove the cd .. to make it work.\n> > Otherwise git diff couldn't find the repository.\n>\n> because for me, wherever I'm from, the cwd is .git/ but it's maybe due\n> to the fact that I use autochdir, I don't know.\n>\n\nWouldn't it make sense to use something like 'git-rev-parse --git-dir' or\n'git-rev-parse --show-cdup' to get to the root of the repository?\n\nGreetings,\n  Peter\n"},{"id":"28941","messageId":"200610171304.39131.madcoder@debian.org","threadId":"5941","inReplyTo":"802d21790610170359v3f17438dn8009ae9a55b2405c@mail.gmail.com","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-17T11:04:38Z","receivedAt":"2006-10-17T11:04:38Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Le mar 17 octobre 2006 12:59, Peter Baumann a écrit :\n> 2006/10/17, Pierre Habouzit <madcoder@debian.org>:\n\n> > because for me, wherever I'm from, the cwd is .git/ but it's maybe\n> > due to the fact that I use autochdir, I don't know.\n>\n> Wouldn't it make sense to use something like 'git-rev-parse\n> --git-dir' or 'git-rev-parse --show-cdup' to get to the root of the\n> repository?\n\nYes it does, SungHyun Nam already sent a patch to me about that, that is \nquite interesting. I've merged it partly, and will make that commit \nplugin slightly better, so that people can:\n 1/ trig it by hand\n 2/ chose if the split is vertical or horizontal (I always have very big\n    terms with a lot of vertical splits in vim, so I like the latter,\n    other prefer the former)\n 3/ chose via a let g:gitcommit_diff_mode or sth like that in the vimrc\n    if that has to spawn automatically (0: none, 1: horiz split, 2: vert\n    split)\n\nand that time, I'll send that to the git contrib/vim maintainer so that \nI won't bother the list too much :)\n\na corrected version of the commit file wrt the cwd is on my site \nalready, with a bit of SungHyun changes[1].\n\n\n [1] http://madism.org/~madcoder/dotfiles/vim/ftplugin/git.vim\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"29002","messageId":"46d6db660610171448h53de5e40wf55f19d6458127ef@mail.gmail.com","threadId":"5941","inReplyTo":"200610171304.39131.madcoder@debian.org","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2006-10-17T21:48:51Z","receivedAt":"2006-10-17T21:48:51Z","isPatch":true,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On 10/17/06, Pierre Habouzit <madcoder@debian.org> wrote:\n> and that time, I'll send that to the git contrib/vim maintainer so that\n> I won't bother the list too much :)\n>\n\nso there is a contrib/vim maintainer ? Sorry I'm new on git list\n(though Pierre gave me some hints already with git/vim).\n\nI'm interested in testing more of these goodies. Because I\nactually use git now on a daily basis for tcl/verilog/EDA\ntogether with (g)vim.\n\nI'd like particularly to know if a git-explorer type of plugin makes\nsense for (g)vim and would like in this case be part of the team\ndevelopping it... using git of course :)\n\n-- \nChristian\n"},{"id":"29007","messageId":"7vmz7uiop4.fsf@assigned-by-dhcp.cox.net","threadId":"5941","inReplyTo":"46d6db660610171448h53de5e40wf55f19d6458127ef@mail.gmail.com","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-17T22:04:39Z","receivedAt":"2006-10-17T22:04:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Christian MICHON\" <christian.michon@gmail.com> writes:\n\n> On 10/17/06, Pierre Habouzit <madcoder@debian.org> wrote:\n>> and that time, I'll send that to the git contrib/vim maintainer so that\n>> I won't bother the list too much :)\n>>\n>\n> so there is a contrib/vim maintainer ? Sorry I'm new on git list\n> (though Pierre gave me some hints already with git/vim).\n\nIf you have git sources, check contrib/README please.\n\nWhat I asked Pierre was to CC the patch to Jeff King who did\ncontrib/vim -- it was \"send it to him too\", and not \"do not send\nit to me\".  I do not actively use vim myself so I am a wrong\nperson to judge patches to that part of the source tree.\n\nApparently Pierre seems to have thought that I thought patches\nto the contrib/ part is \"bothering the list\", but that was not\nmy intention.  I believe showing your patches for review by\nwider audiences is a good thing.\n"},{"id":"29034","messageId":"11611319052686-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"7vodsbmlkr.fsf@assigned-by-dhcp.cox.net","subject":"contrib/vim patches, replace the previous set","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:38:25Z","receivedAt":"2006-10-18T00:38:25Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  here is a brand new set of patches, the same update on the syntax\nfile, and an enhanced ftplugin that is very configureable.\n\n  Those two patches replace the two previous ones.\n"},{"id":"29041","messageId":"1161131976193-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"7vodsbmlkr.fsf@assigned-by-dhcp.cox.net","subject":"contrib/vim patches, replace the previous set","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:39:34Z","receivedAt":"2006-10-18T00:39:34Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"  here is a brand new set of patches, the same update on the syntax\nfile, and an enhanced ftplugin that is very configureable.\n\n  Those two patches replace the two previous ones.\n"},{"id":"29038","messageId":"11611319762395-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"1161131976193-git-send-email-madcoder@debian.org","subject":"[PATCH] be more vim-ish, and also syntax hilight Signed-off-by lines.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:39:35Z","receivedAt":"2006-10-18T00:39:35Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n contrib/vim/syntax/gitcommit.vim |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\nindex a9de09f..d0c6e5d 100644\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ b/contrib/vim/syntax/gitcommit.vim\n@@ -1,3 +1,14 @@\n+\" Vim syntax file\n+\" Language:\tgit commit message\n+\n+\" Quit when a (custom) syntax file was already loaded\n+if exists(\"b:current_syntax\")\n+  finish\n+endif\n+\n+syn region gitSignedOff start=/^Signed-off-by:/ end=/$/ contains=gitAuthor,gitEmail\n+syn region gitAuthor contained start=/\\s/ end=/$/\n+\n syn region gitLine start=/^#/ end=/$/\n syn region gitCommit start=/^# Updated but not checked in:$/ end=/^#$/ contains=gitHead,gitCommitFile\n syn region gitHead contained start=/^#   (.*)/ end=/^#$/\n@@ -8,6 +19,9 @@ syn match gitCommitFile contained /^#\\t.\n syn match gitChangedFile contained /^#\\t.*/hs=s+2\n syn match gitUntrackedFile contained /^#\\t.*/hs=s+2\n \n+hi def link gitSignedOff Keyword\n+hi def link gitAuthor Normal\n+\n hi def link gitLine Comment\n hi def link gitCommit Comment\n hi def link gitChanged Comment\n@@ -16,3 +30,7 @@ hi def link gitUntracked Comment\n hi def link gitCommitFile Type\n hi def link gitChangedFile Constant\n hi def link gitUntrackedFile Constant\n+\n+let b:current_syntax = \"git\"\n+\n+\" vim: ts=8 sw=2\n-- \n1.4.2.3\n"},{"id":"29037","messageId":"11611319761977-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"11611319762395-git-send-email-madcoder@debian.org","subject":"[PATCH] Nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:39:36Z","receivedAt":"2006-10-18T00:39:36Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n contrib/vim/README                 |   10 +++++\n contrib/vim/ftplugin/gitcommit.vim |   75 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 85 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex 9e7881f..e5ca9ae 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -6,3 +6,13 @@ To syntax highlight git's commit message\n      $ cat >>$HOME/.vimrc <<'EOF'\n      autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n      EOF\n+\n+To use the fancy split-view with the currently commited diff, you need to:\n+  1. Copy ftplugin/gitcommit.vim to vim's ftplugin directory:\n+     $ mkdir -p $HOME/.vim/ftplugin\n+     $ cp ftplugin/gitcommit.vim $HOME/.vim/ftplugin\n+  2. Auto-detect the editing of git commit files (see above).\n+  3. You can configure the diff to spawn automatically by setting:\n+     let git_diff_spawn_mode = 1 (or 2) for an horiz (resp. vert) split.\n+     else you have the bindings ,gd or ,ghd to spawn an horiz split with\n+     the diff, and ,gvd for the same with a vertical diff.\ndiff --git a/contrib/vim/ftplugin/gitcommit.vim b/contrib/vim/ftplugin/gitcommit.vim\nnew file mode 100644\nindex 0000000..a9cb946\n--- /dev/null\n+++ b/contrib/vim/ftplugin/gitcommit.vim\n@@ -0,0 +1,75 @@\n+if exists(\"b:did_ftplugin\")\n+  finish\n+endif\n+\n+let b:did_ftplugin = 1\n+\n+setlocal tw=74\n+setlocal nowarn nowb\n+\n+\"{{{ function Git_diff_windows\n+\n+function! Git_diff_windows(vertsplit, auto)\n+    let i = 0\n+    let list_of_files = ''\n+\n+    \" drop everything until '#  (will commit)' and the next empty line\n+    while i <= line('$')\n+        let line = getline(i)\n+        if line =~ '^#\\s*(will commit)$'\n+            let i = i + 2\n+            break\n+        endif\n+\n+        let i = i + 1\n+    endwhile\n+\n+    \" read file names until we have EOF or an empty line\n+    while i <= line('$')\n+        let line = getline(i)\n+        if line =~ '^#\\s*[a-z ]*:.*->.*$'\n+            let file = substitute(line, '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+        elseif line =~ '^#\\s*[a-z ]*:'\n+            let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$', '\\1', '')\n+            let list_of_files = list_of_files . ' '.file\n+        elseif line =~ '^#\\s*$'\n+            break\n+        endif\n+\n+        let i = i + 1\n+    endwhile\n+\n+    if list_of_files == \"\"\n+        return\n+    endif\n+\n+    if a:vertsplit\n+        rightbelow vnew\n+    else\n+        rightbelow new\n+    endif\n+    silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile\n+    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n+    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n+    setlocal nomodifiable\n+    if a:auto\n+        redraw!\n+        wincmd p\n+        redraw!\n+    endif\n+endfunction\n+\n+\"}}}\n+\n+noremap <buffer> ,gd :call Git_diff_windows(0, 0)<cr>\n+noremap <buffer> ,ghd :call Git_diff_windows(0, 0)<cr>\n+noremap <buffer> ,gvd :call Git_diff_windows(1, 0)<cr>\n+\n+if g:git_diff_spawn_mode == 1\n+    call Git_diff_windows(0, 1)\n+elseif g:git_diff_spawn_mode == 2\n+    call Git_diff_windows(1, 1)\n+endif\n-- \n1.4.2.3\n"},{"id":"29040","messageId":"200610180240.54775.madcoder@debian.org","threadId":"5941","inReplyTo":"11611319761977-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] Nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:40:54Z","receivedAt":"2006-10-18T00:40:54Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Le mer 18 octobre 2006 02:39, Pierre Habouzit a écrit :\n> Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n\ndamn, sorry, that's still not the good one :|\n\n/me feels very tired.\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"29046","messageId":"11611324463754-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"11611319762395-git-send-email-madcoder@debian.org","subject":"Make the ftplugin right wrt gitdir","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:47:25Z","receivedAt":"2006-10-18T00:47:25Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"sorry for the mess, I'm a bit tired :)\nHere is a third patch to fix the plugin to find the git-dir properly.\n\nAlso add a nice shortcut to quit that buffer.\n"},{"id":"29045","messageId":"1161132446703-git-send-email-madcoder@debian.org","threadId":"5941","inReplyTo":"11611324463754-git-send-email-madcoder@debian.org","subject":"[PATCH] be more robust wrt the git-dir.","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T00:47:26Z","receivedAt":"2006-10-18T00:47:26Z","isPatch":true,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Signed-off-by: Pierre Habouzit <madcoder@debian.org>\n---\n contrib/vim/ftplugin/gitcommit.vim |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/vim/ftplugin/gitcommit.vim b/contrib/vim/ftplugin/gitcommit.vim\nindex a9cb946..e958fb1 100644\n--- a/contrib/vim/ftplugin/gitcommit.vim\n+++ b/contrib/vim/ftplugin/gitcommit.vim\n@@ -52,9 +52,17 @@ function! Git_diff_windows(vertsplit, au\n         rightbelow new\n     endif\n     silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile\n-    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n-    exe 'normal :r!LANG=C cd ..; git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n+    let gitDir = system('git rev-parse --git-dir 2>/dev/null')\n+    let gitDir = substitute(gitDir, '.git\\n', '', '')\n+    let wd = getcwd()\n+    if gitDir != ''\n+        exe 'cd '.gitDir\n+    endif\n+    exe 'normal :r!LANG=C git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n+    exe 'normal :r!LANG=C git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n+    exe 'cd '.wd\n     setlocal nomodifiable\n+    noremap <buffer> q :bw<cr>\n     if a:auto\n         redraw!\n         wincmd p\n-- \n1.4.2.3\n"},{"id":"29059","messageId":"20061018015704.GQ20017@pasky.or.cz","threadId":"5941","inReplyTo":"46d6db660610171448h53de5e40wf55f19d6458127ef@mail.gmail.com","subject":"Re: [PATCH] nice ftplugin for vim, that shows the commited diff in a split'ed buffer.","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-18T01:57:04Z","receivedAt":"2006-10-18T01:57:04Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Oct 17, 2006 at 11:48:51PM CEST, I got a letter\nwhere Christian MICHON <christian.michon@gmail.com> said that...\n> I'd like particularly to know if a git-explorer type of plugin makes\n> sense for (g)vim and would like in this case be part of the team\n> developping it... using git of course :)\n\nSee also\n\n\thttp://news.gmane.org/find-root.php?message_id=<20051124093322.GA3899@mail.yhbt.net>\n\nPersonally, I'd say \"just use tig\". :-)\n\nIf you insist on living instide vim, that particular script comes from\nthe age before git-show and git-cat-file -p so it would probably make\nsense to move the bulk of the functionality there.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"29080","messageId":"20061018065940.GC3507@coredump.intra.peff.net","threadId":"5941","inReplyTo":"11611319762395-git-send-email-madcoder@debian.org","subject":"Re: [PATCH] be more vim-ish, and also syntax hilight Signed-off-by lines.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-10-18T06:59:40Z","receivedAt":"2006-10-18T06:59:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 18, 2006 at 02:39:35AM +0200, Pierre Habouzit wrote:\n\n> +if exists(\"b:current_syntax\")\n> +  finish\n> +endif\n\nI think this is a good change (along with commenting), but please write\na more descriptive commit message than \"be more vim-ish\" (I wouldn't\nmind seeing this and the highlighting change broken into two patches,\nsince they are functionally completely unrelated).\n\n> +syn region gitSignedOff start=/^Signed-off-by:/ end=/$/ contains=gitAuthor,gitEmail\n> +syn region gitAuthor contained start=/\\s/ end=/$/\n\nYou mention gitEmail but never define it. Are people using other things\nbesides Signed-off-by? I think we might do better to simply write:\n  syn region gitCommentHeader start=/^[^ ]\\+:/ end=/$/ contains=gitCommentValue\n  syn region gitCommentValue contained start=/\\s/ end=/$/\n\nHighlighting only the header is inconsistent with other highlighting\n(e.g., all of \"new file: foo\" is highlighted), but it looks so ugly to\nhighlight the whole line, so I think this is fine.\n\n-Peff\n"},{"id":"29081","messageId":"20061018070239.GD3507@coredump.intra.peff.net","threadId":"5941","inReplyTo":"11611324463754-git-send-email-madcoder@debian.org","subject":"Re: Make the ftplugin right wrt gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-10-18T07:02:39Z","receivedAt":"2006-10-18T07:02:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 18, 2006 at 02:47:25AM +0200, Pierre Habouzit wrote:\n\n> sorry for the mess, I'm a bit tired :)\n> Here is a third patch to fix the plugin to find the git-dir properly.\n> \n> Also add a nice shortcut to quit that buffer.\n\nLooks like the patch is missing (more sleep required?).\n\n-Peff\n"},{"id":"29083","messageId":"200610181010.59995.madcoder@debian.org","threadId":"5941","inReplyTo":"20061018070239.GD3507@coredump.intra.peff.net","subject":"Re: Make the ftplugin right wrt gitdir","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T08:10:59Z","receivedAt":"2006-10-18T08:10:59Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Le mer 18 octobre 2006 09:02, Jeff King a écrit :\n> On Wed, Oct 18, 2006 at 02:47:25AM +0200, Pierre Habouzit wrote:\n> > sorry for the mess, I'm a bit tired :)\n> > Here is a third patch to fix the plugin to find the git-dir\n> > properly.\n> >\n> > Also add a nice shortcut to quit that buffer.\n>\n> Looks like the patch is missing (more sleep required?).\n\nerr, the patch is here: \n<1161132446703-git-send-email-madcoder@debian.org>\n\nat least I see it on the list for my part\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"29090","messageId":"20061018090231.GA18807@coredump.intra.peff.net","threadId":"5941","inReplyTo":"200610181010.59995.madcoder@debian.org","subject":"Re: Make the ftplugin right wrt gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-10-18T09:02:32Z","receivedAt":"2006-10-18T09:02:32Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 18, 2006 at 10:10:59AM +0200, Pierre Habouzit wrote:\n\n> > Looks like the patch is missing (more sleep required?).\n> \n> err, the patch is here: \n> <1161132446703-git-send-email-madcoder@debian.org>\n\nRight, that's the \"be more robust\" patch which applies on top of\nsomething else (presumably \"nice ftplugin for vim\"), but the last one I\ngot of that (<11611319761977-git-send-email-madcoder@debian.org>) causes\nvim errors and you immediately followed up with \"that's still not the\ngood one.\" Where is that patch?\n\n-Peff\n"},{"id":"29093","messageId":"200610181107.56260.madcoder@debian.org","threadId":"5941","inReplyTo":"20061018090231.GA18807@coredump.intra.peff.net","subject":"Re: Make the ftplugin right wrt gitdir","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2006-10-18T09:07:54Z","receivedAt":"2006-10-18T09:07:54Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"Le mer 18 octobre 2006 11:02, Jeff King a écrit :\n> On Wed, Oct 18, 2006 at 10:10:59AM +0200, Pierre Habouzit wrote:\n> > > Looks like the patch is missing (more sleep required?).\n> >\n> > err, the patch is here:\n> > <1161132446703-git-send-email-madcoder@debian.org>\n>\n> Right, that's the \"be more robust\" patch which applies on top of\n> something else (presumably \"nice ftplugin for vim\"), but the last one\n> I got of that (<11611319761977-git-send-email-madcoder@debian.org>)\n> causes vim errors and you immediately followed up with \"that's still\n> not the good one.\" Where is that patch?\n\nhmm I see, curious though, I must have do sth stupid :|\n\nwell the result file is here: \nhttp://madism.org/~madcoder/dotfiles/vim/ftplugin/git.vim\n\nI've not access to my git repo from here, feel free to grab it and \ncommit it, I don't care if there is not my name on it.\n\nand as of gitEmail you're right I don't use it, I wanted to to hilight \nthe email address in the gitAuthor zone, but well, basically, it sucks, \nthat makes too many colors.\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"29098","messageId":"20061018094651.GA19907@coredump.intra.peff.net","threadId":"5941","inReplyTo":"200610181107.56260.madcoder@debian.org","subject":"Re: Make the ftplugin right wrt gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-10-18T09:46:51Z","receivedAt":"2006-10-18T09:46:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 18, 2006 at 11:07:54AM +0200, Pierre Habouzit wrote:\n\n> well the result file is here: \n> http://madism.org/~madcoder/dotfiles/vim/ftplugin/git.vim\n\nI was able to grab it...my comments are below.\n\n>  if exists(\"b:did_ftplugin\")\n>    finish\n>  endif\n>  \n>  let b:did_ftplugin = 1\n>  \n>  setlocal tw=74\n>  setlocal nowarn nowb\n\nDo things like tw really have anything to do with the ftplugin?\nShouldn't they instead go into the user's vimrc?\n\n>  \"{{{ function Git_diff_windows\n>  \n>  function! Git_diff_windows(vertsplit, auto)\n>      let i = 0\n>      let list_of_files = ''\n>  \n>      \" drop everything until '#  (will commit)' and the next empty line\n>      while i <= line('$')\n>          let line = getline(i)\n>          if line =~ '^#\\s*(will commit)$'\n>              let i = i + 2\n>              break\n>          endif\n>  \n>          let i = i + 1\n>      endwhile\n>  \n>      \" read file names until we have EOF or an empty line\n>      while i <= line('$')\n>          let line = getline(i)\n>          if line =~ '^#\\s*[a-z ]*:.*->.*$'\n>              let file = substitute(line, '\\v^#[^:]*:.*->\\s*(.*)\\s*$', '\\1', '')\n>              let list_of_files = list_of_files . ' '.file\n>              let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*->.*$', '\\1', '')\n>              let list_of_files = list_of_files . ' '.file\n>          elseif line =~ '^#\\s*[a-z ]*:'\n>              let file = substitute(line, '\\v^#[^:]*:\\s*(.*)\\s*$', '\\1', '')\n>              let list_of_files = list_of_files . ' '.file\n>          elseif line =~ '^#\\s*$'\n>              break\n>          endif\n>  \n>          let i = i + 1\n>      endwhile\n>  \n>      if list_of_files == \"\"\n>          return\n>      endif\n>  \n>      if a:vertsplit\n>          rightbelow vnew\n>      else\n>          rightbelow new\n>      endif\n\nThis all looks OK to me, but then I don't really know vim script very\nwell. :)\n\n>      silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile\n>      let gitDir = system('git rev-parse --git-dir 2>/dev/null')\n>      let gitDir = substitute(gitDir, '.git\\n', '', '')\n>      let wd = getcwd()\n>      if gitDir != ''\n>          exe 'cd '.gitDir\n>      endif\n>      exe 'normal :r!LANG=C git diff HEAD -- ' . list_of_files . \"\\n1Gdd\"\n>      exe 'normal :r!LANG=C git diff HEAD -- ' . list_of_files . \" \\| git apply --stat\\no\\<esc>1GddO\\<esc>\"\n>      exe 'cd '.wd\n>      setlocal nomodifiable\n\nThis procedure seems a bit hack-ish and fragile. I think the chdir is\nnecessary not just to handle autochdir, but also because we want to do\nany diff from the top-level instead of a subdir. Why do we\nunconditionally set LANG=C? What about quoting for the file list?\n\nIn general, is this really that much nicer than simply using the '-v'\nflag to git-commit?\n\n>  if g:git_diff_spawn_mode == 1\n>      call Git_diff_windows(0, 1)\n>  elseif g:git_diff_spawn_mode == 2\n>      call Git_diff_windows(1, 1)\n>  endif\n\nThis should probably handle the case where g:git_diff_spawn_mode is not\ndefined (otherwise vim complains loudly):\n  if exists(\"g:git_diff_spawn_mode\")\n     \" do nothing\n  elseif g:git_diff_spawn_mode == 1\netc.\n\n-Peff\n"}]}