4
votes

I'm using Notepad++ to write Python 2.7 code. I just want to create my own block indicator and fold the block so it is hidden. Something like:

#//begin
#//end

I'm going to use the comment # as the front character so as not to upset the code. All the questions and answers I've found on this topic are several years old back when Notepad++ seemed to allow this. Now the menus have changed and it doesn't seem possible to simply do this. There is the option to create a "User defined language" but I don't want to do this from scratch. I want to add this one feature to Python. Or, if it is simple enough, create my own language using Python defaults as a starting point and adding this one feature. I just can't figure out how.

1
I wouldn't use notepad++ for Python. - Matt
It's on my work machine. My options are limited. I picked Notepad++ because it has a portable version that doesn't require installation (admin privileges). - twegner

1 Answers

1
votes

Adding a user defined language using Notepad++ to just add folding can be done as follows:

  1. Click on Language > Define your language

  2. Click on Create New... and enter a name for it e.g. Twegner

  3. In the section on the right add your #//begin and #//end styles for Open and Close.

  4. Close the dialog and create a file using your styles.

  5. Select Language > Twegner (which should now be shown at the bottom of the menu).

For example:

Notepadd++ user defined language screenshot

This would then work as follows:

Folding example