trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2011

Arch Linux - dev tip -> kate syntax highlighting for PKGBUILD scripts

From: "David C. Rankin" <drankinatty@...>
Date: Fri, 11 Mar 2011 19:38:24 -0600
All Arch-Trinity devs (and everyone else):

   Most probably know this, but there is a great little trick to use in kate to 
automatically apply bash syntax highlighting to PKGBUILD scripts when you open 
them in kate/kwrite.

   The only requirement is that you give the PKGBUILD scripts a common 
extension. (I haven't been able to find a way to do this without using an 
extension). The extension can be anything - so long as it isn't already used by 
something else. (.pb or .pkgb will work).

   I ended up with '.svn' extensions by accident when I changed from building in 
tree to the traditional PKGBUILD format to distinguish the new PKGBUILDs. eg.:

19:02 alchemy:~> ls -1 tde/tnotes/pkgbuild/svn
PKGBUILD-app-amarok.svn
PKGBUILD-app-gtk-qt-engine.svn
PKGBUILD-app-kgtk-qt3.svn
<snip>

   If you are working on any other distro that has a known highlighting syntax 
file in kate/kwrite -- this will also work for you. To set this up, in kate:

(1) Settings -> Configure Kate -> Highlighting

(2) select the mime-type for your file from the "Highlight:" list-box

(3) then add your script extension to the "File extensions:" field

   For my Arch setup where the PKGBUILD scripts have bash syntax, the setup 
looks like:

Highlight:       Scripts/Bash
File extensions: *.sh;*.bash;*.ebuild;*.eclass;*.svn;<snip>

   Works like a champ... and beats the heck out of doing 
'Tools->Highlighting->Scripts->Bash' over and over again :)

-- 
David C. Rankin, J.D.,P.E.