aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/mpvim/ftplugin/portfile.vim
diff options
context:
space:
mode:
authorTeddy Wing2021-09-05 18:49:09 +0200
committerTeddy Wing2021-09-05 19:34:24 +0200
commit696766cc8d9ab129274347a185951a474337ea77 (patch)
tree389ff6e74d9f600efb504a2b3200c6020ff95677 /bundle/mpvim/ftplugin/portfile.vim
parent25e5e7a7f759d0132b2d304299c0e3388e223e2d (diff)
downloaddotvim-696766cc8d9ab129274347a185951a474337ea77.tar.bz2
Add 'mpvim' plugin @ 513c455d5a902fff2b38edf86abc15c36688bf85
Provides syntax highlighting for MacPorts Portfiles. This code was copied from the 'macports-contrib' repository (https://github.com/macports/macports-contrib) at commit 513c455d5a902fff2b38edf86abc15c36688bf85 (https://github.com/macports/macports-contrib/tree/513c455d5a902fff2b38edf86abc15c36688bf85). The Vim plugin lives in a subdirectory of the 'macports-contrib' repository, so I'd have to include a whole mess of files that don't relate to Vim if I wanted to add the plugin as a submodule. I'd just as soon not have to copy the files into my repository tree like this, but it's better than adding a non-Vim submodule. Assuming it's okay to add these files to my repository, as the port file for this plugin describes it as being BSD licensed: https://github.com/macports/macports-ports/blob/12d7b1597bef875058758c9c587b7593f39a5af1/editors/mpvim/Portfile Unfortunately, there's no BSD license or copyright notice included in the plugin code. But I'm going to assume I'm allowed to redistribute it.
Diffstat (limited to 'bundle/mpvim/ftplugin/portfile.vim')
-rw-r--r--bundle/mpvim/ftplugin/portfile.vim40
1 files changed, 40 insertions, 0 deletions
diff --git a/bundle/mpvim/ftplugin/portfile.vim b/bundle/mpvim/ftplugin/portfile.vim
new file mode 100644
index 0000000..116c249
--- /dev/null
+++ b/bundle/mpvim/ftplugin/portfile.vim
@@ -0,0 +1,40 @@
+" vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+" ======================================================================
+" Vim filetype plugin for portfile
+" Maintainer: Maximilian Nickel <mnick@macports.org>
+" ======================================================================
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+if !exists("g:did_mpftplugin")
+ function PortfileGetErrors()
+ if !empty(getqflist())
+ 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>")
+
+" Ignore Portfile modeline
+setlocal nomodeline
+setlocal fileencoding=utf-8
+setlocal expandtab
+setlocal shiftwidth=4
+setlocal tabstop=4
+setlocal softtabstop=4