(Note: I originally sent this message to [email protected], but that seems
to have been eaten by a grue, so I'm trying again with googlegroups.)

Currently filetype.vim uses the pattern ".msg.[0-9]*" [0], but
git-send-email generates files named like ".gitsendemail.msg.XXXXXX" [1].

Evidently the gitsendemail ftplugin/syntax author knows this, as he
wrote [2]:

  " Filenames:  .gitsendemail.*

Here's a sample filename: .gitsendemail.msg.Npe8bi

Additionally, it would be nice IMO if *.patch files generated by
git-format-patch were highlighted in the same way as "gitsendemail"
files, since they look basically the same.

I propose the patch below.

Thanks.

0: https://github.com/vim/vim/blob/master/runtime/filetype.vim#L807
1: https://git.kernel.org/pub/scm/git/git.git/tree/git-send-email.perl#n676
2: https://github.com/vim/vim/blob/master/runtime/syntax/gitsendemail.vim#L11

--

--- a/runtime/filetype.vim      2017-07-10 15:32:05.000000000 +0000
+++ b/runtime/filetype.vim      2017-07-10 15:31:54.000000000 +0000
@@ -635,7 +635,13 @@
 au BufNewFile,BufRead dictd.conf               setf dictdconf
 
 " Diff files
-au BufNewFile,BufRead *.diff,*.rej,*.patch     setf diff
+au BufNewFile,BufRead *.diff,*.rej             setf diff
+au BufRead,BufNewFile *.patch
+       \ if getline(1) =~ '^From [0-9a-f]\{40\} Mon Sep 17 00:00:00 2001$' |
+       \   setf gitsendemail |
+       \ else |
+       \   setf diff |
+       \ endif
 
 " Dircolors
 au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS  setf dircolors
@@ -804,10 +810,7 @@
   au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config    setf gitconfig
 endif
 au BufNewFile,BufRead git-rebase-todo          setf gitrebase
-au BufNewFile,BufRead .msg.[0-9]*
-      \ if getline(1) =~ '^From.*# This line is ignored.$' |
-      \   setf gitsendemail |
-      \ endif
+au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
 au BufNewFile,BufRead *.git/*
       \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
       \   setf git |


-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui