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
7lines of a list, could be used !-
Open the Replace dialog (
Ctrl + H) -
SEARCH
^(.+\R){7}\K -
REPLACE
\r\nOR\n( if you use UNIX files ) -
Select the
Regular expressionsearch mode -
Click on the
Replace Allbutton ( Do NOT use theReplacebutton )
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 aroundoption, it adds a blank line, every block of7non-empty lines from caret location till the very end of file -
If you tick the
Wrap aroundoption, it adds a blank line, every block of7non-empty lines, from beginning of file till the very end of file
Alan, I understand your restriction regarding the
\Kfeature. Luckily, thanks to @Uhf7, it will be possible to use, very soon, in a next release, the\Kfeature with the step by step replacement. Nice, isn’t it ?!BR
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login