How to collapse/hide lines? (not alt+h method)
-
Hello guys,
I’m just a normal person messing with his game mods .ini and am having a little trouble trying to navigate the file through notepad++.
On one of the original files, I can collapse and expand lines just by clicking on a little + signs by the line and it works great, just like this: https:/ /imgur .com/a/lgcP72N (sorry, couldn’t post working link because it’s my first post in the forum).
On one of the mods files I’d like to do the same but I’m not being able to. I tried to google around a little and the only command I found to do something similar was Alt+H but it is not helpful. The Alt+H command is a one time use only command and I can’t easily collapse and expand the lines again like I can in the original file.
Can anyone tell me how I can do this with notepad++? I can even upload the file itself somewhere if you guys want to check it out to try to figure out what is happening, just tell me a good site to upload it and I’ll do it.
I appreciate your time and thanks in advance for helping.
-
you can embed the images rather than posting a link to the ad-revenue-html page that imgur uses. even better, just paste the image in your post. (And now that you’ve been upvoted, you can post links)
On one of the mods files I’d like to do the same but I’m not being able to.
Could you show a screenshot of the one that doesn’t have the +/- fold in the margin? Please include the status bar from the bottom of the Notepad++ window, because that will tell us whether the problem file is not being properly interpreted as INI
-
@PeterJones said in How to collapse/hide lines? (not alt+h method):
Could you show a screenshot of the one that doesn’t have the +/- fold in the margin? Please include the status bar from the bottom of the Notepad++ window, because that will tell us whether the problem file is not being properly interpreted as INI
Indeed, the TEST FILE I tried wasn’t saved as a .ini and thus didn’t have this +/- fold in the margin. After I saved it as a .ini it showed identical behavior, exactly like you predicted it would happen.
The problem is that the REAL file that I do want to do this to is a normal text file. On the mod’s user guide (a normal text file), the creator lists the functions he uses and later on the document he lists the possible values for those functions. I’m working on the .ini but I want to edit the user guide .txt to get easier to visualize the functions and values without needing to hop up and down the file.
So I came back to the original problem: I’m in a normal text file trying to emulate a behavior that I see on a .ini file. Is it possible?
Also, thanks a lot for the upvote! :)
-
@TheBronn said in How to collapse/hide lines? (not alt+h method):
So I came back to the original problem: I’m in a normal text file trying to emulate a behavior that I see on a .ini file. Is it possible?
Notepad++ figures out the language of a file from it.s file extension. A .ini file will be interpreted as an INI file. A .txt file will be interpreted as a text file.
You have several options.
- Rename or save the file to .ini. You already did this and it works.
- When viewing a text file select the
Language / I / INI file
menu option. Notepad will start interpretting the file as though it has an .ini file extension. - This is like option 2 in that you can record a keyboard macro that runs the
Language / I / INI file
menu option so that in a single keystroke you can flip to .ini mode. - I think you can override Notepad++'s handling of .txt files to behave like .ini files. I’d strongly discourage this.
-
JsonTools supports a treeview for ini files, which you may find useful.
-
It works but with a setback: I need to set the next line on the file as a header as well. It… works? It’s a workaround but it’s okay.
I wish I could just select a few lines, turn it collapsible and that’s it. Since it’s just a instructions manual it can be done, no problem.
I can work with this (and will) It’s just… anticlimatic, I guess? Needing to turn a normal .txt into a .ini just to be able to turn a line into a header to collapse its comments feels weird. Feels counterproductive to me. Would it work if it was another format? This is what makes me think that there
@Mark-Olson
Vanilla notepad++ already does this with .ini files. I’m trying to do it on any kind of text without needing to set a header (and not using Alt+H command) -
@TheBronn said in How to collapse/hide lines? (not alt+h method):
I’m trying to do it on any kind of text without needing
The problem is generic text (i.e. “any kind of text”) has no notion of a hierarchy. It’s just free form.
-
@TheBronn said in How to collapse/hide lines? (not alt+h method):
I’m trying to do it on any kind of text without needing to set a header
Your only alternative is the
Alt+H
hide lines command. It will add green arrows in the left margin, much line the plus+
signs used for collapsed sections.+
collapse lines expects some sort of structure to your text such as blank lines between paragraphs or indented text. You then need to figure out a Notepad++ language parser that matches the structure you are using.If you use indented text using spaces or tabs try switching the language to Python. It’s a computer language where a statement block is defined as a line of text followed by indented lines of text.
Off hand, I don’t know of a “language” that uses blank lines set off sections.
-
@mkupper said in How to collapse/hide lines? (not alt+h method):
Your only alternative is the Alt+H hide lines command
Two things about this:
- OP said in the title of their post:
not alt+h method
(so it really isn’t fair game for a response) - Hidden lines support in Notepad++ is horrible (so I recommend to not use it)
- OP said in the title of their post:
-
@Alan-Kilborn said in How to collapse/hide lines? (not alt+h method):
OP said in the title of their post: not alt+h method
If someone paints themselves into a corner then you will either need to be patient while the paint dries or you can can break a few rules. :-)
Hidden lines support in Notepad++ is horrible
For a long time I avoided hidden lines, mainly as I’d activate it by accident fumbling
Alt+H
when I meantCtrl-H
and then wondered what those green arrows were. How that I understand the green arrows I have been using hidden lines at times. They are useful when you have hundreds or thousands of lines of column oriented text. I’ll hide lines 2 to N-1 of the block, leaving just the first and last lines visible. I can then easily select and manipulate the columns knowing the same is being done to the hidden lines.@TheBronn, I think it would help if you provided examples of the free form text that you want to be collapsible. It may have a structure that matches something in Notepad++. In the forums use three backticks ``` in a row on a line by itself before and after your example text and it will display
like this
-
@Alan-Kilborn
Makes sense why I’m not managing to figure this problem out.@mkupper
Yeah, I’m seeing that I’m having trouble with the fact that I’m trying to use it a little like Excel where you can just group some lines and collapse/expand them as you will.
I’m not a programmer (yet), I’m just a dude trying to figure out how to mod my game. I use N++ because of its built-in feature of autosaving all open tabs and what is written in them. Current version MS Notepad has the same stuff but I’ll keep with N++ because I like it a lot.@mkupper said in How to collapse/hide lines? (not alt+h method):
If someone paints themselves into a corner then you will either need to be patient while the paint dries or you can can break a few rules. :-)
Someone understands me quite a lot! xD
@mkupper said in How to collapse/hide lines? (not alt+h method):
I think it would help if you provided examples of the free form text that you want to be collapsible
Sure thing. Just to explain, I’m trying to set up some custom health bars for TES4: Oblivion. The mod in question is HUS Status Bars. Just a single function for the custom bars I’m trying to add is the x position of the bar. Here is the function and its explanation from the read_me (the file I’m trying to edit):
tnoHSB.hud_x (number) X position of bar. Default = same x pos as previous bar.
(I have no idea why this thing came out red)Much later there is the list of possible values for hud_x:
HUDdefault, HUDprevBar or no value: Same x pos as previous bar (or standard bars for first bar) HUDbars Same x pos as standard bars/the last bar with hud_store_pos set HUDbarsLeft To the left of standard bars/the last bar with hud_store_pos set HUDbarsRight To the righ of standard bars/the last bar with hud_store_pos set HUDprevBarLeft To the left of the previously defined bar HUDprevBarRight To the right of the previously defined bar HUDweaponLeft To the left of the weapon icon HUDweaponRight To the right of the weapon icon HUDweaponCenter Centered relative to the weapon icon HUDmagicLeft To the left of the magic icon HUDmagicRight To the right of the magic icon HUDmagicCenter Centered relative to the magic icon HUDcompassLeft To the left of the compass HUDcompassRight To the right of the compass HUDcompassCenter Centered relative to the compass HUDnameCenter Centered relative to the name (of the item currently in the reticle) 0-100 An absolute position relative to the screen. 0 is left, 50 centered and 100 right. Fractions can be used.
I am trying to get all these values that I can attribute to the hud_x function and collapse them under the function entry on the read_me. I’m trying to do it because tnoHSD.hud_x is just ONE function from about 25. Going up and down on the file for everything is frustrating and irritating.
-
@TheBronn Are you allowed to have comments in the files? If the file format allows for something like
$ a comment HUDdefault, HUDprevBar or no value: Same x pos as previous bar (or standard bars for first bar) ...
then the Python language would make the
HUDx
sections collapsible. Python uses # as it’s comment and so if your file format uses # then you may need to create what’s known as a user defined language that would be more or less exactly like Python except that#
is not a comment lead-in.If comments are allowed then I’d do it as
$ comment that explains what this section is about $ lead-in to a section - the lead-in and the section will disappear when you collapse it leaving just the line that's before this. HUDdefault, HUDprevBar or no value: Same x pos as previous bar (or standard bars for first bar) ...
The comments would give your text file the structure that Notepad++ can be configured to then collapse, color code, etc.
The red text such as
this
comes from using a single backtick ` before and after the text. It helps in making things stand out and often is text you would enter or type. The Formatting Forum Posts article has more about this. -
@mkupper said in How to collapse/hide lines? (not alt+h method):
The comments would give your text file the structure that Notepad++ can be configured to then collapse, color code, etc.
I’ll try using this one as well and see which option I end up liking more.
Thanks for everyone of this great community for all the help! You guys are awesome!