[61336] contrib/mpvim

mnick at macports.org mnick at macports.org
Tue Dec 8 19:34:22 PST 2009


Revision: 61336
          http://trac.macports.org/changeset/61336
Author:   mnick at macports.org
Date:     2009-12-08 19:34:22 -0800 (Tue, 08 Dec 2009)
Log Message:
-----------
* new MPpatch command to show vimdiffs for patches hosted on trac
* MPpatch documentation

Modified Paths:
--------------
    contrib/mpvim/README
    contrib/mpvim/ftplugin/portfile.vim

Modified: contrib/mpvim/README
===================================================================
--- contrib/mpvim/README	2009-12-09 03:33:02 UTC (rev 61335)
+++ contrib/mpvim/README	2009-12-09 03:34:22 UTC (rev 61336)
@@ -3,12 +3,18 @@
 Portfiles and running lint from vim.
 
 === Installation
-copy the files in this directory into ~/.vim
+run 'make install' or copy the files in this directory into ~/.vim
 
 === Usage
 * :make runs 'port lint' on the Portfile in the current buffer
+
+* :MPpatch <url> applies the patch located at <url> to the Portfile
+  in the current buffer and shows the differences with vimdiff. Also
+  automatically fetches the patch format in case the diff is on trac.
+
 * add 'let g:portfile_highlight_space_errors=1' to your .vimrc to highlight mixed
   spaces and tabs in Portfiles as errors
+
 * mpvim supports snipMate (http://www.vim.org/scripts/script.php?script_id=2540)
   snippets. "new<Tab>" in a new buffer named Portfile will create a new 
   Portfile skeleton. Subsequent <Tab>'s will cycle through the variables.

Modified: contrib/mpvim/ftplugin/portfile.vim
===================================================================
--- contrib/mpvim/ftplugin/portfile.vim	2009-12-09 03:33:02 UTC (rev 61335)
+++ contrib/mpvim/ftplugin/portfile.vim	2009-12-09 03:34:22 UTC (rev 61336)
@@ -1,5 +1,7 @@
+" ============================================================================
 " Vim filetype plugin for portfile
-" Author: Maximilian Nickel <mnick at macports.org>
+" Maintainer: Maximilian Nickel <mnick at macports.org>
+" ============================================================================
 
 if exists("b:did_ftplugin")
 	finish
@@ -12,8 +14,18 @@
 			exe "copen"
 		end
 	endfunction
+
+	function TracPatch(url)
+		let patchfile="$TMPDIR/portfile.patch"
+		let url = substitute(a:url, "/attachment/", "/raw-attachment/", "")
+		let cmd = "!curl --progress-bar -o \"" . patchfile . "\" \"" . url . "\""
+		exe cmd
+		exe "diffpatch " . patchfile
+	endfunction
+
 	let g:did_mpftplugin = 1
 endif
 
 au QuickFixCmdPre make exe "cclose"
 au QuickFixCmdPost make call PortfileGetErrors()
+command! -nargs=1 MPpatch :call TracPatch("<args>") 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091208/9765b4cd/attachment.html>


More information about the macports-changes mailing list