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.

How do I cut and paste a column of text in Sublime text 3 -

For example:

File A

Alpha
Beta
Gamma
Delta

File B

AAA
BB
CCCCC

I want to end up with file B having

Alpha AAA
Beta  BB
Gamma CCCCC
Delta
share|improve this question

2 Answers 2

up vote 0 down vote accepted

First, select the lines in File B that you want copied. Note the number of lines (this should be displayed on the bottom of your screen). That number of lines is X. Copy those lines.

Second, select the first X lines of File A so that there is a cursor at the end. To do this, move your cursor to the end of the first line, go up to the selection menu, and use the shortcut for "Add Next Line" until X lines are selected. On OSX, its control-shift-down. In this example, there will be 3 cursors at the end of File A that look like this:

Alpha|
Beta|
Gamma|
Delta

Finally, press tab once, then paste your lines. You should have the results you want.

Because of the way this is done, its easier to paste into File A. However, if you really want to paste into file B or some other file, just copy the lines in File A into the target file before you start, and do the same process.

share|improve this answer
    
I'm accepting your answer as it answers my question as stated. Unfortunately I was really after something a bit more like the column insert available in other editors like Notepadd++ or Visual Studio but it looks like there is no simple way to do this in Sublime. I don't think your solution would work if I wanted to insert the column into the middle of line rather than at the end. Also I got some odd results on windows when I tried extending the line selection down through a ragged set of lines. I didn't have time to investigate this further for now. –  Mike Jan 17 at 11:13

Select and copy the lines on File B you want to copy. Move to File A, select the lines you wish to copy into. Press Ctrl+Shift+L to split your selection into a multiple line selection, move the cursors to wherever you want and paste.

The one limitation of this is that the cursors will keep their relative positions, you may not want this. Perhaps you want them all to remain in a fixed column.

Hold down the middle mouse button and drag to select one or many columns of text, again press Ctrl+Shift+L to split your selection into lines and proceed as before.

share|improve this answer

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.