diff options
author | 2007-05-06 18:09:06 +0000 | |
---|---|---|
committer | 2007-05-06 18:09:06 +0000 | |
commit | 59843dc4324eba26271ead839312920bb61562fd (patch) | |
tree | 1d0a1496d660663223786a1b82dbd580841e4d1c | |
download | eselect-syntax-59843dc4324eba26271ead839312920bb61562fd.tar.gz eselect-syntax-59843dc4324eba26271ead839312920bb61562fd.tar.bz2 eselect-syntax-59843dc4324eba26271ead839312920bb61562fd.zip |
Split up gentoo-syntax (part 3).
svn path=/trunk/eselect-syntax/; revision=31
-rw-r--r-- | Makefile | 78 | ||||
-rw-r--r-- | ftdetect/eselect.vim | 18 | ||||
-rw-r--r-- | ftplugin/eselect.vim | 26 | ||||
-rw-r--r-- | indent/eselect.vim | 23 | ||||
-rw-r--r-- | plugin/neweselect.vim | 72 | ||||
-rw-r--r-- | syntax/eselect.vim | 69 |
6 files changed, 286 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9162af6 --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +# Makefile for eselect-syntax + +distapp = eselect-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/eselect-syntax.txt + +files_ftdetect = \ + ftdetect/eselect.vim + +files_ftplugin = \ + ftplugin/eselect.vim + +files_indent = \ + indent/eselect.vim + +files_plugin = \ + plugin/neweselect.vim + +files_syntax = \ + syntax/eselect.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 + diff --git a/ftdetect/eselect.vim b/ftdetect/eselect.vim new file mode 100644 index 0000000..d9299d7 --- /dev/null +++ b/ftdetect/eselect.vim @@ -0,0 +1,18 @@ +" Vim filetype detection file +" Language: Eselect 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 Eselect modules. +" + +if &compatible || v:version < 603 + finish +endif + +" eselect modules +au BufNewFile,BufRead *.eselect + \ set filetype=eselect + +" vim: sw=4 ts=4 et fdm=marker diff --git a/ftplugin/eselect.vim b/ftplugin/eselect.vim new file mode 100644 index 0000000..7c248d2 --- /dev/null +++ b/ftplugin/eselect.vim @@ -0,0 +1,26 @@ +" Vim filetype plugin file +" Language: Eselect 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 eselect 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/indent/eselect.vim b/indent/eselect.vim new file mode 100644 index 0000000..afb78cf --- /dev/null +++ b/indent/eselect.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: Eselect 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 Eselect modules. Inherits from sh.vim and adds +" in Eselect-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/plugin/neweselect.vim b/plugin/neweselect.vim new file mode 100644 index 0000000..681e3da --- /dev/null +++ b/plugin/neweselect.vim @@ -0,0 +1,72 @@ +" Vim plugin +" Purpose: Intelligently create content for new eselect 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! EselectModuleHeader() + 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 ='# $Id: $' + $ +endfun + +fun! <SID>MakeNewEselectModule() + let l:pastebackup = &paste + let l:maintainer = substitute(GentooGetUser(), "^.*<\\(.*\\)>", "\\1", "g") + set nopaste + + call EselectModuleHeader() + + " {{{ boiler-plate eselect module + put ='DESCRIPTION=\"\"' + put ='MAINTAINER=\"' . l:maintainer . '\"' + 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 MakeNewEselectModule call <SID>MakeNewEselectModule() + +augroup MakeNewEselectModule + au! + autocmd BufNewFile *.eselect + \ call <SID>MakeNewEselectModule() +augroup end + +" vim: sw=4 ts=4 et fdm=marker diff --git a/syntax/eselect.vim b/syntax/eselect.vim new file mode 100644 index 0000000..26ae05d --- /dev/null +++ b/syntax/eselect.vim @@ -0,0 +1,69 @@ +" Vim syntax file +" Language: Gentoo Eselect modules/libs +" 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 EselectCoreKeyword die is_function has + +" Config keywords +syn keyword EselectConfigKeyword store_config load_config add_config + +" (String/misc) manipulation keywords +syn keyword EselectManipKeyword svn_date_to_version + +" Multilib keywords +syn keyword EselectMultilibKeyword list_libdirs + +" Output keywords +syn keyword EselectOutputKeywords write_error_msg write_list_start +syn keyword EselectOutputKeywords write_kv_list_entry write_numbered_list_entry +syn keyword EselectOutputKeywords write_numbered_list highlight +syn keyword EselectOutputKeywords highlight_warning space + +" Test keywords +syn keyword EselectTestKeywords is_number + +" clusters +syn cluster EselectThings contains=EselectCoreKeyword,EselectConfigKeyword +syn cluster EselectThings add=EselectManipKeyword,EselectMultilibKeyword, +syn cluster EselectThings add=EselectOutputKeywords,EselectTestKeywords + +syn cluster shCommandSubList add=@EselectThings + +hi def link EselectCoreKeyword Keyword +hi def link EselectConfigKeyword Identifier +hi def link EselectManipKeyword Identifier +hi def link EselectMultilibKeyword Identifier +hi def link EselectOutputKeyword Identifier +hi def link EselectTestKeyword Identifier + +let b:current_syntax = "eselect" + +" vim: sw=4 ts=4 et fdm=marker |