In another post about Notepad++ I critisized that its function list feature does not work for Tcl and Bash scripts. Now I’ve got a solution. Here is it.
How to Make the Function List Work for Tcl
Open functionList.xml
in an editor. FunctionList.xml
is in %APPDATA%\notepad++
or in the installation directory of Notepad++.
Add this line to the section with all the other association
-entries.
<association langID="29" id="tcl_procedure"/>
Add this to the section <parsers>
<parser id="tcl_procedure" displayName="Tcl source" commentExpr="(#)"> <function mainExpr="^[\t ]*((proc)[\s]+)[^\n]+\{" displayMode="$functionName"> <functionName> <nameExpr expr="[\w: ]+ \{.*\}"/> </functionName> </function> </parser>
Restart Notepad++. Credits for the solution go to Detlef of compgroups.net/comp.lang.tcl. I’ve copied his’ and shortened it a bit. And added support for bash.
How to Make the Function List Work for Bash
In functionList.xml
add this line to the section with all the other association
-entries.
<association langID="26" id="bash_function"/>
Add this to the section <parsers>
<parser id="bash_function" displayName="Bash" commentExpr="(#)"> <function mainExpr="^[\t ]*((function)[\s]+)[^\n]+" displayMode="$functionName"> <functionName> <nameExpr expr="[\w: ]+"/> </functionName> </function> </parser>
Restart Notepad++.
Download
Or just download my functionList.xml with Tcl and Bash support and replace yours.
Update: As Olivier from comp.lang.tcl pointed out, my version does not work with Npp 6.4.3. I’ve rechecked this, he is right. My version does work at least with versions 6.4.5, 6.5 and 6.5.5, though.
Update 2: Thanks to Rasha Matt Blais for his improved version of the mainExpr
for bash functions. Though that one still misses some types of function definition. Here my latest mainExpr
string:
mainExpr="^[\t ]*((function)[\s]+)[^\n]+|[\w_]+[\s]*(\([\s]*\))"
I’ve also adapted the downloadable functionList.xml. And I’ve added the testfunc.bsh
file which contains some bash functions with which I’ve tested the my mainExpr
string.