X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.vim%2Fscript%2Fp4;h=f599b3fa66d4262f688dced9505ab5d837d334d8;hb=cf5f78bd9314e698743b785236369e245473e3f0;hp=9f77833de1c57151e7640cd8a02be0017d0c44af;hpb=258988f92389cb66122778b4876a1390b7e6ae00;p=profile.git diff --git a/.vim/script/p4 b/.vim/script/p4 index 9f77833..f599b3f 100644 --- a/.vim/script/p4 +++ b/.vim/script/p4 @@ -5,19 +5,30 @@ fun! P4submit() " There's no point doing this if the spec is readonly. That probably means " it's a submitted change. if ! &ro + setf perforce + " Clear the unnamed register. let @" = "" try " Delete the spec blurb if it exists. - /^# A Perforce Change Spec/,/^$/d + /^# A Perforce Change Spec/,/^# *(New changelists only\.)$/d " If the blurb was deleted the text will be in the unnamed register. - if @" != "" + if @" != "grgergregergeg" + " Delete the blank line left above the remaining fields. + 1 + delete + " Allow closing an unmodified spec. set nomod + " Get the files in the changelist. + let l:files = system("sed -n 's@^ \\(//.*\\) #.*@\\1@p' " . bufname("")) " Create a new window, move it below the spec and read in a diff. botright new - r!p4 diff + if l:files != "" + exe "r!env P4DIFF= p4 diff -du " . substitute(l:files, "\n", " ", "g") + endif + setf diff " Delete the blank line left above the diff.