Keep hidden lines hidden
-
I could get lines hidden by selecting them, right clicking and choosing the option “Hide lines”, but how can I make it permanent?
After I’ve hidden some lines, if I relaunch the same document, those lines are no longer hidden.
I have a long script file which I edit from time to time, and its annoying to use the search function every time to go to a certain line. It would be nice to keep hidden lines hidden, any ideas?
-
As mentioned before, the Hide Lines feature is not the greatest.
But, it seems like it may be possible to script something to save/restore the state of your hidden lines. You mentioned Pythonscript in one of your other posts, so it seems like you have some knowledge of scripting…
-
It was a referral to an already existing script. Am much of an amateur actually. From what you are saying there isn’t any configuration which am overlooking that can do this?
-
-
you could file a feature request, to save hidden line sections within the session.
(the session is where all opened documents are remembered, to reopen the same files after a notepad++ restart)if you would like to file a feature request, please follow our official notepad++ community guide over here: FAQ Desk: Feature Request or Bug Report.
note: there are currently very, very many feature requests open, so it is not sure if it would be implemented, and if it would, it usually takes a long time, unless it is urgent or there are too many requests for that.
-
@Gideon-Addai said:
ould get lines hidden by selecting them, right clicking and choosing the option “Hide lines”, but how can I make it permanent?
After I’ve hidden some lines, if I relaunch the same document, those lines are no longer hidden.
I have a long script file which I edit from time to time, and its annoying to use the search function every time to go to a certain line. It would be nice to keep hidden lines hidden, any ideas?
I’m with you on this one. I would love to see this implemented.
-
This post is deleted! -
I submitted the issue, you could vote it up to support it:
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13986
Also to make them toggable:
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13987 -
@Gideon-Addai said in Keep hidden lines hidden:
I have a long script file which I edit from time to time, and its annoying to use the search function every time to go to a certain line. It would be nice to keep hidden lines hidden, any ideas?
I get around that issue by taking advantage of that Notepad++ already has the
-n
command line option to open a file at a specific line number or to jump to that line if it’s already open. Notepad++ does not have a similar command line option to go to a specific line based on a search of the text in the file I want to open. To get around this I first figure out the line number and then use Notepad++'s-n
command line option when opening the file.Here is a trimmed down batch file script:
set XFILE=c:\path to the text file set "XTAG=The tag or anchor within the text file I want to go to" findstr /n /c:"%XTAG%" "%XFILE%" >"%TEMP%\~nptag1.txt" if errorlevel 1 goto :tag_not_found sed -r -n -e "s~^([0-9]+):.+~set XLINE=\1~p" "%TEMP%\~nptag1.txt" >"%TEMP%\~nptag2.bat" if errorlevel 1 goto :sed_failed set XLINE=1 call "%TEMP%\~nptag2.bat" "%ProgramFiles%\Notepad++\Notepad++.exe" -n%XLINE% "%XFILE%"
The script first uses
findstr
to return a list of lines with their line numbers that matchXTAG
. If desired, I could use findstr’s /r option for the crude regular expressions that findstr supports.The script then uses GNU sed to extract the line number(s) from the findstr results and to convert those into a .bat file line that sets the XLINE variable for each line found. If more than one line matches
XTAG
then there will be more then one line in the temporary batch file meaning we will jump to the last XTAG found. If that bothers you then you can add logic to deal with this.The script then calls the temporary batch file to set the XLINE environment variable.
Last is the line that runs Notepad++ and opens the text file at the desired line number. If you are using a 32-bit installation of Notepad++ on a 64-bit machine then use
%ProgramFiles(x86)%
instead of%ProgramFiles%
in the last line or replace it with the path to your copy of Notepad++ (The full path is in Notepad++'s? / Debug info...
results in thePath:
line.)