macro for next/previous function

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
troels_kn
Posts: 32
Joined: Fri Oct 28, 2005 12:51 pm

macro for next/previous function

Post by troels_kn »

I'm mainly using Textpad for writing PHP, and I have found the following macro quite useful. It simply jumps to the next function in the file (And its counterpart jumps to the previous function). It's a quick way to navigate in large files:

To implement it:

Start with a file, where there is a function defined, somewhere below your cursor. For example:

Code: Select all

<?php
// place cursor here
  function foobar() {
  }
(begin macro)
Press 'End'
From the menu select: Search > Find
[X] Regular expressions
Directions: Down
Find what: function[[:space:]]+[[:alnum:]_]+[[:space:]]?(
Press 'Find Next'
Press 'Close'
Press 'Home'
Press 'Home'
(stop macro)

For the opposite (find previous function), repeat the above, but switch the 'Directions' option in the search dialogue to 'Up', and don't press 'End' in the beginning.

I have these macros bound to Ctrl+Down and Ctrl+Up.

Enjoy.

PS.: I reckon that these macros should work with any C-like language (Including C, C++ and Java)
Post Reply