How can I hide the horizontal lines that appear when I fold a block?
Hi. I have a very indented file with lots of folding. For each folded block, a horizontal black line appears delimiting that block, making the entire editing area full of lines, which is distracting. Is there a way to hide these lines? I looked around settings and could not find that. Thanks.
The folding lines are created and managed by Scintilla, the underlying edit component which is used by Notepad++. To turn off the folding lines you have to send a message to the Scintilla component because Notepad++ provides no ability to configure this detail.
To send messages to Scintilla (or even to Notepad++) you need a scripting plugin. I personally use the NppExec plugin. With this plugin you can write and save scripts and create an entry in the Macro menu for them. This menu entries can be assigned to a keyboard shortcut via Shortcut Mapper.
Here is the syntax to send a message with the NppExec plugin to turn off folding lines:
sci_sendmsg SCI_SETFOLDFLAGS 0
This is the syntax to turn them on again:
sci_sendmsg SCI_SETFOLDFLAGS 16
The Scintilla documentation can be found here
I have some passing familiarity with the NppExec plugin (the Pythonscript plugin serves me better for what I want/need to do…) but as I read this I was thinking that the OP would want to make this change one time only (and then forget about it). That led me to wonder if NppExec is capable of running its little scripts on startup of Notepad++ (or more accurately, startup of NppExec itself).
Yes, the NppExec plugin is able to start a script on startup of Notepad++.
NppExec plugin is able to start a script on startup
Ha. Well, I was hopeful you’d elaborate more on how to do that, not really for me (I could look it up) but more for the OP (maybe a real noob?) and future thread readers! :-)
(Of course, the OP could also “look it up”)
The NPP Exec documentation says you can add a script name to the options section of its INI file (plugins\Config\NppExec.ini) like this:
[Options] ScriptNppStart="<some existing script>"
Here’s a part of the documentation from file plugins\doc\NppExec_TechInfo.txt:
ScriptNppStart -------------- You can specify here a name of existing script which you want to be executed each time when Notepad++ starts. For example, this script can contain declarations of your own variables (using SET command), some welcome messages (using ECHO command) or whatever command(s) you want. Note: if you specify an empty value or non-existent script name for this option, no script will be executed when Notepad++ starts. See also: ScriptNppExit.
I was hopeful you’d elaborate more on how to do that
No problem, if the OP decides to accept my suggestion. If he prefers the Pythonscript plugin, the LUAscript plugin, the AutomationScripts/NppScripts plugin (C#, by Oleg Shilo) or … (maybe there are more) I can not help him.
Of course, the OP could also “look it up”
That’s what I had in mind too, but if he runs in trouble I’m willing to help. The steps to install and properly configure the NppExec plugin take a long list. If it is not neccessary to type all that stuff I’m happy.
The NPP Exec documentation says you can add a script name to the options section of its INI file
All neccessary stuff can be configured via the plugin’s GUI (
Plugins (menu) -> NppExec -> Execute...and
Plugins (menu) -> NppExec -> Advanced Options...), no need to fiddle around with INI files.
Yes, much easier to use the advanced options UI to do the editing of the .INI file! I don’t know if I ever looked at that menu entry before. Thanks for pointing it out!
Thank you all for your help.
I was able to install NppExec and run the command to turn the lines off, and it worked.
I tried configuring NppExec to run a script at Notepad++ startup, but I was unable to do it on the “Advanced Options” menu that dinkumoil suggested. While I see the option to select a script for startup, it requires the script to be selected from a pull-down menu that is however empty. I could not find a way to add scripts to it. I tried finding instructions for that in the NppExec documention but I was unable to find them.
I also tried adding the script via NppExec.INI file but that did not work either. I assumed <some existing script>
ScriptNppStart=“<some existing script>”
to stand for a full path name of the file containing the instructions, but perhaps this assumption is incorrect.
Yes, NppExec is somewhat complicated in this point.
(menu) Plugins -> NppExec -> Execute....
- Type your command into the code box (e.g.
sci_sendmsg SCI_SETFOLDFLAGS 0).
- Click on
- Type a name for your command into the combobox (e.g.
- If you want to have a script to turn folding lines on again repeat steps 2 to 5 with the command
sci_sendmsg SCI_SETFOLDFLAGS 16and give it the name
Now you can select these scripts in the combobox under
(menu) Plugins -> NppExec -> Advanced Options... -> (group box) Advanced options.
If you want to create menu entries in the
Macromenu which you can assign to keyboard shortcuts use the UI in the
Menu itemsgroup box. Type a name in
Item nameinput field and select a script in the
Associated scriptcombobox. After a restart of Notepad++ go to
(menu) Settings -> Shortcut Mapper -> (tab) Plugin commandsand assign the shortcuts you want.
Very good, thank you, now things work as I wanted. :-)