I have a very large file (~100k lines) and I want to insert a comment every 100 lines, I can write a script to do it, but I wonder if something like this is possible in Sublime (In emacs is pretty straightforward).
To select multiple regions using the keyboard, select a block of text, then press Ctrl+Shift+L to split it into one selection per line. When you're done with using multiple selections, just press Ctrl+K to trim all but the first.
Alternatively you can select lines and go to SELECTION MENU >> SPLIT INTO LINES. Now you can edit multiple lines, move cursors etc. for all selected lines.
How about this regex to find 100 lines at a time
((.*\n){1,100})
and then replace with
\1
// this is a comment
Is that close enough for whatever it is you are trying to achieve?
Edit: This version of the replacement text suggested as better by @Maluchi
\1\n
// this is a comment\n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With