Am 15.11.2016 um 21:57 schrieb Patrick Ben Koetter: Good morning Patrick & List members,
please find attached a modified version of the scripts that sets the CAT var to either gz (as on my opensuse 42.1) or bz2. Feel free to use it according to the GNU GENERAL PUBLIC LICENSE Version 2, June 1991 provided by Patrick under https://github.com/sys4/vim-postfix/blob/master/LICENSE > vim comes with syntax highlighting for Postfix, but the syntax file is > outdated and doesn't cover LDAP and other drivers. > > For those who like an up to date syntax highlighting that reflects your > Postfix installation take a look at https://github.com/sys4/vim-postfix. > > Christian (Rößner) took the time to create two scripts that will create syntax > files. The README tells how to install them. Worked out of the box for me. > > p@rick > > =========================================================================== Note: this message was send by me *only* if the eMail message contains a correct pgp signature corresponding to my address at flo...@floppy.org. Do you need my PGP public key? Check out http://www.floppy.org or send me an email with the subject "send pgp public key" to this address of mine.Thx!
#!/bin/bash # #set -x POSTCONF1=/usr/share/man/man1/postconf.1.gz POSTCONF5=/usr/share/man/man5/postconf.5.gz TEMP="`ls $POSTCONF1|cut -d "." -f 2`" if [ "$TEMP" == "gz" ] ; then CAT=/usr/bin/gzip CATPARAM=-dc elif [ "$TEMP" == "bz2" ] ; then CAT=/usr/bin/bzcat CATPARAM= fi ############################################################################### TEMP=/tmp/$(basename $0)-pfmain-$$ trap -- "rm -f ${TEMP}" EXIT [[ -x ${CAT} ]] || exit 1 [[ -f ${POSTCONF1} ]] || exit 1 [[ -f ${POSTCONF5} ]] || exit 1 cat > ${TEMP} << EOB " Vim syntax file " Language: Postfix main.cf configuration " Maintainer: Christian Roessner <c...@sys4.de> " Last Change: 2016 Nov 13 " Version: 0.40 " Comment: Auto-generated if version < 600 syntax clear elseif exists("b:current_syntax") finish endif if version >= 600 setlocal iskeyword=@,48-57,_,- else set iskeyword=@,48-57,_,- endif syntax case match syntax sync minlines=1 EOB ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk '/^\.SH ([a-z0-9_]+).+/ { print "syntax keyword pfmainConf "$2 }' \ >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5}| \ awk 'match($0, /\\fItransport\\fR(_[a-z_]+) /, a) { print "syntax match pfmainConf \""a[1]"\\>\"" }' \ >> ${TEMP} echo >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk '/^\.SH ([a-z0-9_]+).+/ { print "syntax match pfmainRef \"$\\<"$2"\\>\"" }' \ >> ${TEMP} echo >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk 'match($0, /^\.IP \"\\fB([a-z0-9_]+) ?\\f[RI]/, a) { print "syntax keyword pfmainWord "a[1] }' \ >> ${TEMP} echo >> ${TEMP} function paragraph() { ${CAT} ${CATPARAM} ${POSTCONF1} | \ awk -v text="$3" 'BEGIN { s = 0 } { if (s == 0) { if ($0 ~ /\.IP \\fB\\\'"${1}"'\\fR/) { s = 1; } } else { if ($0 ~ /\.IP \\fB\\\'"${2}"'\\fR/) { exit; } if (match($0, /^\.IP \"?\\fB([a-z]+)\\fR\"?/, a)) { print text, a[1] } } }' >> ${TEMP} } paragraph "-m" "-M" "syntax keyword pfmainDict" echo >> ${TEMP} paragraph "-a" "-A" "syntax keyword pfmainSASLType" echo >> ${TEMP} paragraph "-l" "-m" "syntax keyword pfmainLock" cat >> ${TEMP} << EOB syntax keyword pfmainQueueDir incoming active deferred corrupt hold syntax keyword pfmainTransport smtp lmtp unix local relay uucp virtual syntax keyword pfmainAnswer yes no syntax match pfmainComment "#.*$" syntax match pfmainNumber "\<\d\+\>" syntax match pfmainTime "\<\d\+[hmsd]\>" syntax match pfmainIP "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" syntax match pfmainVariable "\$\w\+" contains=pfmainRef syntax match pfmainVariable2 "\${\w\+}" contains=pfmainConf syntax match pfmainSpecial "\<alias\>" syntax match pfmainSpecial "\<canonical\>" syntax match pfmainSpecial "\<command\>" syntax match pfmainSpecial "\<file\>" syntax match pfmainSpecial "\<forward\>" syntax match pfmainSpecial "\<noanonymous\>" syntax match pfmainSpecial "\<noplaintext\>" syntax match pfmainSpecial "\<resource\>" syntax match pfmainSpecial "\<software\>" syntax match pfmainSpecial "\<bounce\>" syntax match pfmainSpecial "\<cleanup\>" syntax match pfmainSpecial "\<cyrus\>" syntax match pfmainSpecial "\<defer\>" syntax match pfmainSpecial "\<error\>" syntax match pfmainSpecial "\<flush\>" syntax match pfmainSpecial "\<pickup\>" syntax match pfmainSpecial "\<postdrop\>" syntax match pfmainSpecial "\<qmgr\>" syntax match pfmainSpecial "\<rewrite\>" syntax match pfmainSpecial "\<scache\>" syntax match pfmainSpecial "\<showq\>" syntax match pfmainSpecial "\<trace\>" syntax match pfmainSpecial "\<verify\>" if version >= 508 || !exists("pfmain_syntax_init") if version < 508 let pfmain_syntax_init = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink pfmainConf Statement HiLink pfmainRef PreProc HiLink pfmainWord Statement HiLink pfmainDict Type HiLink pfmainSASLType Type HiLink pfmainQueueDir Constant HiLink pfmainTransport Constant HiLink pfmainLock Constant HiLink pfmainAnswer Constant HiLink pfmainComment Comment HiLink pfmainNumber Number HiLink pfmainTime Number HiLink pfmainIP Number HiLink pfmainVariable Error HiLink pfmainVariable2 PreProc HiLink pfmainSpecial Special delcommand HiLink endif let b:current_syntax = "pfmain" " vim: ts=8 sw=2 EOB awk '/^([[:blank:]]*|.*if .*|.*else(if| )?.*|.*endif.*)$/ { print; next; }; !seen[$0]++' ${TEMP} > pfmain.vim exit 0
#!/bin/bash # #set -x POSTCONF1=/usr/share/man/man1/postconf.1.gz POSTCONF5=/usr/share/man/man5/postconf.5.gz TEMP="`ls $POSTCONF1|cut -d "." -f 2`" if [ "$TEMP" == "gz" ] ; then CAT=/usr/bin/gzip CATPARAM=-dc elif [ "$TEMP" == "bz2" ] ; then CAT=/usr/bin/bzcat CATPARAM= fi ############################################################################### TEMP=/tmp/$(basename $0)-pfmaster-$$ trap -- "rm -f ${TEMP}" EXIT [[ -x ${CAT} ]] || exit 1 [[ -f ${POSTCONF1} ]] || exit 1 [[ -f ${POSTCONF5} ]] || exit 1 cat > ${TEMP} << EOB " Vim syntax file " Language: Postfix master.cf configuration " Maintainer: Christian Roessner <c...@sys4.de> " Last Change: 2016 Nov 13 " Version: 0.40 " Comment: Auto-generated if version < 600 syntax clear elseif exists("b:current_syntax") finish endif if version >= 600 setlocal iskeyword=@,48-57,_,- else set iskeyword=@,48-57,_,- endif syntax case match syntax sync minlines=1 EOB ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk '/^\.SH ([a-z0-9_]+).+/ { print "syntax keyword pfmasterConf "$2; }' \ >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5}| \ awk 'match($0, /\\fItransport\\fR(_[a-z_]+) /, a) { print "syntax match pfmasterConf \""a[1]"\\>\"" }' \ >> ${TEMP} echo >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk '/^\.SH ([a-z0-9_]+).+/ { print "syntax match pfmasterRef \"$\\<"$2"\\>\""; }' \ >> ${TEMP} echo >> ${TEMP} ${CAT} ${CATPARAM} ${POSTCONF5} | \ awk 'match($0, /^\.IP \"\\fB([a-z0-9_]+) ?\\f[RI]/, a) { print "syntax keyword pfmasterWord "a[1]; }' \ >> ${TEMP} echo >> ${TEMP} function paragraph() { ${CAT} ${CATPARAM} ${POSTCONF1} | \ awk -v text="$3" 'BEGIN { s = 0 } { if (s == 0) { if ($0 ~ /\.IP \\fB\\\'"${1}"'\\fR/) { s = 1; } } else { if ($0 ~ /\.IP \\fB\\\'"${2}"'\\fR/) { exit; } if (match($0, /^\.IP \"?\\fB([a-z]+)\\fR\"?/, a)) { print text, a[1] } } }' >> ${TEMP} } paragraph "-m" "-M" "syntax keyword pfmasterDict" echo >> ${TEMP} paragraph "-a" "-A" "syntax keyword pfmasterSASLType" echo >> ${TEMP} paragraph "-l" "-m" "syntax keyword pfmasterLock" cat >> ${TEMP} << EOB syntax keyword pfmasterType inet pass fifo unix syntax keyword pfmasterQueueDir incoming active deferred corrupt hold syntax keyword pfmasterAnswer yes no y n - syntax keyword pfmasterOpt -o -v -vv -vvv flags user argv syntax match pfmasterComment "#.*$" syntax match pfmasterNumber "\<\d\+\>" syntax match pfmasterTime "\<\d\+[hmsd]\>" syntax match pfmasterIP "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>" syntax match pfmasterIP6 "\[\([0-9a-fA-F]\{0,4\}:\)\{1,7\}[0-9a-fA-F]\{0,4\}\]" syntax match pfmasterVariable "\$\w\+" contains=pfmasterRef syntax match pfmasterVariable2 "\${\w\+}" contains=pfmasterConf syntax match pfmasterService "\<anvil\>" syntax match pfmasterService "\<bounce\>" syntax match pfmasterService "\<cleanup\>" syntax match pfmasterService "\<cyrus\>" syntax match pfmasterService "\<defer\>" syntax match pfmasterService "\<discard\>" syntax match pfmasterService "\<dnsblog\>" syntax match pfmasterService "\<error\>" syntax match pfmasterService "\<flush\>" syntax match pfmasterService "\<lmtp\>" syntax match pfmasterService "\<local\>" syntax match pfmasterService "\<oqmgr\>" syntax match pfmasterService "\<pickup\>" syntax match pfmasterService "\<pipe\>" syntax match pfmasterService "\<postdrop\>" syntax match pfmasterService "\<postscreen\>" syntax match pfmasterService "\<proxymap\>" syntax match pfmasterService "\<proxywrite\>" syntax match pfmasterService "\<qmgr\>" syntax match pfmasterService "\<qmqpd\>" syntax match pfmasterService "\<relay\>" syntax match pfmasterService "\<retry\>" syntax match pfmasterService "\<rewrite\>" syntax match pfmasterService "\<scache\>" syntax match pfmasterService "\<showq\>" syntax match pfmasterService "\<smtp\>" syntax match pfmasterService "\<smtps\>" syntax match pfmasterService "\<smtpd\>" syntax match pfmasterService "\<spawn\>" syntax match pfmasterService "\<submission\>" syntax match pfmasterService "\<tlsmgr\>" syntax match pfmasterService "\<tlsproxy\>" syntax match pfmasterService "\<trace\>" syntax match pfmasterService "\<trivial-rewrite\>" syntax match pfmasterService "\<verify\>" syntax match pfmasterService "\<virtual\>" if version >= 508 || !exists("pfmaster_syntax_init") if version < 508 let pfmaster_syntax_init = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink pfmasterConf Statement HiLink pfmasterRef PreProc HiLink pfmasterWord Statement HiLink pfmasterOpt PreProc HiLink pfmasterDict Type HiLink pfmasterSASLType Type HiLink pfmasterQueueDir Constant HiLink pfmasterLock Constant HiLink pfmasterAnswer Special HiLink pfmasterType Type HiLink pfmasterComment Comment HiLink pfmasterNumber Number HiLink pfmasterTime Number HiLink pfmasterIP Number HiLink pfmasterIP6 Number HiLink pfmasterVariable Error HiLink pfmasterVariable2 PreProc HiLink pfmasterService Include delcommand HiLink endif let b:current_syntax = "pfmaster" " vim: ts=8 sw=2 EOB awk '/^([[:blank:]]*|.*if .*|.*else(if| )?.*|.*endif.*)$/ { print; next; }; !seen[$0]++' ${TEMP} > pfmaster.vim exit 0
signature.asc
Description: OpenPGP digital signature