Notepad++插件之FunctionList-for PHP development

One thing I really love about Notepad++ is the plugin’s that are available. One of such plugins that I enjoy is the Function List plugin to automatically search my code to pull classes, functions and much more into an easy to see pane on the right side of my screen. I had previously posted tutorials on another site but now I have made the process for “installing” these new rules easier by posting the XML as well as adding more features. Once you have followed the below steps the Function List plugin will show all of the following:

  • PHP classes
  • PHP class variables – (public, protected and private)
  • PHP functions – already does this by default
  • CodeIgniter Views
  • CodeIgniter Helpers
  • CodeIgniter Libraries
  • CodeIgniter Models
  • PHP include()
  • PHP include_once
  • PHP require()
  • PHP require_once()

Update: I updated the instructions based on a comment below to close Notepad++ while editing the .xml file

Step 1: Close Notepad++
Step 2: Navigate to C:\Program Files\Notepad++\plugins\Config – This is the default installation folder, it may be different on your system.
Step 3: Open the FunctionListRules.xml file in your favorite editor other than Notepad++. The settings may not save if you open this file in Notepad++.
Step 4: Do a search for the following line: (This will more than likely be at the end of the file.)

<Language name="PHP" imagelistpath="">

Step 5: Add the following code between the opening and closing Language tags:

<Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords="">
            <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" />
        </Group>
        <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords="">
            <Rules regexbeg="function[\s&amp;]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" />
        </Group>
        <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;view\([&apos;&quot;]' regexfunc='[&quot;\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;helper\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;helper\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;library\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;library\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;model\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;model\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='include\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='include_once\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='require\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='require_once\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>

My full section including the Language tags looks like this:

<Language name="PHP" imagelistpath="">
        <CommList param1="#" param2="" />
        <CommList param1="//" param2="" />
        <CommList param1="/\*" param2="\*/" />
        <Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords="">
            <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" />
        </Group>
        <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords="">
            <Rules regexbeg="function[\s&amp;]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" />
        </Group>
        <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;view\([&apos;&quot;]' regexfunc='[&quot;\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;helper\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;helper\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;library\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;library\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="\$this-&gt;(.*)load-&gt;model\(array\(" regexfunc='[&apos;,&quot;\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" />
            <Rules regexbeg='\$this-&gt;(.*)load-&gt;model\([&apos;&quot;]' regexfunc='[&quot;\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='include\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='include_once\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='require\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
        <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg='require_once\([&apos;&quot;]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" />
        </Group>
    </Language>

Step 6: Save and close, then open up a PHP file in Notepad++ to see if it shows the desired output in the Function List tool.

英文原文:http://www.danielkassner.com/2010/01/22/using-notepads-function-list-plugin-for-php-development

2 comments

发布评论

您的电子邮箱不会被公开。 标记为 * 的区域必须填写

*

无觅相关文章插件,快速提升流量