Notepad++: How to Make the Function List work with Tcl and Bash

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.

 

Add this to the section


    
        
            
        
    

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.

 

Add this to the section


    
        
            
        
    

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.

Notepad++: Some Less Known Features

0325-215400-Notepad++
Microsoft’s default text editor Notepad is not good.  Especially for us programmers there is Notepad++. It is the fast pure text editor for programmers. Everytime you need to edit a small script and you don’t want to boot up your big IDE, Notepad++ is the editor to go for.


  • It is fast.
  • It’s got syntax highlighting for most programming languages.
  • It can handle multiple open files in tabs.

Probably you knew this already. But maybe you do not know some of the less known features of Notepad++ which often come in handy for a developer.

Less Known Features of Notepad++

With Notepad++, you can …. With these commands
change tab to space and vice versa Edit/Blank Operations/TAB to Space
convert end of line Edit/EOL Conversion
change the encoding of a file. ANSI, UTF-8, UCS2, … Encoding
encode and decode Base64 Plugins/Mime-Tools/Base64 …
do URL en- and decoding Plugins/Mime-Tools/URL …
convert between ASCII, decimal, hex, binary and octal Plugins/Converter/Conversion Panel
do block indentation and de-indentation Tab, Shift-Tab
change all keyboard shortcuts to your preferred ones. Settings/Shortcut Mapper…
apply syntax folding on multiple levels View/Fold All, Unfold All, Collapse Current Level, Uncollapse Current Level, Collapse Level/1,2,3,4,5,6,7, …
zoom in and out Ctrl-Num+ or Ctrl-Mouse-Wheel-Up
sort lines Edit/Line Operations/Sort Lines…
record and play macros Macro/Start Recording, Macro/Playback
use a function list View/Function List
diff files Plugins/Compare/…
use the plugin-manager to browse and install from dozens of special plugins that may be helpful for you Plugins/Plugin-Manager/Show Plugin Manager

Make Notepad++ Your Default Editor

I’ve associated many file types, including txt, ini, cs, cpp, tcl, bsh and others with Notepad++, so if I double click on such a file, Windows opens it with Notepad++ automatically. You can do this easily in Notepad++ by selecting Settings/Preferences/File Association .

0319-131138-Notepad++-Preferences

Here, for every extension you want to be associated with Notepad++, do

  1. Select an entry in the Supported exts column, e.g public script.
  2. Select the extension you want to be associated with Notepad++ besides.
  3. Click the arrow right.

Also, I have set Notepad++ as the text editor in Double Commander, so I can open any file in Notepad++ by clicking F4 in Double Commander, completely independent of its extension.

Stuff That Needs Improvement

There are some features in Npp that are meant well, but which need improvement.

Function List

A function list is a nice thing for a programmer, no question. A slight pity here is, it doesn’t work too well. I’ve tested it with bash, C++, C# and Tcl.

  • It doesn’t work at all with bash, C# and Tcl.
  • It doesn’t show constructors and destructors in C++

Diff Function

It is a good idea to build a diff function into a programmer’s editor of course. But pitily, the compare feature in Notepad++ is not mature at all. Ok, you can do a rudimentary comparison of two files. But that seems to be all. And before you do the comparison, you must make sure that the second of the files to compare is zoomed to the default level.

You just can’t compare Notepad++’s compare function to a real comparison tool, like Beyond Compare or WinMerge. (Sorry, this sentence just had to be.)

This post refers to Notepad++ version 6.5.5.