Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Say I have the following 2 files open in Notepad++

enter image description here

Is it possible to copy the text on the right and paste it into the left, so that I will end up with

A copy

B this

C text

D over (etc..)

or

copy A

this B

text C

over D

share|improve this question
    
Nice Question.. Thanks. –  Sachin Shekhar Mar 23 '13 at 11:24
add comment

2 Answers 2

up vote 14 down vote accepted

Yes. Do a block copy/paste.

Hold down Alt while selecting the text to copy and copy it. Then hold down Alt while selecting where you want to copy to in the destination file. Don't select any characters--just drag the cursor down so it flashes on multiple rows. Then paste the text.

Vertical/block editing can also be accomplished by holding Alt+Shift along with the arrow keys on your keyboard.


Note: This method can also be used to input text on multiple rows simultaneously. You may also access this via the edit-menu as shown below. Column Mode will simply tell you the keyboard shortcut to use. Column Editor will insert one or more characters (or numbering) starting at the cursor and in all subsequent lines, until you reach the end of the file.

enter image description here

share|improve this answer
    
My god that's brilliant! Thank you! –  Snailer Mar 3 '13 at 18:00
    
@Snailer It is a very handy feature. You're welcome! –  Ben Richards Mar 3 '13 at 18:01
1  
You can also hold Alt + Shift with the arrow keys on your keyboard to perform a vertical selection completely via keyboard. –  Breakthrough Mar 3 '13 at 18:29
add comment

Yes, sort of - use column operations.

  1. In the copy-from file, hold down the Alt key and use the mouse to select a rectangle of text, e.g. the first character of the first four lines. You can go past the end of the line (selecting a block wider than some of the lines)
  2. Copy this (e.g. Ctrl-C)
  3. Flip to your target file
  4. Paste it in (e.g. Ctrl-V) at the start of the first line As you've used a column operation to copy the text, it will insert the same block (without any newlines) into the target file.

Unfortunately it won't handle spaces quite right for your example. You would need to put a space at the end of the copied block on each line. Luckily you can use column operations again.

  1. After pasting the block in, again hold the Alt key, and select a rectangle zero columns wide, to the right of the pasted block. As it's zero-width, notepad++ draws it as a vertical line
  2. Edit > Column Editor (or press Alt-C), and put a space in Text To Insert. This will insert a space on each line, to the right of the pasted block

This won't work if the text you paste in is different lengths on each line, though, because you can't select a single vertical line to insert the spaces to. So I would put a space on the end of each source line before copying - Ctrl-H to open the Replace dialog, click Regular Expression in the bottom right, and replace $ with space.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.