Make an new empty line ever 7th line
-
I’ve got a long list of dates, one on each line.
now I want to add an empty line every 7th line (to add an empty line when I new week begins)I’ve tried to create a macro by recording, but it’s not working, neither does the npp manual site.
any other ways to add a new line every 7th line?
-
-
@Alan-Kilborn Yeah, I pressed reload on my phone by mistake, wasn’t suppose to post it twice…
I’ve corrected it.
-
Hello, @adam-larsson and All,
A general regex S/R, to add a blank line, every
7
lines of a list, could be used !-
Open the Replace dialog (
Ctrl + H
) -
SEARCH
^(.+\R){7}\K
-
REPLACE
\r\n
OR\n
( if you use UNIX files ) -
Select the
Regular expression
search mode -
Click on the
Replace All
button ( Do NOT use theReplace
button )
Et voilà !
Best Regards,
guy038
-
-
@guy038 said in Make an new empty line ever 7th line:
^(.+\R){7}\K
It’s this every 7th line from the beginning of the document or current cursor position?
-
@Adam-Larsson said in Make an new empty line ever 7th line:
It’s this every 7th line from the beginning of the document or current cursor position?
Current caret position.
Tick Wrap around for beginning-of-doc origination. -
Because the use of
\K
(usually) eliminates the possibility to do single, step-by-step replaces, wouldn’t it be better to specify such regexes without using\K
, especially for newbies, that probably like the confidence of a single-step replace?Maybe not totally applicable in this case, though.
But, I would write it without the
\K
. -
@Alan-Kilborn Works Perfectly, thx a lot!
just pressed replace all… -
Hi, @adam-larsson, @alan-kilborn, and All,
-
If you do not tick the
Wrap around
option, it adds a blank line, every block of7
non-empty lines from caret location till the very end of file -
If you tick the
Wrap around
option, it adds a blank line, every block of7
non-empty lines, from beginning of file till the very end of file
Alan, I understand your restriction regarding the
\K
feature. Luckily, thanks to @Uhf7, it will be possible to use, very soon, in a next release, the\K
feature with the step by step replacement. Nice, isn’t it ?!BR
guy038
-