'How can I repeat the line in notepad++?
How can I repeat the line in notepad++ ?
For example I have the following input:
a 01
a 02
a 03
a 04
And I would like it to become:
a 01
a 01
a 02
a 02
a 03
a 03
a 04
a 04
So every line should be displayed twice.
Solution 1:[1]
If you don't mind the semi-manual process, you can start at the first line and repeat the following key combination until you reach the end of the document (you get very fast at this)
Ctrl + D Down Down
This duplicates the current line, then moves down twice (to the line following the newly duplicated one).
If you have a large document, you can record this once as a macro (see the Macro menu), then use either Ctrl + Shift + P (Playback) repeatedly -- you can just hold those keys down. Or use the Macro option "Run a Macro Multiple Times..."
Solution 2:[2]
Open the search dialog box and write :-
Find:
^.*$
Replace:
$0\n$0
Solution 3:[3]
If you have the mouse cursor on the line you want to repeat, then you can use Ctrl-D
shortcut to duplicate the line. Or you can use the same shortcut selecting multiple lines.
Solution 4:[4]
Highlight the desired code and press Ctrl+D. Don't highlight if you want to duplicate just the current line.
Solution 5:[5]
If you are using windows, I recommend writing an auto-hotkey (AHK) script to do this for you. This way, your special text-manipulation script will work in any IDE, not just notepad++. All you would have to do is copy your text example to the clipboard, and then execute an AHK script that reads data from the clipboard using the %clipboard% variable. Then you can load the clipboard with the results of your script and send a CTRL+V signal.
Solution 6:[6]
To selecting the whole texts of line, you can click on the line three times (mouse triad-click).
To repeat, select line, then press Ctrl + D on keyboard.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | paddy |
Solution 2 | Mike Szyndel |
Solution 3 | AdnanJT |
Solution 4 | barbsan |
Solution 5 | KANJICODER |
Solution 6 |