diff options
author | Ryan Phillips <rphillips@gentoo.org> | 2005-06-07 16:33:57 +0000 |
---|---|---|
committer | Ryan Phillips <rphillips@gentoo.org> | 2005-06-07 16:33:57 +0000 |
commit | ccb285aa4d0f9b71e2e9111709ae16744835bff2 (patch) | |
tree | b694700653f3a0b17e9ab77f6c981e8612d5c811 | |
download | gentoo-syntax-ccb285aa4d0f9b71e2e9111709ae16744835bff2.tar.gz gentoo-syntax-ccb285aa4d0f9b71e2e9111709ae16744835bff2.tar.bz2 gentoo-syntax-ccb285aa4d0f9b71e2e9111709ae16744835bff2.zip |
initial import
svn path=/trunk/; revision=1
34 files changed, 2523 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f88c7e9 --- /dev/null +++ b/Makefile @@ -0,0 +1,104 @@ +# Makefile for gentoo-syntax + +distapp = gentoo-syntax +distver := $(shell date --iso | sed -e 's~-~~g') +distpkg := $(distapp)-$(distver) + +PREFIX = ${HOME}/.vim/ + +files_vars = \ + files_doc \ + files_ftdetect \ + files_ftplugin \ + files_indent \ + files_plugin \ + files_syntax + +files_doc = \ + doc/gentoo-syntax.txt + +files_ftdetect = \ + ftdetect/gentoo.vim \ + ftplugin/ebuild.vim \ + ftdetect/eclectic.vim + +files_ftplugin = \ + ftplugin/gentoo-changelog.vim \ + ftplugin/gentoo-metadata.vim \ + ftplugin/eclectic.vim + +files_indent = \ + indent/ebuild.vim \ + indent/gentoo-metadata.vim \ + indent/eclectic.vim + +files_plugin = \ + plugin/bugsummary.vim \ + plugin/gentoo-common.vim \ + plugin/newebuild.vim \ + plugin/newmetadata.vim \ + plugin/newinitd.vim \ + plugin/neweclectic.vim + +files_syntax = \ + syntax/ebuild.vim \ + syntax/gentoo-changelog.vim \ + syntax/gentoo-common.vim \ + syntax/gentoo-conf-d.vim \ + syntax/gentoo-env-d.vim \ + syntax/gentoo-init-d.vim \ + syntax/gentoo-make-conf.vim \ + syntax/gentoo-metadata.vim \ + syntax/gentoo-mirrors.vim \ + syntax/gentoo-package-keywords.vim \ + syntax/gentoo-package-mask.vim \ + syntax/gentoo-package-use.vim \ + syntax/gentoo-use-desc.vim \ + syntax/glep.vim \ + syntax/guidexml.vim \ + syntax/eclectic.vim + +files = $(foreach f, $(files_vars), $($(f)) ) + +scripts: ${files} + +install: install-dirs install-files + +install-dirs: $(foreach a, $(sort $(dir $(files))), \ + install-dir-$(a)) + +install-files: $(foreach a, $(sort $(files)), \ + install-file-$(subst /,_,$(a) )) + +install-dir-%: + mkdir -p "$(PREFIX)/$*" + +install-file-%: $(subst _,/,$*) + cp "$(subst _,/,$*)" "$(PREFIX)/$(subst _,/,$*)" + +uninstall : uninstall-files + +uninstall-files: $(foreach a, $(sort $(files)), \ + uninstall-file-$(subst /,_,$(a) )) + +uninstall-file-%: $(subst _,/,$*) + [ ! -f "$(PREFIX)/$(subst _,/,$*)" ] || rm "$(PREFIX)/$(subst _,/,$*)" + +dist: + mkdir "$(distpkg)" + $(MAKE) PREFIX="$(distpkg)" install + cp README "$(distpkg)/" + tar jcf "$(distpkg).tar.bz2" "$(distpkg)" + rm -fr "$(distpkg)/" + +dist-sign: dist + gpg --armour --detach-sign "$(distpkg).tar.bz2" + mv "$(distpkg).tar.bz2.asc" "$(distpkg).tar.bz2.signature" + +dist-upload: dist dist-sign + echo -ne "user anonymous gentoo-syntax\ncd incoming\nput $(distpkg).tar.bz2\nput $(distpkg).tar.bz2.signature\nbye" | \ + ftp -n ftp.berlios.de + +clean: + find . -name '*~' | xargs rm || true + @@ -0,0 +1,26 @@ +INSTALL INSTRUCTIONS +-------------------- + +* Gentoo users: `emerge app-vim/gentoo-syntax` +* Everyone else: `make PREFIX=~/.vim/ install` + +COPYRIGHT +--------- + +Copyright (c) 2004-2005 Ciaran McCreesh, Aaron Walker, Tom Martin. You may +redistribute this package under the same terms as Vim itself. + +CONTACT +------- + +Email: + +* Ciaran McCreesh `<ciaranm at gentoo dot org>`_ +* Aaron Walker `<ka0ttic at gentoo dot org>`_ +* Tom Martin `<slarti at gentoo dot org>`_ + +Bugs: + +* `<http://bugs.gentoo.org/>`_ + +.. vim: set ft=glep tw=80 et : diff --git a/doc/gentoo-syntax.txt b/doc/gentoo-syntax.txt new file mode 100644 index 0000000..bb9c8b2 --- /dev/null +++ b/doc/gentoo-syntax.txt @@ -0,0 +1,565 @@ +*gentoo-syntax.txt* Gentoo Syntax Plugin + +Authors: Ciaran McCreesh <ciaranm at gentoo dot org> + Aaron Walker <ka0ttic at gentoo dot org> + Tom Martin <slarti at gentoo dot org> + +============================================================================== +1. Contents *gentoo-syntax* + + 1. Contents |gentoo-syntax| + + 2. Plugin Information |gentoo-syntax-overview| + Detection Specifics |gentoo-syntax-detection| + Highlighting Specifics |gentoo-syntax-highlighting| + Common Syntax Rules |gentoo-common-syntax| + Ebuild and Eclass Files |gentoo-ebuild-syntax| + GLEP Files |gentoo-glep-syntax| + ChangeLogs |gentoo-changelog-syntax| + conf.d Files |gentoo-conf.d-syntax| + cron.d Files |gentoo-cron.d-syntax| + env.d Files |gentoo-env.d-syntax| + GuideXML Syntax |gentoo-guidexml-syntax| + init.d Files |gentoo-init.d-syntax| + make.conf Files |gentoo-make-conf-syntax| + metadata.xml Files |gentoo-metadata-syntax| + package.(un)mask |gentoo-package-mask-syntax| + package.keywords |gentoo-package-keywords-syntax| + package.use |gentoo-package-use-syntax| + thirdpartymirrors |gentoo-mirrors-syntax| + use.desc, use.local.desc |gentoo-use-desc-syntax| + Settings Specifics |gentoo-syntax-settings| + Indent Specifics |gentoo-indent-settings| + Bug Summary |:BugSummary| + New conf.d Files |new-conf.d| + New Ebuilds |new-ebuilds| + New init.d Files |new-init.d| + New Metadata |new-metadata| + + 3. ChangeLog |gentoo-syntax-changelog| + +============================================================================== +2. Plugin Information *gentoo-syntax-overview* + + The gentoo-syntax package provides a collection of syntax, ftdetect, + ftplugin and indent files to help Gentoo developers and users work + with ebuilds, eclasses, GLEPs, Gentoo style ChangeLogs, init.d / + conf.d / env.d / cron.d entries, /etc/portage/ files and so on. + + Detection Specifics *gentoo-syntax-detection* + + Ebuilds are detected by an 'ebuild' extension. Eclasses are detected + by an 'eclass' extension. Both ebuild and eclass files are assigned + the 'ebuild' filetype. + + GLEP files are detected by a 'txt' extension, followed by a check that + the first line of the file starts with "GLEP: ". They are assigned the + 'glep' filetype. + + Gentoo ChangeLogs are detected by the 'ChangeLog' filename and a + copyright header on the second line. + + init.d scripts are detected by being in /etc/init.d/ . They are also + detected if they are under a files/ directory and include a + '#!/sbin/runscript' header. + + conf.d, env.d and cron.d files are detected by being in the relevant + subdirectory in /etc. + + package.mask, package.unmask, package.keywords, package.use and + thirdpartymirrors files are detected by filename. + + make.conf files are detected by filename (make.globals is also + recognised). + + metadata.xml files are detected by filename. + + use.desc files are detected by filename (use.local.desc is also + recognised). + + Highlighting Specifics *gentoo-syntax-highlighting* + + Syntax highlighting is provided for ebuild/eclass, GLEP files, + Gentoo ChangeLogs and init.d / conf.d / env.d / cron.d scripts. + + *gentoo-common-syntax* + + Many of the syntax files are based upon gentoo-common.vim, which + provides basic syntax highlighting for header blocks and bug numbers. + + *gentoo-ebuild-syntax* + + The ebuild/eclass syntax file builds upon the vim-provided |sh.vim| + and adds in highlighting for: + * ebuild.sh / portage keywords + * functions from commonly used eclasses (eutils, flag-o-matic, + gcc, libtool, fixheadtails, webapp, webapp-apache, versionator, + cvs, fdo-mime, multilib, 64-bit, cron, games, toolchain-funcs, + subversion, alternatives, rpm, python, check-kernel, + perl-module, distutils) + * common mistakes (assigning to read-only variables, misspellings, + leading non-tab spaces, default WORKDIR assignment) + + *g:ebuild_error_on_trailing_whitespace* + Error highlighting for trailing whitespace is available but disabled + by default. To turn it on, add: +> + let g:ebuild_error_on_trailing_whitespace=1 +< + to your |vimrc| file. + + *gentoo-glep-syntax* + + Syntax highlighting for GLEP files is based upon the vim-provided rst + syntax file. Additional highlighting is available for the headers at + the top of the file and for heading sections. + + *gentoo-changelog-syntax* + + Syntax highlighting for Gentoo ChangeLogs is implemented from scratch + (some rules come from |gentoo-common-syntax|). + + *gentoo-conf.d-syntax* + + Syntax highlighting for conf.d files is based upon the vim-provided + |sh.vim|, with additional support for certain Gentooisms (some rules + come from |gentoo-common-syntax|). + + *gentoo-cron.d-syntax* + + Syntax highlighting for cron.d entries uses the vim-provided + crontab.vim file. + + *gentoo-env.d-syntax* + + Syntax highlighting for env.d files is based upon the vim-provided + |sh.vim|, with additional support for certain Gentooisms (some rules + come from |gentoo-common-syntax|). + + *gentoo-guidexml-syntax* + + Syntax highlighting for guidexml files is based upon the vim-provided + |xml.vim|. + + *gentoo-init.d-syntax* + + Syntax highlighting for init.d files is based upon the vim-provided + |sh.vim|, with additional support for certain Gentooisms (some rules + come from |gentoo-common-syntax|). + + *gentoo-make-conf-syntax* + + Syntax highlighting for make.conf files is implemented from scratch + (some rules come from |gentoo-common-syntax|). + + *gentoo-metadata-syntax* + + Syntax highlighting for metadata.xml files is based upon the + vim-provided |xml.vim|, with additional highlighting for recognised + elements. + + *gentoo-package-mask-syntax* + + Syntax highlighting for package.mask and package.unmask files is + implemented from scratch (some rules come from + |gentoo-common-syntax|). + + *gentoo-package-keywords-syntax* + + Syntax highlighting for package.keywords files is implemented from + scratch (some rules come from |gentoo-common-syntax|). + + *gentoo-package-use-syntax* + + Syntax highlighting for package.use files is implemented from scratch + (some rules come from |gentoo-common-syntax|). + + *gentoo-mirrors-syntax* + + Syntax highlighting for thirdpartymirrors files is implemented from + scratch (some rules come from |gentoo-common-syntax|). + + *gentoo-use-desc-syntax* + Syntax highlighting for use.desc and use.local.desc is implemented + from scratch (some rules come from |gentoo-common-syntax|). + + Settings Specifics *gentoo-syntax-settings* + + For ebuilds and eclasses, tabs (|'shiftwidth'| and |'tabstop'|) are + set to four spaces, tab to space conversion (|'expandtab'|) is disabled + and the text width (|'textwidth'|) is set to 80 columns. To allow + proper syntax highlighting for commands like 'strip-flags', the hyphen + character is added as a valid keyword character (|'iskeyword'|). + + For ebuilds, eclasses and ChangeLogs, UTF-8 is used for fileencoding + as per GLEP 31. + + Indent Specifics *gentoo-indent-settings* + + Indent settings for ebuilds and eclasses are the same as for regular + bash files. + + Bug Summary *:BugSummary* + + To see a summary of a Gentoo bug, execute :BugSummary 12345. + + *:BugDetails* + The :BugDetails 12345 command is similar to :BugSummary, but will also + display a menu allowing the user to open the bug in a browser or + insert the bug details / number into the active document. In normal + mode, a map <Leader>bug (see |<Leader>|) is provided to call this + command on the bug number under the cursor. + + *g:bugsummary_browser* + Before using the "browser" BugSummary option, you must let the plugin + know what browser you want to use. For example: > + + let g:bugsummary_browser="firefox '%s'" +< + The %s sequence is replaced by the URL to load. + + New conf.d Files *new-conf.d* *:NewConfd* + + New conf.d files will automatically have a skeleton content created + for them. + + The ':NewConfd' command can be used to manually create contents for a + new conf.d file. + + Note: conf.d files may not be detected automatically. The |:NewConfd| + command will still work in these situations. + + New Ebuilds *new-ebuilds* *:NewEbuild* + + New ebuilds will automatically have content placed into them based + upon context (for example, the package category). Similarly, new + eclasses are created from a template. If the environment variable + 'ECHANGELOG_USER' is set, it will be used for the author's name. + Otherwise, the 'USER' environment variable will be used. + + The ':NewEbuild' command can be used to manually create contents for a + new ebuild or eclass file. + + New init.d Files *new-init.d* *:NewInitd* + + New init.d files will automatically have a skeleton content created + for them. + + The ':NewInitd' command can be used to manually create contents for a + new init.d file. + + Note: init.d files may not be detected automatically. The |:NewInitd| + command will still work in these situations. + + New Metadata *new-metadata* *:NewMetadata* + + New metadata.xml files will automatically have content placed into + them based upon context (for example, the package category). If the + environment variable 'ECHANGELOG_USER' is set, it will be used for the + author's name and email address. + + The ':NewMetadata' command can be used to manually create contents for + a new metadata file. + + Note: metadata.xml files may not be detected automatically. The + |:NewMetadata| command will still work in these situations. + +============================================================================== +3. ChangeLog *gentoo-syntax-changelog* + + 20050515 beu + * Testing, testing .. Fix a 'few' typo's in syntax/eclectic.vim. + + 20050515 ciaranm (Release) + * Better indenting for eclectic modules. + + 20050514 beu + * Add dev-perl specific inherit of perl-module. + + 20050514 ciaranm + * Highlighting in make.conf for ccache and distcc variables. + Gentoo bug 92238 <http://bugs.gentoo.org/show_bug.cgi?id=92238> + + 20050511 beu + * Add minimal support for eclectic-module filetype and syntax + highlighting. + * Add goodness to create boiler-plate eclectic modules on a new + buffer ('*.eclectic'). + * add in support for SVN_DATE + + 20050510 ciaranm + * ${PN}-${PV} in ebuilds is an error, should be ${P} (requested by + seemant). + * Better heading highlighting for GLEPs. + * Much smarter cat/pkg detection. + + 20050415 beu + * Add support for apache-module and depend.apache eclass functions. + * Add a default setup for apache-module ebuilds (ebuilds in + www-apache/mod_name). + + 20050326 ciaranm + * Add PORTAGE_TMPFS to make.conf highlighting. + + 20050325 ciaranm + * Add ALSA_CARDS to make.conf highlighting. + + 20050325 ciaranm (Release) + * Make this lot work properly with vim 6.3 again. Oops. + + 20050323 ciaranm + * Better category / package distinction in new metadata creation + plugin. + + 20050318 ciaranm (Release) + * USERLAND in make.conf is an error. Recognise EXTRA_ECONF. + + 20050317 ciaranm + * catmetadata support + * Add in sanity checking. Check version and &compatible. Thanks to + Rob Henderson in Gentoo bug #85425 + <http://bugs.gentoo.org/show_bug.cgi?id=85425>. + + 20050316 ka0ttic + * Updated cron eclass functions. + * Added support for distutils and perl-module eclasses. + + 20050305 ciaranm + * x86-64, x86_64 in CFLAGS are errors. + * -mvis in CFLAGS is an error. + * on amd64, -Os -fPIC -fpic -DPIC in CFLAGS are errors. + + 20050303 ciaranm + * dev.g.o in SRC_URI is wrong. + + 20050226 ciaranm + * Make USE flags with _ in the name work properly. + + 20050221 ka0ttic + * Removed useless newconfd plugin. + * Fixed missing endif in ftdetect/gentoo.vim that caused some XML + ftdetect funkyness. + + 20050216 ka0ttic + * Updated cron and eutils eclass functions. + + 20050211 ciaranm (Release) + + 20050210 ciaranm + * Move arch guessing code into gentoo-common.vim. Cache the + results, since portageq is very slow. Changed the logic so that + it should (probably) generate the correct values on non-Linux + systems. + * Fix detection of thirdpartymirrors file + + 20050207 ciaranm + * Added ASFLAGS and ARCH to the make.conf error list. + + 20050202 ka0ttic + * Added missing runscript shebang to init.d plugin. + + 20050201 ka0ttic + * Updated bash-completion eclass functions. + + 20050130 ciaranm (Release) + * Rewrite Makefile. + * Update docs. + * Improved init.d syntax highlighting. + * Add in EXPORT_FUNCTIONS eclass highlighting. + + 20050128 ciaranm + * Restructure plugins. Add in a gentoo-common.vim to reduce + code duplication, and switch to using put ='' to insert text. + * Updated years. + + 20050128 ka0ttic + * Updated webapp eclass functions. + * Added init.d/conf.d creation plugin. + + 20050125 ciaranm + * Update versionator eclass functions. + * Update eutils eclass functions. + * Update flag-o-matic eclass functions. + + 20050125 ka0ttic + * Added subversion eclass support. + * Added alternatives eclass support. + * Added rpm eclass support. + * Added python eclass support. + * Added check-kernel eclass support. + + 20050123 ciaranm + * Add LINGUAS, INPUT_DEVICES, VIDEO_CARDS to make.conf + highlighting. + + 20050122 ka0ttic + * Added toolchain-funcs eclass support. + * Added games eclass support. + * Added cron eclass support. + + 20050122 tmartin + * Added 64-bit eclass support. + * Added multilib eclass support. + + 20050122 ciaranm + * Added fdo-mime eclass support. + + 20050105 ciaranm + * Add sandbox functions (addwrite etc) to the highlight list. + + 20041227 ciaranm (Release) + * Make the arch detecting code work again with the new + make.defaults setup. + + 20041220 ciaranm + * An empty value for SLOT is an error in ebuilds. A * inside + KEYWORDS is an error unless it is a -*. + * -Wno* in CFLAGS is evil. + * Initial attempt at folding for GLEPs. + + 20041218 ciaranm + * Added games-* ebuild creation rules (requested by Michael + Sterrett, dev-python (Bryan Oestergaard), dev-java (Thomas + Matthijs). + * Added 'set paste' whilst creating content, thanks to Thomas + Matthijs for the bug report. + * Make metadata syntax matching use the contained option, so that + recognised words are only highlighted in the correct places. + * Added guidexml syntax, thanks to Sven Vermeulen and Xavier Neys + for information. + + 20041216 ciaranm + * Improved glep syntax handling + + 20041205 ciaranm + * metadata.xml support: recognise metadata.xml, set filetype + settings, fancy syntax highlighting based upon xml.vim, auto + create metadata.xml content for new files based upon context. + + 20041202 ciaranm (Release) + * Make newebuild also support eclass creation. + + 20041130 ciaranm + * Fix menu handler. Thanks to Georgi Georgiev in Gentoo bug 72888 + <http://bugs.gentoo.org/show_bug.cgi?id=72888>. + + 20041127 ciaranm + * Add in newebuild plugin which intelligently creates template + content for new ebuilds based upon context. + + 20041127 ciaranm (Release) + * BugSummary now provides :BugSummary and :BugDetails, with the + <Leader>bug nmap mapped to :BugDetails. + * Override sh.vim's handling of function names to include extra + characters. Thanks to Thomas Kirchner in Gentoo bug 72469 + <http://bugs.gentoo.org/show_bug.cgi?id=72469>. + + 20041125 ciaranm + * BugSummary plugin: massively faster parsing, recognise double + quotes in bug text properly, display a menu thing allowing the + user to open the bug in a browser / insert bug details, coloured + display. + * Use g: variables for settings + + 20041124 ciaranm + * Add in bash-completion, vim-plugin, vim-doc eclasses. + * Use "hi def link" rather than "hi link". + + 20041123 ciaranm + * Recognise /etc/portage/mirrors as a mirrors file. Thanks to + Georgi Georgiev in Gentoo bug 72228 + <http://bugs.gentoo.org/show_bug.cgi?id=72228>. + * Syntax highlighting for use.desc, use.local.desc + * Handle fancy characters in BugSummary better + + 20041122 ciaranm + * Add in -s and -DNDEBUG to the bad CFLAGS list at solar's + request. + * :BugSummary, not :ShowBugSummary. Thanks to TGL in Gentoo bug + 72001 <http://bugs.gentoo.org/show_bug.cgi?id=72001>. + * LDFLAGS in make.conf is an error at vapier's request. + + 20041121 ciaranm (Release) + * Handle * ~* in package.keywords + * make.conf highlighting + * Highlight stupid cat usage in ebuilds + * Added bugsummary plugin -- either :BugSummary 12345 or move over + a bug number and hit <Leader>bug in normal mode. Currently the + code is rather messy and tied to Gentoo bugzilla. + + 20041114 ciaranm + * Make ChangeLog highlighting less picky about entries where the + developer hasn't quite got their ECHANGELOG_USER right (for + example, if they just have an email address without the angle + brackets). Thanks to Thomas Matthijs in Gentoo bug 71164 + <http://bugs.gentoo.org/show_bug.cgi?id=71164>. + * Make ChangeLog highlighting recognise dates which don't have a + leading zero. + * Ebuilds shouldn't be touching EXTRA_ECONF, make this show up as + an error. + + 20041113 ciaranm (Release) + * As per GLEP 31, fileencoding should be utf-8 for ebuilds and + ChangeLogs. + * Highlight as errors functions declared as "foo () {" (extra + space, should be "foo() {". Similarly, "foo(){" needs a space + before the curly bracket, "foo() {". Requested by Michael + Sterrett. + * Added in some new keywords. Thanks to Tom Martin in Gentoo bug + 71065 <http://bugs.gentoo.org/show_bug.cgi?id=71065>. + * Added in quiet and verbose variants for 'has' and 'use'. + + 20041107 ciaranm + * Highlight TODO and FIXME items in GLEPs. + + 20041016 ciaranm + * config is now called pkg_config. Thanks to Tom Martin in Gentoo + bug 67807 <http://bugs.gentoo.org/show_bug.cgi?id=67807>. + + 20041009 ciaranm (Release) + * Highlight src_unpack and similar recognised function names + differently in ebuilds. Requested by Thomas Matthijs. + + 20041004 ciaranm + * Better 'bug 1234' highlighting + + 20040919 ciaranm + * Error on non GLEP 23 compliant LICENSEs + * cvs.eclass support + + 20040911 ciaranm (Release) + * Added versionator.eclass + + 20040908 ciaranm + * Inherit from sh.vim in ftplugin/ebuild.vim + + 20040906 ciaranm (Release) + * Update for recent eutils additions + * Indenting for ebuilds / eclasses + * Updated error highlighting + + 20040902 ciaranm + * init.d, env.d, cron.d, conf.d highlighting. + * package.mask, package.unmask, package.keywords, package.use, + thirdpartymirrors highlighting. + + 20040901 ciaranm (Release) + * ChangeLog support. + * Use rst for GLEPs. + * Added webapp.eclass, webapp-apache.eclass and fixheadtails.eclass + syntax. + + 20040826 ciaranm + * HOMEPAGE containing $ expressions is an error. + + 20040826 ciaranm (Release) + * Massive rework. Far better file layouts, keyword support, + filetype settings. Added a help doc. + * Highlighting for errors in ebuilds. + * Added gcc and libtool eclass support. + + 20040820 ciaranm + * First usable release + +============================================================================== +vim:tw=78:ts=8:ft=help diff --git a/ftdetect/eclectic.vim b/ftdetect/eclectic.vim new file mode 100644 index 0000000..d62796b --- /dev/null +++ b/ftdetect/eclectic.vim @@ -0,0 +1,18 @@ +" Vim filetype detection file +" Language: Eclectic Things +" Author: Elfyn McBratney <beu@gentoo.org> +" Copyright: Copyright (c) 2005 Elfyn McBratney +" Licence: You may redistribute this under the same terms as Vim itself +" +" This sets up syntax highlighting for Eclectic modules. +" + +if &compatible || v:version < 603 + finish +endif + +" eclectic modules +au BufNewFile,BufRead *.eclectic + \ set filetype=eclectic + +" vim: sw=4 ts=4 et fdm=marker diff --git a/ftdetect/gentoo.vim b/ftdetect/gentoo.vim new file mode 100644 index 0000000..58b1a8d --- /dev/null +++ b/ftdetect/gentoo.vim @@ -0,0 +1,94 @@ +" Vim filetype detection file +" Language: Gentoo Things +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" This sets up syntax highlighting for Gentoo ebuilds, eclasses, GLEPs and +" Gentoo style ChangeLogs. +" + +if &compatible || v:version < 603 + finish +endif + + +" ebuilds, eclasses +au BufNewFile,BufRead *.e{build,class} + \ set filetype=ebuild + +" GLEPs +au BufNewFile,BufRead *.txt + \ if (getline(1) =~? "^GLEP: ") | + \ set filetype=glep | + \ endif + +" ChangeLogs +au BufNewFile,BufRead ChangeLog + \ if (getline(2) =~? "^# Copyright \\d\\+-\\d\\+ Gentoo Foundation") | + \ set filetype=gentoo-changelog | + \ endif + +" /etc/init.d/ scripts +au BufNewFile,BufRead /etc/init.d/* + \ set filetype=gentoo-init-d | + +au BufNewFile,BufRead /*/files/* + \ if (getline(1) ==? "#!/sbin/runscript") | + \ set filetype=gentoo-init-d | + \ endif + +" /etc/conf.d/ scripts +au BufNewFile,BufRead /etc/conf.d/* + \ set filetype=gentoo-conf-d + +" /etc/env.d/ scripts +au BufNewFile,BufRead /etc/env.d/* + \ set filetype=gentoo-env-d + +" /etc/cron.d/ scripts +au BufNewFile,BufRead /etc/cron.d/* + \ set filetype=crontab + +" package.mask, package.unmask +au BufNewFile,BufRead package.{mask,unmask} + \ set filetype=gentoo-package-mask + +" package.keywords +au BufNewFile,BufRead package.keywords + \ set filetype=gentoo-package-keywords + +" package.use +au BufNewFile,BufRead package.use + \ set filetype=gentoo-package-use + +" thirdpartymirrors +au BufNewFile,BufRead {*/thirdpartymirrors,*/portage/mirrors} + \ set filetype=gentoo-mirrors + +" make.conf +au BufNewFile,BufRead make.{conf,globals} + \ set filetype=gentoo-make-conf + +" use.desc +au BufNewFile,BufRead use.{local.,}desc + \ set filetype=gentoo-use-desc + +" metadata.xml +au BufNewFile,BufRead metadata.xml + \ set filetype=gentoo-metadata + +" guidexml +au BufNewFile,BufRead *.xml + \ if getline(1) =~ "<!DOCTYPE guide " || + \ getline(2) =~ "<!DOCTYPE guide " || + \ getline(3) =~ "<!DOCTYPE guide " || + \ getline(4) =~ "<!DOCTYPE guide " || + \ getline(5) =~ "<!DOCTYPE guide " || + \ getline(6) =~ "<!DOCTYPE guide " || + \ getline(7) =~ "<!DOCTYPE guide " || + \ getline(8) =~ "<!DOCTYPE guide " || + \ getline(9) =~ "<!DOCTYPE guide " | + \ set filetype=guidexml | + \ endif + diff --git a/ftplugin/ebuild.vim b/ftplugin/ebuild.vim new file mode 100644 index 0000000..020dc83 --- /dev/null +++ b/ftplugin/ebuild.vim @@ -0,0 +1,29 @@ +" Vim filetype plugin file +" Language: Gentoo Ebuilds / Eclasses +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" This sets up filetype specific options for Gentoo ebuilds and eclasses. Most +" of these settings are mandated by policy.xml. Some settings are inherited +" from vim's sh.vim. UTF-8 is selected as per GLEP 31. +" + +if &compatible || v:version < 603 + finish +endif + +runtime! ftplugin/sh.vim + +" Include - in keyword characters (for strip-flags etc) +exec "setlocal iskeyword=" . &iskeyword . ",45" + +" Required whitespace settings +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal noexpandtab +setlocal textwidth=80 + +" GLEP 31 settings +setlocal fileencoding=utf-8 + diff --git a/ftplugin/eclectic.vim b/ftplugin/eclectic.vim new file mode 100644 index 0000000..4193e5b --- /dev/null +++ b/ftplugin/eclectic.vim @@ -0,0 +1,26 @@ +" Vim filetype plugin file +" Language: Eclectic Module (bash) +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" This sets up filetype specific options for ectic modules. These settings +" were pwned from ebuild.vim, but they wfm .. +" + +if &compatible || v:version < 603 + finish +endif + +runtime! ftplugin/sh.vim + +" Will-do-for-now whitespace settings +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal noexpandtab +setlocal textwidth=80 + +" GLEP 31 settings (??) +setlocal fileencoding=utf-8 + +" vim: sw=4 ts=4 et fdm=marker diff --git a/ftplugin/gentoo-changelog.vim b/ftplugin/gentoo-changelog.vim new file mode 100644 index 0000000..10f5009 --- /dev/null +++ b/ftplugin/gentoo-changelog.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: Gentoo ChangeLogs +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Sets up settings for Gentoo ChangeLogs as per GLEP 31. +" + +if &compatible || v:version < 603 + finish +endif + +" GLEP 31 settings +setlocal fileencoding=utf-8 + diff --git a/ftplugin/gentoo-metadata.vim b/ftplugin/gentoo-metadata.vim new file mode 100644 index 0000000..a23e4c5 --- /dev/null +++ b/ftplugin/gentoo-metadata.vim @@ -0,0 +1,24 @@ +" Vim filetype plugin file +" Language: Gentoo metadata.xml +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" This sets up filetype specific options for Gentoo metadata.xml files. +" + +if &compatible || v:version < 603 + finish +endif + +runtime! ftplugin/xml.vim + +" Required whitespace settings +setlocal tabstop=4 +setlocal shiftwidth=4 +setlocal noexpandtab +setlocal textwidth=80 + +" GLEP 31 settings +setlocal fileencoding=utf-8 + diff --git a/indent/ebuild.vim b/indent/ebuild.vim new file mode 100644 index 0000000..0630068 --- /dev/null +++ b/indent/ebuild.vim @@ -0,0 +1,24 @@ +" Vim syntax file +" Language: Gentoo Ebuilds/Eclasses +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for ebuilds and eclasses. Inherits from sh.vim and adds +" in Gentoo-specific highlights for certain keywords and functions. Requires +" vim 6.3 or later. + +if &compatible || v:version < 603 + finish +endif + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +runtime! indent/sh.vim +let b:did_indent = 1 + + +" vim: set sts=2 sw=2: diff --git a/indent/eclectic.vim b/indent/eclectic.vim new file mode 100644 index 0000000..3816581 --- /dev/null +++ b/indent/eclectic.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: Eclectic Modules +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Eclectic modules. Inherits from sh.vim and adds +" in Eclectic-specific highlights for certain keywords and functions. Requires +" vim 6.3 or later. + +if &compatible || v:version < 603 + finish +endif + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +runtime! indent/sh.vim +let b:did_indent = 1 + +" vim: sw=4 ts=4 et fdm=marker diff --git a/indent/gentoo-metadata.vim b/indent/gentoo-metadata.vim new file mode 100644 index 0000000..c8776b0 --- /dev/null +++ b/indent/gentoo-metadata.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: Gentoo metadata.xml +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for metadata.xml +" + +if &compatible || v:version < 603 + finish +endif + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +runtime! indent/xml.vim +let b:did_indent = 1 + + +" vim: set sts=2 sw=2: diff --git a/plugin/bugsummary.vim b/plugin/bugsummary.vim new file mode 100644 index 0000000..3c12788 --- /dev/null +++ b/plugin/bugsummary.vim @@ -0,0 +1,155 @@ +" Vim plugin +" Purpose: Display summary information about a bugzilla bug +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" The following commands are provided: +" :BugSummary 12345 +" :BugDetails 12345 +" In addition, a normal mode map of <Leader>bug (<Leader> defaults to +" backslash, see :help <Leader>) which calls :BugDetails on the bug under the +" cursor. +" +" Configuration options: +" :let g:bugsummary_browser="firefox '%s'" + +if &compatible || v:version < 603 + finish +endif + +fun! <SID>strip(s) + return substitute(a:s, "\\n", "", "g") +endfun + +fun! <SID>tidy(s) + let l:s = a:s + let l:s = substitute(l:s, "<", "<", "g") + let l:s = substitute(l:s, ">", ">", "g") + let l:s = substitute(l:s, "'", "\'", "g") + let l:s = substitute(l:s, """, "\"", "g") + let l:s = substitute(l:s, "&", "\\&", "g") + return l:s +endfun + +fun! <SID>extract(a, b) + return <SID>tidy(matchstr(a:a, '\(<' . a:b . '>\)\@<=[^<]*\(</' . a:b . '>\)\@=')) +endfun + +fun! <SID>echomenu(s) + let l:s = a:s . "|" + let l:p = stridx(a:s, "|") + echo " " + echo "menu: " + while -1 != l:p + echohl Special + echon "[" . strpart(l:s, 0, 1) . "]" + echohl Keyword + echon strpart(l:s, 1, l:p - 1) + echon " " + let l:s = strpart(l:s, l:p + 1) + let l:p = stridx(l:s, "|") + endwhile + echohl +endfun + +fun! <SID>GetBugSummary(id, detailed) + try + let l:c="wget -O - -o /dev/null 'http://bugs.gentoo.org/show_bug.cgi?id=" . a:id . "\&ctype=xml'" + let l:r = system(l:c) + let l:x_bug_id = <SID>extract(l:r, 'bug_id') + let l:x_bug_desc = <SID>extract(l:r, 'short_desc') + let l:x_bug_from = <SID>extract(l:r, 'reporter') + let l:x_bug_to = <SID>extract(l:r, 'assigned_to') + let l:x_bug_stat = <SID>extract(l:r, 'bug_status') + let l:x_bug_res = <SID>extract(l:r, 'resolution') + if -1 == match(l:x_bug_desc, '\S') + throw "Couldn't get summary for bug " . l:x_bug_id + else + echohl Keyword + echo "Bug #" . <SID>strip(l:x_bug_id) + echohl + echon ': ' . <SID>strip(l:x_bug_stat) . " " . <SID>strip(l:x_bug_res) + echo " " . <SID>strip(l:x_bug_desc) + echo " " + echohl Preproc + echon <SID>strip(l:x_bug_from) + echohl + echon " -> " + echohl Preproc + echon <SID>strip(l:x_bug_to) + echohl + + if a:detailed + call <SID>echomenu("return|browser|insert") + let l:which=input("> ") + if l:which == "b" + if ! exists("g:bugsummary_browser") + throw "You should set g:bugsummary_browser first (:help g:bugsummary_browser)" + else + let l:cmd=substitute(g:bugsummary_browser, "%s", + \ 'http://bugs.gentoo.org/show_bug.cgi?id=' . a:id, "g") + call system(l:cmd) + if v:shell_error != 0 + throw "Couldn't run " . l:cmd + endif + endif + elseif l:which == "i" + call <SID>echomenu("number|link|details") + let l:which = input("> ") + if l:which == "l" + exec "normal i<http://bugs.gentoo.org/show_bug.cgi?id=" . l:x_bug_id . ">" + elseif l:which == "d" + exec "normal oBug #" . l:x_bug_id . ": " . l:x_bug_stat . " " . l:x_bug_res + exec "normal o" . l:x_bug_desc + exec "normal o" . l:x_bug_from . " -> " . l:x_bug_to + exec "normal o" + else + exec "normal iBug #" . l:x_bug_id + endif + endif + endif + endif + + catch + echo " " + echohl Error + echo v:exception + echohl + call input("--- Hit Return ---") + endtry +endfun + +fun! <SID>FindGetBugSummary(str, col) + try + let l:col = a:col - 2 + while l:col > 0 && (-1 != match(strpart(a:str, l:col, 1), '\d')) + let l:col = l:col - 1 + endwhile + let l:str = strpart(a:str, l:col) + let l:i = match(l:str, '\d') + if l:i == -1 + throw "Couldn't find a bug number" + else + let l:str = strpart(l:str, l:i) + let l:i = match(l:str, '\D\|$') + let l:str = strpart(l:str, 0, l:i) + if match(l:str, '\d') != -1 + call <SID>GetBugSummary(l:str, 1) + else + throw "Couldn't find a bug number" + endif + endif + catch + echohl Error + echo v:exception + echohl + call input("--- Hit Return ---") + endtry +endfun + +command! -nargs=1 BugSummary :call <SID>GetBugSummary(<args>, 0) +command! -nargs=1 BugDetails :call <SID>GetBugSummary(<args>, 1) +nmap <Leader>bug :call <SID>FindGetBugSummary(getline("."), col("."))<CR> + +" vim: set et : " diff --git a/plugin/gentoo-common.vim b/plugin/gentoo-common.vim new file mode 100644 index 0000000..6fa083c --- /dev/null +++ b/plugin/gentoo-common.vim @@ -0,0 +1,46 @@ +" Vim plugin +" Purpose: Common functionality for gentoo-syntax plugins +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +fun! GentooGetUser() + let l:result = expand("\$ECHANGELOG_USER") + if l:result ==# "\$ECHANGELOG_USER" + let l:result = expand("\$USER") + endif + if l:result ==# "\$USER" + let l:result = "" + endif + return l:result +endfun + +fun! GentooHeader() + let l:year = strftime("%Y") + 0 put ='# Copyright 1999-' . l:year . ' Gentoo Foundation' + put ='# Distributed under the terms of the GNU General Public License v2' + put ='# $Header: $' + $ +endfun + +fun! GentooGetArch() + if exists("g:gentooarch") && g:gentooarch != "" + return g:gentooarch + else + let l:a = system("portageq envvar ACCEPT_KEYWORDS 2>/dev/null") + let l:a = substitute(l:a, "[\\n~]", " ", "g") + let l:a = substitute(l:a, "^\\s\\+", "", "") + let l:a = substitute(l:a, "\\s.*", "", "") + if l:a == "" + let l:a = "x86" + endif + let g:gentooarch = l:a + return g:gentooarch + endif +endfun + +" vim: set et foldmethod=marker : " diff --git a/plugin/newebuild.vim b/plugin/newebuild.vim new file mode 100644 index 0000000..686a113 --- /dev/null +++ b/plugin/newebuild.vim @@ -0,0 +1,143 @@ +" Vim plugin +" Purpose: Intelligently create content for new ebuild files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +runtime! plugin/gentoo-common.vim + +fun! <SID>MakeNewEbuild() + let l:pastebackup = &paste + set nopaste + + " {{{ variables + let l:arch = GentooGetArch() + let l:filename = expand("%:p") + let l:category = substitute(l:filename, + \ "^.*/\\([^/]\\+\\)/[^/]\\+/[^/]\\+\\.ebuild", "\\1", "g") + " }}} + + call GentooHeader() + + if expand("%:e") =~# "eclass\$" + " {{{ eclass special setup + let l:eclass=substitute(expand("%:t"), "\\.eclass\$", "", "") + put ='#' + put ='# Original Author: ' . GentooGetUser() + put ='# Purpose: ' + put ='#' + put ='' + put ='ECLASS=\"' . l:eclass . '\"' + put ='INHERITED=\"$INHERITED $ECLASS\"' + put ='' + " }}} + + " {{{ go to the first thing to edit + 0 + /^# Purpose:/ + normal $ + nohls + " }}} + else + if l:category ==# "app-vim" + " {{{ app-vim special setup + put ='inherit vim-plugin' + put ='' + put ='DESCRIPTION=\"vim plugin: \"' + put ='HOMEPAGE=\"http://www.vim.org/scripts/script.php?script_id=\"' + put ='LICENSE=\"\"' + put ='KEYWORDS=\"~' . l:arch . '\"' + put ='IUSE=\"\"' + put ='' + put ='VIM_PLUGIN_HELPFILES=\"\"' + put ='VIM_PLUGIN_HELPTEXT=\"\"' + put ='VIM_PLUGIN_HELPURI=\"\"' + put ='VIM_PLUGIN_MESSAGES=\"\"' + put ='' + " }}} + elseif l:category ==# "www-apache" && expand("%:t") =~# "^mod_" + " {{{ www-apache default setup (for module pkgs) + put ='inherit apache-module' + put ='' + put ='DESCRIPTION=\"\"' + put ='HOMEPAGE=\"\"' + put ='LICENSE=\"\"' + put ='' + put ='KEYWORDS=\"~' . l:arch . '\"' + put ='IUSE=\"\"' + put ='SLOT=\"0\"' + put ='' + put ='# See apache-module.eclass for more information.' + put ='APACHE2_MOD_CONF=\"XX_${PN}\"' + put ='APACHE2_MOD_DEFINE=\"\"' + put ='' + put ='need_apache2' + " }}} + else + " {{{ standard default setup + " {{{ extra inherits for some categories + if l:category =~# "^games-" + put ='inherit games' + put ='' + elseif l:category ==# "dev-python" + put ='inherit distutils' + put ='' + elseif l:category ==# "dev-java" + put ='inherit java-pkg' + put ='' + elseif l:category ==# "dev-perl" + put ='inherit perl-module' + put ='' + endif + " }}} + + put ='DESCRIPTION=\"\"' + put ='HOMEPAGE=\"\"' + put ='SRC_URI=\"\"' + put ='' + put ='LICENSE=\"\"' + put ='SLOT=\"0\"' + put ='KEYWORDS=\"~' . l:arch . '\"' + put ='IUSE=\"\"' + put ='' + + " {{{ extra deps for some categories + if l:category ==# "dev-java" + put ='DEPEND=\"virtual/jdk\"' + put ='RDEPEND=\"virtual/jre\"' + put ='' + else + put ='DEPEND=\"\"' + put ='RDEPEND=\"\"' + put ='' + endif + " }}} + " }}} + endif + + " {{{ go to the first thing to edit + 0 + /^DESCRIPTION=/ + exec "normal 2f\"" + nohls + " }}} + endif + + if pastebackup == 0 + set nopaste + endif +endfun + +com! -nargs=0 NewEbuild call <SID>MakeNewEbuild() + +augroup NewEbuild + au! + autocmd BufNewFile *.e{build,class} + \ call <SID>MakeNewEbuild() +augroup END + +" vim: set et foldmethod=marker : " diff --git a/plugin/neweclectic.vim b/plugin/neweclectic.vim new file mode 100644 index 0000000..baacb40 --- /dev/null +++ b/plugin/neweclectic.vim @@ -0,0 +1,71 @@ +" Vim plugin +" Purpose: Intelligently create content for new ebuild files +" Author: Ciaran McCreesh <ciaranm@gentoo.org>, +" Elfyn McBratney <beu@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Copyright (c) 2005 Elfyn McBratney +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +" nicked from gentoo-common.vim +fun! EclecticModuleHeader() + let l:year = strftime("%Y") + 0 put ='# Copyright 1999-' . l:year . ' Gentoo Foundation' + put ='# Distributed under the terms of the GNU General Public License v2' + put ='# $Header: $' + $ +endfun + +fun! <SID>MakeNewEclecticModule() + let l:pastebackup = &paste + set nopaste + + call EclecticModuleHeader() + + " {{{ boiler-plate eclectic module + put ='DESCRIPTION=\"\"' + put ='MAINTAINER=\"you@gentoo.org\"' + put ='' + call setline(line("."), 'SVN_DATE=' . "'" . '$Date: $' . "'") + put ='VERSION=$(svn_date_to_version \"${SVN_DATE}\" )' + put ='' + put ='### foo action' + put ='' + put ='## {{{ foo stuff' + put ='describe_foo() {' + put =' echo \"Perform a foobration\"' + put ='}' + put ='' + put ='do_foo() {' + put =' :' + put ='}' + put ='## }}}' + put ='' + put ='# vim: ts=4 sw=4 noet fdm=marker' + " }}} + + norm gg=G + + " {{{ go to the first thing to edit + 0 + /^DESCRIPTION=/ + exec "normal 2f\"" + nohls + " }}} + if pastebackup == 0 + set nopaste + endif +endfun + +com! -nargs=0 MakeNewEclecticModule call <SID>MakeNewEclecticModule() + +augroup MakeNewEclecticModule + au! + autocmd BufNewFile *.eclectic + \ call <SID>MakeNewEclecticModule() +augroup end + +" vim: sw=4 ts=4 et fdm=marker diff --git a/plugin/newinitd.vim b/plugin/newinitd.vim new file mode 100644 index 0000000..045cc94 --- /dev/null +++ b/plugin/newinitd.vim @@ -0,0 +1,44 @@ +" Vim plugin +" Purpose: create content for new init.d scripts +" Author: Aaron Walker <ka0ttic@gentoo.org> +" Copyright: Copyright (c) 2005 Aaron Walker +" License: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +runtime! plugin/gentoo-common.vim + +fun! <SID>MakeNewInitd() + " {{{ default functions + put ='depend() {' + put ='' + put ='}' + put ='' + put ='start() {' + put ='' + put ='}' + put ='' + put ='stop() {' + put ='' + put ='}' + put ='' + put ='restart() {' + put ='' + put ='}' + " }}} + + call GentooHeader() + 0 put ='#!/sbin/runscript' +endfun + +com! -nargs=0 NewInitd call <SID>MakeNewInitd() | set filetype=gentoo-init-d + +augroup NewInitd + au! + autocmd BufNewFile {/*/files/*.{rc*,init*},/etc/init.d/*} + \ call <SID>MakeNewInitd() | set filetype=gentoo-init-d +augroup END + +" vim: set et foldmethod=marker : " diff --git a/plugin/newmetadata.vim b/plugin/newmetadata.vim new file mode 100644 index 0000000..41aa59a --- /dev/null +++ b/plugin/newmetadata.vim @@ -0,0 +1,100 @@ +" Vim plugin +" Purpose: Intelligently create content for metadata.xml +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +runtime! plugin/gentoo-common.vim + +fun! <SID>MakeNewMetadata() + let l:pastebackup = &paste + set nopaste + + " {{{ variables + let l:filename = expand("%:p") + let l:dir = expand("%:p:h") + + if glob(l:dir . '/*/*.ebuild') =~ '\S' + let l:category = substitute(l:filename, '^.*/\([a-z][a-z0-9]\+-[a-z]\+\)/metadata.xml$', + \ '\1', '') + let l:iscatmetadata = 1 + else + let l:category = substitute(l:filename, + \ "^.*/\\([^/]\\+\\)/[^/]\\+/metadata\\.xml", "\\1", "g") + let l:iscatmetadata = 0 + let l:user = GentooGetUser() + let l:email = matchstr(l:user, "\\(<\\)\\@<=[^>]\\+\\(>\\)\\@=") + let l:name = matchstr(l:user, "^[^<]\\+\\( <\\)\\@=") + endif + " }}} + + " {{{ catmetadata + if l:iscatmetadata + " {{{ content + 0 put ='<?xml version=\"1.0\" encoding=\"UTF-8\"?>' + put ='<!DOCTYPE catmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">' + put ='<catmetadata>' + put ='<longdescription lang=\"en\">' + put ='</longdescription>' + put ='</catmetadata>' + exec "normal gg=G" + " }}} + " }}} + else + " {{{ pkgmetadata + + " {{{ herd + let l:herd = "" + if l:category ==# "app-vim" + let l:herd = "vim" + elseif l:category ==# "dev-perl" + let l:herd = "perl" + elseif l:category ==# "dev-ruby" + let l:herd = "ruby" + elseif l:category ==# "dev-tex" + let l:herd = "text-markup" + elseif l:category ==# "dev-java" + let l:herd = "java" + endif + " }}} + + " {{{ content + 0 put ='<?xml version=\"1.0\" encoding=\"UTF-8\"?>' + put ='<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">' + put ='<pkgmetadata>' + put ='<herd>' . l:herd . '</herd>' + if l:email != "" || l:name != "" + put ='<maintainer>' + if l:email != "" + put ='<email>' . l:email . '</email>' + endif + if l:name != "" + put ='<name>' . l:name . '</name>' + endif + endif + put ='</maintainer>' + put ='<longdescription lang=\"en\">' + put ='</longdescription>' + put ='</pkgmetadata>' + exec "normal gg=G" + " }}} + endif + " }}} + + if pastebackup == 0 + set nopaste + endif +endfun + +com! -nargs=0 NewMetadata call <SID>MakeNewMetadata() +augroup NewMetadata + au! + autocmd BufNewFile metadata.xml + \ call <SID>MakeNewMetadata() +augroup END + +" vim: set et foldmethod=marker : " diff --git a/syntax/ebuild.vim b/syntax/ebuild.vim new file mode 100644 index 0000000..f1d5a14 --- /dev/null +++ b/syntax/ebuild.vim @@ -0,0 +1,270 @@ +" Vim syntax file +" Language: Gentoo Ebuilds/Eclasses +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for ebuilds and eclasses. Inherits from sh.vim and adds +" in Gentoo-specific highlights for certain keywords and functions. Requires +" vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +let is_bash=1 +runtime! syntax/sh.vim +unlet b:current_syntax + +runtime syntax/gentoo-common.vim + +" function names can contain more characters than sh.vim allows. Override +" this. See Gentoo bug 72469. +syn match bkshFunction "^\s*\<\h[0-9a-zA-Z_\-\.]*\>\s*()" skipwhite skipnl contains=bkshFunctionParen + +" Default keywords +syn keyword EbuildCoreKeyword use has_version best_version use_with use_enable check_KV +syn keyword EbuildCoreKeyword keepdir econf die einstall einfo ewarn eerror diropts +syn keyword EbuildCoreKeyword dobin docinto dodoc doexe dohard dohtml doinfo doins +syn keyword EbuildCoreKeyword dolib dolib.a dolib.so doman dosbin dosym emake exeinto +syn keyword EbuildCoreKeyword exeopts fowners fperms insinto insopts into libopts newbin +syn keyword EbuildCoreKeyword newexe newins newman newsbin prepall prepalldocs prepallinfo +syn keyword EbuildCoreKeyword prepallman prepallstrip has unpack dopython dosed into +syn keyword EbuildCoreKeyword doinitd doconfd doenvd dojar domo dodir ebegin eend +syn keyword EbuildCoreKeyword newconfd newdoc newenvd newinitd newlib.a newlib.so +syn keyword EbuildCoreKeyword hasq hasv useq usev + +" Sandbox +syn keyword EbuildCoreKeyword addread addwrite adddeny addpredict + +" Recognised functions +syn keyword EbuildFunctions pkg_nofetch pkg_setup src_unpack src_compile src_test src_install +syn keyword EbuildFunctions pkg_preinst pkg_postinst pkg_prerm pkg_postrm pkg_config + +" Inherit +syn keyword EbuildInherit inherit + +" eutils +syn keyword EbuildEutilsKeyword gen_usr_ldscript draw_line epatch have_NPTL get_number_of_jobs egetent +syn keyword EbuildEutilsKeyword emktemp enewuser enewgroup edos2unix make_desktop_entry unpack_pdv +syn keyword EbuildEutilsKeyword unpack_makeself check_license cdrom_get_cds cdrom_load_next +syn keyword EbuildEutilsKeyword cdrom_locate_file_on_cd strip-linguas epause ebeep built_with_use +syn keyword EbuildEutilsKeyword make_session_desktop domenu doicon find_unpackable_file unpack_pdv +syn keyword EbuildEutilsKeyword set_arch_to_kernel set_arch_to_portage preserve_old_lib +syn keyword EbuildEutilsKeyword preserve_old_lib_notify built_with_use epunt_cxx dopamd newpamd + +" flag-o-matic +syn keyword EbuildFlagoKeyword setup-allowed-flags filter-flags filter-lfs-flags append-lfs-flags +syn keyword EbuildFlagoKeyword append-flags replace-flags replace-cpu-flags is-flag filter-mfpmath +syn keyword EbuildFlagoKeyword strip-flags test_flag test_version_info strip-unsupported-flags get-flag +syn keyword EbuildFlagoKeyword has_hardened has_pic has_pie has_ssp has_m64 has_m32 replace-sparc64-flags +syn keyword EbuildFlagoKeyword append-ldflags filter-ldflags etexec-flags fstack-flags gcc2-flags + +" gcc +syn keyword EbuildGCCKeyword gcc-getCC gcc-getCXX gcc-fullversion gcc-version gcc-major-version +syn keyword EbuildGCCKeyword gcc-minor-version gcc-micro-version gcc-libpath gcc-libstdcxx-version +syn keyword EbuildGCCKeyword gcc-libstdcxx-major-version gcc2-flags + +" libtool +syn keyword EbuildLibtoolKeyword elibtoolize + +" fixheadtails +syn keyword EbuildFixHeadTailsKeyword ht_fix_file ht_fix_all + +" fdo-mime +syn keyword EbuildFdoMimeKeyword fdo-mime_desktop_database_update fdo-mime_mime_database_update + +" webapp +syn keyword EbuildWebappKeyword webapp_configfile webapp_hook_script webapp_postinst_txt +syn keyword EbuildWebappKeyword webapp_runbycgibin webapp_serverowned webapp_server_configfile +syn keyword EbuildWebappKeyword webapp_sqlscript webapp_src_install webapp_pkg_setup +syn keyword EbuildWebappKeyword webapp_getinstalltype webapp_src_preinst webapp_pkg_postinst +syn keyword EbuildWebappKeyword webapp_pkg_prerm + +" versionator +syn keyword EbuildVersionatorKeyword get_all_version_components version_is_at_least +syn keyword EbuildVersionatorKeyword get_version_components get_major_version +syn keyword EbuildVersionatorKeyword get_version_component_range get_after_major_version +syn keyword EbuildVersionatorKeyword replace_version_separator replace_all_version_separators +syn keyword EbuildVersionatorKeyword delete_version_separator delete_all_version_separators + +" cvs +syn keyword EbuildCVSKeyword cvs_src_unpack + +" bash-completion +syn keyword EbuildBashCompKeyword dobashcompletion bash-completion_pkg_postinst + +" vim-plugin +syn keyword EbuildVimPluginKeyword vim-plugin_src_install vim-plugin_pkg_postinst vim-plugin_pkg_postrm +syn keyword EbuildVimPluginKeyword update_vim_afterscripts display_vim_plugin_help + +" vim-doc +syn keyword EbuildVimDocKeyword update_vim_helptags + +" multilib +syn keyword EbuildMultilibKeyword get_libdir get_multilibdir get_libdir_override get_all_libdirs +syn keyword EbuildMultilibKeyword get_abi_var get_abi_CFLAGS get_abi_CDEFINE get_abi_LIBDIR get_abi_order +syn keyword EbuildMultilibKeyword is_final_abi number_abis +syn keyword EbuildMultilibKeyword prep_ml_includes create_ml_includes + +" 64-bit +syn keyword Ebuild64bitKeyword 64-bit + +" toolchain-funcs +syn keyword EbuildToolFuncsKeyword tc-getPROG tc-getAR tc-getAS tc-getCC tc-getCXX tc-getLD tc-getNM +syn keyword EbuildToolFuncsKeyword tc-getRANLIB tc-getF77 tc-getGCJ tc-getBUILD_CC tc-export +syn keyword EbuildToolFuncsKeyword tc-is-cross-compiler tc-ninja_magic_to_arch tc-arch-kernel tc-arch +syn keyword EbuildToolFuncsKeyword tc-endian gcc-fullversion gcc-version gcc-major-version +syn keyword EbuildToolFuncsKeyword gcc-minor-version gcc-micro-version + +" cron +syn keyword EbuildCronKeyword docrondir docron docrontab cron_pkg_postinst + +" games +syn keyword EbuildGamesKeyword egamesconf egamesinstall gameswrapper dogamesbin dogamessbin dogameslib +syn keyword EbuildGamesKeyword dogameslib.a dogameslib.so newgamesbin newgamessbin gamesowner gamesperms +syn keyword EbuildGamesKeyword prepgamesdirs gamesenv games_pkg_setup games_src_compile games_pkg_postinst +syn keyword EbuildGamesKeyword games_ut_unpack games_umod_unpack games_make_wrapper + +" subversion +syn keyword EbuildSVNKeyword subversion_svn_fetch subversion_bootstrap subversion_src_unpack + +" alternatives +syn keyword EbuildAltKeyword alternatives_auto_makesym alternatives_makesym alternatives_pkg_postinst +syn keyword EbuildAltKeyword alternatives_pkg_postrm + +" rpm +syn keyword EbuildRPMKeyword rpm_unpack rpm_src_unpack + +" python +syn keyword EbuildPythonKeyword python_version python_tkinter_exists python_mod_exists python_mod_compile +syn keyword EbuildPythonKeyword python_mod_optimize python_mod_cleanup python_makesym python_disable_pyc +syn keyword EbuildPythonKeyword python_enable_pyc + +" check-kernel +syn keyword EbuildCheckKernelKeyword check_version_h get_KV_info is_2_4_kernel is_2_5_kernel is_2_6_kernel +syn keyword EbuildCheckKernelKeyword kernel_supports_modules + +" perl-module +syn keyword EbuildPerlModuleKeyword perl-module_src_prep perl-module_src_compile perl-module_src_test +syn keyword EbuildPerlModuleKeyword perl-module_src_install perl-module_pkg_setup perl-module_pkg_preinst +syn keyword EbuildPerlModuleKeyword perl-module_pkg_postinst perl-module_pkg_prerm perl-module_pkg_postrm +syn keyword EbuildPerlModuleKeyword perlinfo fixlocalpod updatepod + +" distutils +syn keyword EbuildDistutilsKeyword distutils_src_compile distutils_src_install distutils_pkg_postrm +syn keyword EbuildDistutilsKeyword distutils_pkg_postinst distutils_python_version disutils_python_tkinter + +" depend.apache +syn keyword EbuildDependApacheKeyword need_apache need_apache1 need_apache2 + +" apache-module +syn keyword EbuildApacheModuleKeyword apache-module_pkg_setup apache-module_src_compile +syn keyword EbuildApacheModuleKeyword apache-module_src_install apache-module_pkg_postinst + +" EXPORT_FUNCTIONS +syn match EbuildExportFunctions /EXPORT_FUNCTIONS/ skipwhite nextgroup=EbuildExportFunctionsFunc,EbuildExportFunctionsFuncE +syn match EbuildExportFunctionsFunc contained /\S\+\(\s\|$\)\@=/ skipwhite nextgroup=EbuildExportFunctionsFunc,EbuildExportFunctionsFuncE +syn match EbuildExportFunctionsFuncE contained /\S\+\(\s\|$\)\@=\(pkg_nofetch\|pkg_setup\|src_unpack\|src_compile\|src_test\|src_install\|pkg_preinst\|pkg_postinst\|pkg_prerm\|pkg_postrm\|pkg_config\)\@<!/ skipwhite nextgroup=EbuildExportFunctionsFunc,EbuildExportFunctionsFuncE + +" mistakes: misspelling +syn keyword EbuildError LICENCE +" non-GLEP 23 +syn match EbuildError /LICENSE="[^|]*|[^|].*"/ +" read only +syn match EbuildError /^\(P\|PN\|PV\|PR\|PVR\|PF\|A\)=/ +" default values +syn match EbuildError ~^S="\?\${\?WORKDIR}\?/\${\?P}\?"\?\s*$~ +" not allowed +syn match EbuildError /SLOT\s*=\s*\(""\|''\|$\)/ +" not allowed +syn match EbuildError /KEYWORDS\s*=\s*.*[^-]\*.*/ +" evil syntax, ask Mr_Bones_ +syn match EbuildError /^[a-zA-Z0-9\-\_]\+ ()/ +syn match EbuildError /^[a-zA-Z0-9\-\_]\+(){/ +" bad space +syn region EbuildError start=/^ / end=/$/ +" should be epause +syn keyword EbuildError esleep +" should be ${P} +syn match EbuildErrorC /\${PN}-\${PV}/ + +" trailing space +if exists("g:ebuild_error_on_trailing_whitespace") + syn match EbuildError /^.*\s\+$/ +endif + +" these can be contained within strings etc... +" not to be used in an ebuild +syn match EbuildErrorC /\$\?{\?EXTRA_ECONF}\?/ +" stupid cat usage +syn match EbuildErrorC /\(z\)\@<!cat \S\+\s\+|\s*\(sed\|[aef]\?grep\|sort\|cut\|head\|tail\|patch\)/ + +" Special homepage handling +syn match EbuildHomePageError /^HOMEPAGE=.*\(\${[^}]*}\?\|\([^\\]\)\@<=\$[^{]\w*\).*$/ + +" no dev.g.o in SRC_URI +syn match EbuildErrorC /http:..dev.gentoo.org[^ "]*\(SRC_URI.*\)\@<=/ + +" clusters +syn cluster EbuildThings contains=EbuildCoreKeyword,EbuildFunctions,EbuildInherit,EbuildEutilsKeyword +syn cluster EbuildThings add=EbuildLibtoolKeyword,EbuildFixHeadTailsKeyword,EbuildWebappKeyword +syn cluster EbuildThings add=EbuildFlagoKeyword,EbuildError,EbuildGCCKeyword,EbuildVersionatorKeyword +syn cluster EbuildThings add=EbuildLibtoolKeyword,EbuildHomePageError,EbuildErrorC,EbuildCVSKeyword +syn cluster EbuildThings add=EbuildBashCompKeyword,EbuildVimPluginKeyword,EbuildVimDocKeyword +syn cluster EbuildThings add=EbuildFdoMimeKeyword,EbuildMultilibKeyword,Ebuild64bitKeyword +syn cluster EbuildThings add=EbuildCronKeyword,EbuildGamesKeyword,EbuildToolFuncsKeyword +syn cluster EbuildThings add=EbuildSVNKeyword,EbuildAltKeyword,EbuildRPMKeyword,EbuildPythonKeyword +syn cluster EbuildThings add=EbuildCheckKernelKeyword,EbuildPerlModuleKeyword,EbuildDistutilsKeyword +syn cluster EbuildThings add=EbuildDependApacheKeyword,EbuildApacheModuleKeyword + +syn cluster shCommandSubList add=@EbuildThings +syn cluster shCommentGroup add=GentooBug +syn cluster shDblQuoteList add=EbuildErrorC + +hi def link EbuildCoreKeyword Keyword +hi def link EbuildFunctions Special +hi def link EbuildInherit Include + +hi def link EbuildEutilsKeyword Identifier +hi def link EbuildFlagoKeyword Identifier +hi def link EbuildGCCKeyword Identifier +hi def link EbuildLibtoolKeyword Identifier +hi def link EbuildFixHeadTailsKeyword Identifier +hi def link EbuildFdoMimeKeyword Identifier +hi def link EbuildWebappKeyword Identifier +hi def link EbuildVersionatorKeyword Identifier +hi def link EbuildCVSKeyword Identifier +hi def link EbuildBashCompKeyword Identifier +hi def link EbuildVimPluginKeyword Identifier +hi def link EbuildVimDocKeyword Identifier +hi def link EbuildMultilibKeyword Identifier +hi def link Ebuild64bitKeyword Identifier +hi def link EbuildCronKeyword Identifier +hi def link EbuildGamesKeyword Identifier +hi def link EbuildToolFuncsKeyword Identifier +hi def link EbuildSVNKeyword Identifier +hi def link EbuildAltKeyword Identifier +hi def link EbuildRPMKeyword Identifier +hi def link EbuildPythonKeyword Identifier +hi def link EbuildCheckKernelKeyword Identifier +hi def link EbuildPerlModuleKeyword Identifier +hi def link EbuildDistutilsKeyword Identifier +hi def link EbuildDependApacheKeyword Identifier +hi def link EbuildApacheModuleKeyword Identifier + +hi def link EbuildHomePageError Error +hi def link EbuildError Error +hi def link EbuildErrorC Error + +hi def link EbuildExportFunctions Constant +hi def link EbuildExportFunctionsFunc Identifier +hi def link EbuildExportFunctionsFuncE Error + +let b:current_syntax = "ebuild" + diff --git a/syntax/eclectic.vim b/syntax/eclectic.vim new file mode 100644 index 0000000..2ef0e37 --- /dev/null +++ b/syntax/eclectic.vim @@ -0,0 +1,69 @@ +" Vim syntax file +" Language: Gentoo Ebuilds/Eclasses +" Author: Ciaran McCreesh <ciaranm@gentoo.org>, +" Elfyn McBratney <beu@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh, +" Copyright (c) 2005 Elfyn McBratney +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for ebuilds and eclasses. Inherits from sh.vim and adds +" in Gentoo-specific highlights for certain keywords and functions. Requires +" vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +let is_bash=1 +runtime! syntax/sh.vim +unlet b:current_syntax + +"runtime syntax/gentoo-common.vim + +" function names can contain more characters than sh.vim allows. Override +" this. See Gentoo bug 72469. +syn match bkshFunction "^\s*\<\h[0-9a-zA-Z_\-\.]*\>\s*()" skipwhite skipnl contains=bkshFunctionParen + +" Core keywords +syn keyword EclecticCoreKeyword die is_function has + +" Config keywords +syn keyword EclecticConfigKeyword store_config load_config add_config + +" (String/misc) manipulation keywords +syn keyword EclecticManipKeyword svn_date_to_version + +" Multilib keywords +syn keyword EclecticMultilibKeyword list_libdirs + +" Output keywords +syn keyword EclecticOutputKeywords write_error_msg write_list_start +syn keyword EclecticOutputKeywords write_kv_list_entry write_numbered_list_entry +syn keyword EclecticOutputKeywords write_numbered_list highlight +syn keyword EclecticOutputKeywords highlight_warning space + +" Test keywords +syn keyword EclecticTestKeywords is_number + +" clusters +syn cluster EclecticThings contains=EclecticCoreKeyword,EclecticConfigKeyword +syn cluster EclecticThings add=EclecticManipKeyword,EclecticMultilibKeyword, +syn cluster EclecticThings add=EclecticOutputKeywords,EclecticTestKeywords + +syn cluster shCommandSubList add=@EclecticThings + +hi def link EclecticCoreKeyword Keyword +hi def link EclecticConfigKeyword Identifier +hi def link EclecticManipKeyword Identifier +hi def link EclecticMultilibKeyword Identifier +hi def link EclecticOutputKeyword Identifier +hi def link EclecticTestKeyword Identifier + +let b:current_syntax = "eclectic" + +" vim: sw=4 ts=4 et fdm=marker diff --git a/syntax/gentoo-changelog.vim b/syntax/gentoo-changelog.vim new file mode 100644 index 0000000..f7f0f3a --- /dev/null +++ b/syntax/gentoo-changelog.vim @@ -0,0 +1,53 @@ +" Vim syntax file +" Language: Gentoo ChangeLogs +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo ChangeLogs. Needs vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +" Releases +syn region GentooChangeLogRelease start=/^\*/ end=/$/ contains=GentooChangeLogReleaseDate +syn match GentooChangeLogReleaseDate contained /(\d\d\s\w\+\s\d\{4\})/ + +" Entries +syn region GentooChangeLogEntry start=/^\s\+/ end=/\n\n/ + \ contains=GentooChangeLogEntryDate,GentooBug +syn region GentooChangeLogEntryDate contained start=/\d\?\d\s\w\+\s\d\{4\}/ end=/;/ + \ nextgroup=GentooChangeLogEntryAuthor,GentooChangeLogEntryEmail skipwhite skipnl +syn region GentooChangeLogEntryAuthor contained start=/\S/ end=/\( <\)\@=/ + \ nextgroup=GentooChangeLogEntryEmail skipwhite skipnl +syn match GentooChangeLogEntryEmail contained /<\?[a-zA-Z0-9\.\-\_]\+@[a-zA-Z0-9\.\-\_]\+>\?/ + \ nextgroup=GentooChangeLogFiles skipwhite skipnl +syn region GentooChangeLogFiles contained start=/\(\S\)\@=/ end=/:/ + \ contains=GentooChangeLogAddFile,GentooChangeLogDelFile,GentooChangeLogModFile + +" Add / delete / changed files +syn region GentooChangeLogAddFile contained start=/+/ end=/\([,:]\)\@=/ +syn region GentooChangeLogDelFile contained start=/-/ end=/\([,:]\)\@=/ +syn region GentooChangeLogModFile contained start=/[a-zA-Z0-9]/ end=/\([,:]\)\@=/ + +" Colours +hi def link GentooChangeLogEntryDate Number +hi def link GentooChangeLogEntryAuthor String +hi def link GentooChangeLogEntryEmail Special +hi def link GentooChangeLogModFile Identifier +hi def link GentooChangeLogAddFile DiffAdd +hi def link GentooChangeLogDelFile DiffDelete + +hi def link GentooChangeLogRelease Title +hi def link GentooChangeLogReleaseDate Number + +let b:current_syntax = "gentoo-changelog" + diff --git a/syntax/gentoo-common.vim b/syntax/gentoo-common.vim new file mode 100644 index 0000000..7822984 --- /dev/null +++ b/syntax/gentoo-common.vim @@ -0,0 +1,20 @@ +" Vim syntax file +" Language: Gentoo Common Rules +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself + +if &compatible || v:version < 603 + finish +endif + +syn region GentooHeaderBlock start=/\%^\(#\)\@=/ end=/^$/ contains=GentooHeader +syn region GentooHeader contained start=/^#/ end=/$/ contains=GentooHeaderCVSVar +syn region GentooHeaderCVSVar contained start=/\$\S\+:/ end=/\$/ + +syn match GentooBug contained /\(\([gG]entoo \|[dD]ebian \|[sS]ource[Ff]orge \)\?[Bb]ug \(#\s*\)\?\|#\)\d\{1,\}/ + +hi def link GentooHeader Comment +hi def link GentooHeaderCVSVar PreProc +hi def link GentooBug Underlined + diff --git a/syntax/gentoo-conf-d.vim b/syntax/gentoo-conf-d.vim new file mode 100644 index 0000000..e00701f --- /dev/null +++ b/syntax/gentoo-conf-d.vim @@ -0,0 +1,27 @@ +" Vim syntax file +" Language: Gentoo /etc/conf.d/ files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo /etc/conf.d/ files. Inherits from sh.vim +" and adds in Gentoo-specific highlights for certain keywords and functions. +" Requires vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +let is_bash=1 +runtime! syntax/sh.vim +unlet b:current_syntax + +runtime syntax/gentoo-common.vim +syn cluster shCommentGroup add=GentooBug + +let b:current_syntax = "gentoo-conf-d" diff --git a/syntax/gentoo-env-d.vim b/syntax/gentoo-env-d.vim new file mode 100644 index 0000000..bbe5753 --- /dev/null +++ b/syntax/gentoo-env-d.vim @@ -0,0 +1,27 @@ +" Vim syntax file +" Language: Gentoo /etc/env.d/ files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo /etc/env.d/ files. Inherits from sh.vim +" and adds in Gentoo-specific highlights for certain keywords and functions. +" Requires vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +let is_bash=1 +runtime! syntax/sh.vim +unlet b:current_syntax + +runtime syntax/gentoo-common.vim +syn cluster shCommentGroup add=GentooBug + +let b:current_syntax = "gentoo-env-d" diff --git a/syntax/gentoo-init-d.vim b/syntax/gentoo-init-d.vim new file mode 100644 index 0000000..cf4443e --- /dev/null +++ b/syntax/gentoo-init-d.vim @@ -0,0 +1,38 @@ +" Vim syntax file +" Language: Gentoo /etc/init.d/ scripts +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo /etc/init.d/ scripts. Inherits from sh.vim +" and adds in Gentoo-specific highlights for certain keywords and functions. +" Requires vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +let is_bash=1 +runtime! syntax/sh.vim +unlet b:current_syntax + +runtime syntax/gentoo-common.vim +syn cluster shCommentGroup add=GentooBug + +syn keyword GentooInitDKeyword need use provide before after ebegin eend einfo +syn keyword GentooInitDKeyword ewarn eerror + +syn keyword GentooInitDFunc start stop reload restart usage zap depend + +syn cluster shCommandSubList add=GentooInitDKeyword + +hi def link GentooInitDKeyword Keyword +hi def link GentooInitDFunc Special + +let b:current_syntax = "gentoo-init-d" + diff --git a/syntax/gentoo-make-conf.vim b/syntax/gentoo-make-conf.vim new file mode 100644 index 0000000..b185a7a --- /dev/null +++ b/syntax/gentoo-make-conf.vim @@ -0,0 +1,159 @@ +" Vim syntax file +" Language: Gentoo make.conf Files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo make.conf files. Needs vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +syn cluster GentooMakeConfEC add=GentooMakeConfEUse,GentooMakeConfEAK,GentooMakeConfECFLAGS,GentooMakeConfEMAKEOPTS,GentooMakeConfECHOST,GentooMakeConfEFEATURES,GentooMakeConfEMISC,GentooMakeConfEMISCK,GentooMakeConfEMISCKE,GentooMakeConfEMISCN +syn region GentooMakeConfE start=/^/ end=/$/ contains=@GentooMakeConfEC,GentooMakeConfComment + +" MISC {{{ +syn match GentooMakeConfEMISC /[a-zA-Z0-9\-\_]\+\([^a-zA-Z0-9\-\_]\)\@=/ contained nextgroup=GentooMakeConfEMISCE skipwhite + +syn match GentooMakeConfEMISCE /=/ contained nextgroup=GentooMakeConfEMISCV,GentooMakeConfEMISCVNoQ skipwhite +syn region GentooMakeConfEMISCV contained start=/"/ end=/"/ contains=GentooMakeConfEMISCIX +syn region GentooMakeConfEMISCVNoQ contained start=/[^ "]/ end=/\s\|$/ contains=GentooMakeConfEMISCIX +syn match GentooMakeConfEMISCIX /\\.\|\$\({[^}]\+}\|[a-zA-Z0-9\-\_]\+\)/ contained + +" naughty +syn match GentooMakeConfEMISCN /LDFLAGS\|ASFLAGS\|ARCH\|USERLAND/ contained nextgroup=GentooMakeConfEMISCE skipwhite +" known but not handled specially +syn match GentooMakeConfEMISCK /GENTOO_MIRRORS\|SYNC\|PORTAGE_NICENESS\|PORTDIR_OVERLAY\|PORTAGE_GPG_DIR\|PORTAGE_GPG_KEY\|CONFIG_PROTECT_MASK\|CONFIG_PROTECT\|FETCHCOMMAND\|RESUMECOMMAND\|AUTOCLEAN\|BUILD_PREFIX\|CBUILD\|CLEAN_DELAY\|DISTDIR\|HTTP_PROXY\|FTP_PROXY\|NOCOLOR\|PKGDIR\|PORT_LOGDIR\|PORTAGE_BINHOST\|PORTAGE_TMPDIR\|PORTDIR\|ROOT\|RSYNC_EXCLUDEFROM\|RSYNC_RETRIES\|RSYNC_TIMEOUT\|RPMDIR\|USE_ORDER\|LINGUAS\|VIDEO_CARDS\|INPUT_DEVICES\|EXTRA_ECONF\|ALSA_CARDS\|PORTAGE_TMPFS/ contained nextgroup=GentooMakeConfEMISCE skipwhite +" common eclass stuff +syn match GentooMakeConfEMISCKE /EBEEP_IGNORE\|EPAUSE_IGNORE\|CHECKREQS_ACTION\|BREAKME\|ECHANGELOG_USER\|CCACHE_SIZE\|CCACHE_DIR\|DISTCC_DIR/ contained nextgroup=GentooMakeConfEMISCE skipwhite + +hi def link GentooMakeConfEMISC Keyword +hi def link GentooMakeConfEMISCK Identifier +hi def link GentooMakeConfEMISCN Error +hi def link GentooMakeConfEMISCKE Special +hi def link GentooMakeConfEMISCV String +hi def link GentooMakeConfEMISCVNoQ Constant +hi def link GentooMakeConfEMISCIB Error +hi def link GentooMakeConfEMISCIX Preproc +" }}} + +" USE {{{ +syn keyword GentooMakeConfEUse USE contained nextgroup=GentooMakeConfEUseE skipwhite +syn match GentooMakeConfEUseE /=/ contained nextgroup=GentooMakeConfEUseV skipwhite +syn cluster GentooMakeConfEUseIC add=GentooMakeConfEUseID,GentooMakeConfEUseIE,GentooMakeConfEUseIG,GentooMakeConfEUseIB,GentooMakeConfEUseIX +syn region GentooMakeConfEUseV contained start=/"/ end=/"/ contains=@GentooMakeConfEUseIC +syn match GentooMakeConfEUseIE /[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEUseID /-[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEUseIG /-\?@[a-zA-Z0-9\-\_]\+\|-\*/ contained +syn match GentooMakeConfEUseIB /+@\?[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEUseIX /\\.\|\$\({[^}]\+}\|[a-zA-Z0-9\-\_]\+\)/ contained + +hi def link GentooMakeConfEUse Identifier +hi def link GentooMakeConfEUseV String +hi def link GentooMakeConfEUseID Keyword +hi def link GentooMakeConfEUseIE Special +hi def link GentooMakeConfEUseIG Preproc +hi def link GentooMakeConfEUseIB Error +hi def link GentooMakeConfEUseIX Preproc +" }}} + +" ACCEPT_KEYWORDS {{{ +syn match GentooMakeConfEAK /ACCEPT_KEYWORDS/ contained nextgroup=GentooMakeConfEAKE skipwhite +syn match GentooMakeConfEAKE /=/ contained nextgroup=GentooMakeConfEAKV skipwhite +syn cluster GentooMakeConfEAKIC add=GentooMakeConfEAKIS,GentooMakeConfEAKIU,GentooMakeConfEAKIB,GentooMakeConfEAKIX +syn region GentooMakeConfEAKV contained start=/"/ end=/"/ contains=@GentooMakeConfEAKIC +" do not change keyword order! +syn match GentooMakeConfEAKIS /alpha\|amd64\|arm\|hppa\|ia64\|m68k\|mips\|ppc-macos\|ppc64\|ppc\|s390\|sh\|sparc\|x86-obsd\|x86-fbsd\|x86/ contained +syn match GentooMakeConfEAKIU /\~\(alpha\|amd64\|arm\|hppa\|ia64\|m68k\|mips\|ppc-macos\|ppc64\|ppc\|s390\|sh\|sparc\|x86-obsd\|x86-fbsd\|x86\)/ contained +syn match GentooMakeConfEAKIB /-[a-zA-Z0-9\-\_]\+/ contained +syn match GentooMakeConfEAKIX /\\.\|\$\({[^}]\+}\|[a-zA-Z0-9\-\_]\+\)/ contained + +hi def link GentooMakeConfEAK Identifier +hi def link GentooMakeConfEAKV String +hi def link GentooMakeConfEAKIS Keyword +hi def link GentooMakeConfEAKIU Special +hi def link GentooMakeConfEAKIB Error +hi def link GentooMakeConfEAKIX Preproc +" }}} + +" C*FLAGS {{{ +syn match GentooMakeConfECFLAGS /C\(XX\)\?FLAGS/ contained nextgroup=GentooMakeConfECFLAGSE skipwhite +syn match GentooMakeConfECFLAGSE /=/ contained nextgroup=GentooMakeConfECFLAGSV,GentooMakeConfECFLAGSVNoQ skipwhite +syn cluster GentooMakeConfECFLAGSIC add=GentooMakeConfECFLAGSIB1,GentooMakeConfECFLAGSIB2,GentooMakeConfECFLAGSIB3,GentooMakeConfECFLAGSIX +syn region GentooMakeConfECFLAGSV contained start=/"/ end=/"/ contains=@GentooMakeConfECFLAGSIC +syn match GentooMakeConfECFLAGSIB1 /-ffast-math\|-freduce-all-givs\|-mfpmath=sse,387\|-DNDEBUG\|-s\([a-zA-Z0-9\-\_]\)\@!\|-Wno\S\+\|x86.\?64\|-mvis/ contained +syn match GentooMakeConfECFLAGSIB2 /-[0o][123s]/ contained +syn match GentooMakeConfECFLAGSIB3 /\%(-Os\|-fPIC\|-fpic\|-DPIC\)\%(\(=\%(k8\|opteron\|athlon64\|athlon-fx\).*\)\@<=\|\(.*=\%(k8\|opteron\|athlon64\|athlon-fx\)\)\@=\)/ +syn match GentooMakeConfECFLAGSIX /\\.\|\$\({[^}]\+}\|[a-zA-Z0-9\-\_]\+\)/ contained +syn region GentooMakeConfECFLAGSVNoQ contained start=/[^ "]/ end=/\s\|$/ contains=GentooMakeConfECFLAGSIX + +hi def link GentooMakeConfECFLAGS Identifier +hi def link GentooMakeConfECFLAGSV String +hi def link GentooMakeConfECFLAGSVNoQ Constant +hi def link GentooMakeConfECFLAGSIB1 Error +hi def link GentooMakeConfECFLAGSIB2 Error +hi def link GentooMakeConfECFLAGSIB3 Error +hi def link GentooMakeConfECFLAGSIX Preproc +" }}} + +" MAKEOPTS {{{ +syn match GentooMakeConfEMAKEOPTS /MAKEOPTS/ contained nextgroup=GentooMakeConfEMAKEOPTSE skipwhite +syn match GentooMakeConfEMAKEOPTSE /=/ contained nextgroup=GentooMakeConfEMAKEOPTSV skipwhite +syn cluster GentooMakeConfEMAKEOPTSIC add=GentooMakeConfEMAKEOPTSIB +syn region GentooMakeConfEMAKEOPTSV contained start=/"/ end=/"/ contains=@GentooMakeConfEMAKEOPTSIC +syn match GentooMakeConfEMAKEOPTSIB /-j \+[0-9]\+/ contained + +hi def link GentooMakeConfEMAKEOPTS Identifier +hi def link GentooMakeConfEMAKEOPTSV String +hi def link GentooMakeConfEMAKEOPTSIB Error +" }}} + +" CHOST {{{ +syn match GentooMakeConfECHOST /CHOST/ contained nextgroup=GentooMakeConfECHOSTE skipwhite +syn match GentooMakeConfECHOSTE /=/ contained nextgroup=GentooMakeConfECHOSTV,GentooMakeConfECHOSTVNoQ skipwhite +syn cluster GentooMakeConfECHOSTIC add=GentooMakeConfECHOSTIB +syn region GentooMakeConfECHOSTV contained start=/"/ end=/"/ contains=@GentooMakeConfECHOSTIC +syn match GentooMakeConfECHOSTIB /sparc\(-unknown-linux-gnu\)\@![^ ]\+/ contained +syn region GentooMakeConfECHOSTVNoQ contained start=/[^ "]/ end=/\s\|$/ contains=GentooMakeConfECFLAGSIX + +hi def link GentooMakeConfECHOST Identifier +hi def link GentooMakeConfECHOSTV String +hi def link GentooMakeConfECHOSTVNoQ String +hi def link GentooMakeConfECHOSTIB Error +" }}} + +" FEATURES {{{ +syn keyword GentooMakeConfEFEATURES FEATURES contained nextgroup=GentooMakeConfEFEATURESE skipwhite +syn match GentooMakeConfEFEATURESE /=/ contained nextgroup=GentooMakeConfEFEATURESV skipwhite +syn cluster GentooMakeConfEFEATURESIC add=GentooMakeConfEFEATURESID,GentooMakeConfEFEATURESIE,GentooMakeConfEFEATURESIB,GentooMakeConfEFEATURESIX +syn region GentooMakeConfEFEATURESV contained start=/"/ end=/"/ contains=@GentooMakeConfEFEATURESIC +syn match GentooMakeConfEFEATURESIE /[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEFEATURESID /-[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEFEATURESIB /+[a-zA-Z0-9\-_]\+/ contained +syn match GentooMakeConfEFEATURESIX /\\.\|\$\({[^}]\+}\|[a-zA-Z0-9\-\_]\+\)/ contained + +hi def link GentooMakeConfEFEATURES Identifier +hi def link GentooMakeConfEFEATURESV String +hi def link GentooMakeConfEFEATURESID Keyword +hi def link GentooMakeConfEFEATURESIE Special +hi def link GentooMakeConfEFEATURESIG Preproc +hi def link GentooMakeConfEFEATURESIB Error +hi def link GentooMakeConfEFEATURESIX Preproc +" }}} + +syn region GentooMakeConfComment start=/#/ end=/$/ contains=GentooBug + +hi def link GentooMakeConfComment Comment + + +let b:current_syntax = "gentoo-make-conf" + +" vim: set foldmethod=marker : " diff --git a/syntax/gentoo-metadata.vim b/syntax/gentoo-metadata.vim new file mode 100644 index 0000000..b7e4c30 --- /dev/null +++ b/syntax/gentoo-metadata.vim @@ -0,0 +1,35 @@ +" Vim syntax file +" Language: Gentoo metadata.xml +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for metadata.xml. Inherits from xml.vim. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/xml.vim +unlet b:current_syntax + +syn cluster xmlTagHook add=metadataElement +syn match metadataElement contained 'packages' +syn match metadataElement contained 'catmetadata' +syn match metadataElement contained 'pkgmetadata' +syn match metadataElement contained 'herd' +syn match metadataElement contained 'maintainer' +syn match metadataElement contained 'email' +syn match metadataElement contained 'name' +syn match metadataElement contained 'description' +syn match metadataElement contained 'longdescription' + +hi def link metadataElement Keyword + +let b:current_syntax = "gentoo-metadata" + diff --git a/syntax/gentoo-mirrors.vim b/syntax/gentoo-mirrors.vim new file mode 100644 index 0000000..cdbc03f --- /dev/null +++ b/syntax/gentoo-mirrors.vim @@ -0,0 +1,39 @@ +" Vim syntax file +" Language: Gentoo thirdpartymirrors files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo thirdpartymirrors files. Requires vim 6.3 or +" later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +syn region GentooMirrorsComment start=/#/ end=/$/ + \ contains=GentooMirrorsEmail,GentooMirrorsDate,GentooBug + +syn match GentooMirrorsEmail contained /<[a-zA-Z0-9\-\_]\+@[a-zA-Z0-9\-\_\.]\+>/ +syn match GentooMirrorsDate contained /(\(\d\d\?\s\w\+\|\w\+\s\d\d\?\)\s\d\{4\})/ + +syn match GentooMirrorsAtom /^[^# \t]\+/ + \ nextgroup=GentooMirrorsUrl skipwhite +syn region GentooMirrorsUrl contained start=/\(http\|ftp\):\/\// end=/\(\s\)\@=\|$/ + \ nextgroup=GentooMirrorsUrl skipwhite + +hi def link GentooMirrorsComment Comment +hi def link GentooMirrorsEmail Special +hi def link GentooMirrorsDate Number +hi def link GentooMirrorsAtom Identifier +hi def link GentooMirrorsUrl String + +let b:current_syntax = "gentoo-mirrors" + diff --git a/syntax/gentoo-package-keywords.vim b/syntax/gentoo-package-keywords.vim new file mode 100644 index 0000000..29d480e --- /dev/null +++ b/syntax/gentoo-package-keywords.vim @@ -0,0 +1,39 @@ +" Vim syntax file +" Language: Gentoo package.keywords files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo package.keywords files. Requires vim 6.3 or +" later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +syn region GentooPackageKeywordsComment start=/#/ end=/$/ + \ contains=GentooPackageKeywordsEmail,GentooPackageKeywordsDate,GentooBug + +syn match GentooPackageKeywordsEmail contained /<[a-zA-Z0-9\-\_]\+@[a-zA-Z0-9\-\_\.]\+>/ +syn match GentooPackageKeywordsDate contained /(\(\d\d\?\s\w\+\|\w\+\s\d\d\?\)\s\d\{4\})/ + +syn match GentooPackageKeywordsAtom /^[^ \t\n#]\+-\S\+\/\S\+/ + \ nextgroup=GentooPackageKeywordsKeyword skipwhite +syn match GentooPackageKeywordsKeyword contained /-\?[-~]\?\([a-z0-9\-]\+\|\*\)/ + \ nextgroup=GentooPackageKeywordsKeyword skipwhite + +hi def link GentooPackageKeywordsComment Comment +hi def link GentooPackageKeywordsEmail Special +hi def link GentooPackageKeywordsDate Number +hi def link GentooPackageKeywordsAtom Identifier +hi def link GentooPackageKeywordsKeyword Keyword + +let b:current_syntax = "gentoo-package-keywords" + diff --git a/syntax/gentoo-package-mask.vim b/syntax/gentoo-package-mask.vim new file mode 100644 index 0000000..7216ec9 --- /dev/null +++ b/syntax/gentoo-package-mask.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: Gentoo package.mask and package.unmask files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo package.mask and package.unmask files. +" Requires vim 6.3 or later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +" Header +syn region GentooPackageMaskComment start=/#/ end=/$/ + \ contains=GentooPackageMaskEmail,GentooPackageMaskDate,GentooBug + +syn match GentooPackageMaskEmail contained /<[a-zA-Z0-9\-\_]\+@[a-zA-Z0-9\-\_\.]\+>/ +syn match GentooPackageMaskDate contained /(\(\d\d\?\s\w\+\|\w\+\s\d\d\?\)\s\d\{4\})/ + +syn match GentooPackageMaskAtom /^[^ \t\n#]\+-\S\+\/\S\+/ + +hi def link GentooPackageMaskComment Comment +hi def link GentooPackageMaskEmail Special +hi def link GentooPackageMaskDate Number +hi def link GentooPackageMaskAtom Identifier + +let b:current_syntax = "gentoo-package-mask" + diff --git a/syntax/gentoo-package-use.vim b/syntax/gentoo-package-use.vim new file mode 100644 index 0000000..82e19ed --- /dev/null +++ b/syntax/gentoo-package-use.vim @@ -0,0 +1,42 @@ +" Vim syntax file +" Language: Gentoo package.use files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo package.use files. Requires vim 6.3 or +" later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +syn region GentooPackageUseComment start=/#/ end=/$/ + \ contains=GentooPackageUseEmail,GentooPackageUseDate,GentooBug + +syn match GentooPackageUseEmail contained /<[a-zA-Z0-9\-\_]\+@[a-zA-Z0-9\-\_\.]\+>/ +syn match GentooPackageUseDate contained /(\(\d\d\?\s\w\+\|\w\+\s\d\d\?\)\s\d\{4\})/ + +syn match GentooPackageUseAtom /^[^ \t\n#]\+-\S\+\/\S\+/ + \ nextgroup=GentooPackageUseUse,GentooPackageUseUnuse skipwhite +syn match GentooPackageUseUse contained /[a-zA-Z][a-zA-Z0-9\-_]*/ + \ nextgroup=GentooPackageUseUse,GentooPackageUseUnuse skipwhite +syn match GentooPackageUseUnuse contained /-[a-zA-Z][a-zA-Z0-9\-_]*/ + \ nextgroup=GentooPackageUseUse,GentooPackageUseUnuse skipwhite + +hi def link GentooPackageUseComment Comment +hi def link GentooPackageUseEmail Special +hi def link GentooPackageUseDate Number +hi def link GentooPackageUseAtom Identifier +hi def link GentooPackageUseUse Special +hi def link GentooPackageUseUnuse Keyword + +let b:current_syntax = "gentoo-package-use" + diff --git a/syntax/gentoo-use-desc.vim b/syntax/gentoo-use-desc.vim new file mode 100644 index 0000000..7257b79 --- /dev/null +++ b/syntax/gentoo-use-desc.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: Gentoo use.desc, use.local.desc files +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo package.keywords files. Requires vim 6.3 or +" later. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime syntax/gentoo-common.vim + +syn region GentooUseDescComment start=/#/ end=/$/ + \ contains=GentooBug + +syn match GentooUseDescPackage /^\(#\)\@!\([a-zA-Z0-9\-\_]\+\/[a-zA-Z0-9\-\_]\+\)\?/ nextgroup=GentooUseDescColon,GentooUseDescFlag skipwhite +syn match GentooUseDescColon /:/ contained nextgroup=GentooUseDescFlag +syn match GentooUseDescFlag contained /[a-zA-Z0-9\-\_]\+/ nextgroup=GentooUseDescDash skipwhite +syn match GentooUseDescDash /-\s*/ contained nextgroup=GentooUseDescDesc skipwhite +syn region GentooUseDescDesc start=// end=/$/ contained skipwhite + +hi def link GentooUseDescComment Comment +hi def link GentooUseDescPackage Keyword +hi def link GentooUseDescFlag Identifier +hi def link GentooUseDescDesc String + +let b:current_syntax = "gentoo-package-keywords" + diff --git a/syntax/glep.vim b/syntax/glep.vim new file mode 100644 index 0000000..021e02c --- /dev/null +++ b/syntax/glep.vim @@ -0,0 +1,61 @@ +" Vim syntax file +" Language: Gentoo GLEPs +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for Gentoo GLEPs. Needs vim 6.3 or later. Inherits from +" rst.vim and provides a few extras. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/rst.vim +unlet b:current_syntax + +" Headings in GLEPs (rst doesn't highlight these) +syn match glepHeading1 /^\(\(-\{2,\}\|=\{2,\}\|'\{2,\}\)\n\)\S.\+\n\(-\{2,\}\|=\{2,\}\|'\{2,\}\)$/ +syn match glepHeading2 /^\S.\+\n=\{2,\}$/ +syn match glepHeading3 /^\S.\+\n-\{2,\}$/ +syn match glepHeading4 /^\S.\+\n'\{2,\}$/ +syn match glepHeading5 /^\S.\+\n\^\{2,\}$/ + +" Folding +syn region glepFoldH2 start=/^\S.\+\n=\{2,\}$/ end=/\(\n\n\S.\+\n=\{2,\}\)\@=/ transparent fold +syn region glepFoldH3 start=/^\S.\+\n-\{2,\}$/ end=/\(\n\n\S.\+\n[-=]\{2,\}\)\@=/ transparent fold +syn region glepFoldH4 start=/^\S.\+\n'\{2,\}$/ end=/\(\n\n\S.\+\n[-=']\{2,\}\)\@=/ transparent fold + +" Headers at the top of a GLEP +syn region glepHeaders start=/\%^\(.*:\)\@=/ end=/^$/ contains=glepHeaderKey +syn region glepHeaderKey contained start=/^[A-Za-z0-9]/ end=/:/ nextgroup=glepHeaderValue skipwhite +syn region glepHeaderValue contained start=/\S/ end=/$/ contains=glepHeaderEmail,glepHeaderCVSVar +syn match glepHeaderEmail contained /<[-a-zA-Z0-9\_\.]\+@[-a-zA-Z0-9\_\.]\+>/ +syn region glepHeaderCVSVar contained start=/\$\S\+:/ end=/\$/ +syn keyword glepTODO TODO FIXME + +syn match rstInline /|\S\+|/ + +hi! link rstInline PreProc +hi! link rstInternalTarget PreProc + +hi link glepHeading1 Title +hi link glepHeading2 Constant +hi link glepHeading3 Keyword +hi link glepHeading4 Preproc +hi link glepHeading5 Special + +hi link glepHeaders Define +hi link glepHeaderKey Keyword +hi link glepHeaderValue String +hi link glepHeaderEmail Special +hi link glepHeaderCVSVar PreProc +hi link glepTODO Todo + +let b:current_syntax = "glep" + diff --git a/syntax/guidexml.vim b/syntax/guidexml.vim new file mode 100644 index 0000000..fe2642a --- /dev/null +++ b/syntax/guidexml.vim @@ -0,0 +1,41 @@ +" Vim syntax file +" Language: Gentoo guidexml +" Author: Ciaran McCreesh <ciaranm@gentoo.org> +" Copyright: Copyright (c) 2004-2005 Ciaran McCreesh +" Licence: You may redistribute this under the same terms as Vim itself +" +" Syntax highlighting for guidexml.xml. Inherits from xml.vim. +" + +if &compatible || v:version < 603 + finish +endif + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/xml.vim +unlet b:current_syntax + +syn cluster xmlTagHook add=guidexmlElement +syn keyword guidexmlElement contained mainpage guide news title subtitle +syn keyword guidexmlElement contained poster author abstract summary license +syn keyword guidexmlElement contained glsaindex glsa-latest version date +syn keyword guidexmlElement contained chapter section body figure fig img +syn keyword guidexmlElement contained br note impo warn pre p table tcolumn +syn keyword guidexmlElement contained tr th ti ul ol li b brite box c codenote +syn keyword guidexmlElement contained e i path mail uri + +syn cluster xmlAttribHook add=guidexmlAttr +syn match guidexmlAttr contained /about\|articles\|author\|caption\|category\|changelog/ +syn match guidexmlAttr contained /contract\|docs\|gentoo\|graphics\|id\|irc\|lang\|link/ +syn match guidexmlAttr contained /linkto\|lists\|news\|newsletter\|packages\|performace/ +syn match guidexmlAttr contained /projects\|short\|shots\|sponsors\|src\|support\|title/ +syn match guidexmlAttr contained /type\|where\|width/ + +hi def link guidexmlElement Keyword +hi def link guidexmlAttr Keyword + +let b:current_syntax = "guidexml" + |