ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

notepad2-mod: custom code folding for txt files?

(1/5) > >>

Nod5:
I want to use the notepad2-mod code folding feature for note outlining. I would write notes using tabbed indentation to mark each sub level. Then use the code folding action to hide/show sub level text.

notepad2-mod presently does folding in tab indented python (.py) files. But I want it for .txt files and I want it without any text highlighting/coloring effects. Does any notepad2 user here think that is doable? Do you even have some idea on how to do it?

(Note: I searched but found no talk of this for notepad2. However, someone back in 2007 had the same idea for UltraEdit. )

Edit: view > Customize schemes... lists types of code files that notepad2 supports highlighting/folding for. I can simply remove .txt from "Default text" and add it under "Python". But then I also get all the other python highlighting for all txt files. I tried to export the schemes settings, copied and renamed the python section to a new name in the settings file and there removed all color highlighting. But that new section does not appear if I import the edited exported settings. I don't want to disable highlighting for all python files either because I have use for it there. Maybe there is some other code language that can be folded at tab or space indentations? Can anyone see one in this list:

Shades:
If you are not in the habit of creating installers for software you create, I would restructure one of those to implement your idea (Inno setup, NSIS).

Personally, what I use is Notepad++ and it can do what you ask...creating a new code format for your specific text files, it can do folding and has support for plugins. So if you are still missing functionality, you could peruse through the available plugins or boldly write one yourself.

Notepad2 is a decent text editor, but doesn't allow much beyond its capabilities...unfortunately. (unless forking is an option for you). By now I have seen more than one fork of the Notepad2 source, each addressing a problem specific to its author. Makes you kinda wish the Notepad2 software supported plugins.

Nod5:
Notepad2-mod is open source so I could attemp to modify this in the source (add a clone of the python syntax scheme that I can then in the UI remove coloring for and link to .txt files only while keeping the .py scheme as is). But that would take a lot of work. So I'll first look into repurposing one of the above throught the UI only. So the key question right now is: does anyone here spot a language in the list above that you know uses tabs/spaces at the start of lines as a separator instead of braces? Besides Python. Yes, I can research them one by one. But I hope someone here will spare me that by spotting one in the list immediately.

Shades:
With the example file I used (a batch script with a lot of sections) I saw that when I selected the Py scheme as the syntax scheme for this file, code folding options appeared.

With its basic structure, only the YAML, Visual Basic, VB Script, Cmake Script and AutoIt3 syntax schemes showed somewhat similar code folding options, so you likely could use any one of these.

Then I manually indented (4 spaces for each indentation) the content of this file...same set of syntax schemes do code folding.
Replaced all spaced indentations with tabbed indentations and again only the same set of syntax schemes do code folding.

I think it is safe to say that the code folding functionality doesn't respond to the use of tabs or spaces. None of the code folding in the other schemes matches the code folding from the Python syntax scheme, though.

To me it means that there are 3 main solutions to your question.
1. Do the cloning solution you mentioned in your last post in this thread.
2. Adjust the rules of the code folding functionality that is there.
3. Use different software.

For this small test I used Notepad2-mod 4.2.25.870 (64-bit zip).

dr_andus:
3. Use different software.
-Shades (October 26, 2013, 11:21 AM)
--- End quote ---

This may not be what you're looking for, but Noteliner can be used as a fairly basic single-pane outliner (ignore the colours, tables, and Gantt chart in the screenshots, those are optional), and you can save its outlines as text files, where the hierarchy is preserved via tab indentation.

Navigation

[0] Message Index

[#] Next page

Go to full version