How can I hide the horizontal lines that appear when I fold a block?
-
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
-
Addendum:
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.
-
@Scott-Sumner said:
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.
@Scott-Sumner said:
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.
-
@Jim-Dailey said:
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...
andPlugins (menu) -> NppExec -> Advanced Options...
), no need to fiddle around with INI files. -
@dinkumoil
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>
[Options]
ScriptNppStart=“<some existing script>”
to stand for a full path name of the file containing the instructions, but perhaps this assumption is incorrect.Thank you.
-
Yes, NppExec is somewhat complicated in this point.
- Open
(menu) Plugins -> NppExec -> Execute...
. - Type your command into the code box (e.g.
sci_sendmsg SCI_SETFOLDFLAGS 0
). - Click on
Save...
. - Type a name for your command into the combobox (e.g.
FoldingLinesOff
). - Click
Save
. - 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 16
and give it the nameFoldingLinesOn
.
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
Macro
menu which you can assign to keyboard shortcuts use the UI in theMenu items
group box. Type a name inItem name
input field and select a script in theAssociated script
combobox. After a restart of Notepad++ go to(menu) Settings -> Shortcut Mapper -> (tab) Plugin commands
and assign the shortcuts you want. - Open
-
Very good, thank you, now things work as I wanted. :-)
-