Sublime Forum

Copy Paste multiple lines inbetween lines?

#1

One line works
copy:select + ctrl+shift+l + ctrl+c

1

2

3

4

Paste:ctrl+click to select space between text then ctrl+v
1
text

2
text

3
text

4
text

how?Copy Paste multiple lines in between text like this?!

1
1
1
1

2
2
2
2

3
3
3
3

4
4
4
4

paste:

1
1
1
1
text
2
2
2
2
text
3
3
3
3
text
4
4
4
4
text

is this possible?!

2 Likes

#2

 



 
##This solution assumes 2 things:
 

[1]

 
You have this setting in your Preferences.sublime-settings:

"trim_trailing_white_space_on_save": true,

 
OR
 

You have manually removed trailing whitespace with something like Trimmer.
 

 

[2]

 
You have the following key-binding @ your appropriate sublime-keymap file:

	{
		"keys": ["ctrl+shift+alt+g"],
		"command": "expand_selection_to_paragraph"
	},

 
 

Note:

 

Use GIF Speed Changer if you want to slow down the GIF demo.

3 Likes

#3

Also, I saw a cool post on StackOverflow earlier about using capturing groups to reorder text.

I hadn’t worked with capturing groups within RegEx patterns before, so I figured I’d give it a shot as an alternative solution for your post.

 
You can use this pattern to match the text groups in your example:

(\d\n)+?(?!\1)

 

0 Likes

#4

@fico, I’m sorry, what plugin that displays on-screen button, which you press? Thank you.

0 Likes

#5

@Sasha_Chernykh

It’s actually not a plug-in, but rather a screencast key-logger I’m working on.

That version is just a script written in AutoHotkey, but I intend to rewrite it in C# and add some additional features so I can release it for Windows. I don’t have any Mac hardware at the moment, but I’m sure I’ll port it to OSX at some point also.

2 Likes

#6

@fico, when users have to wait when you rewrite a script for Windows :slightly_smiling:?

0 Likes

#7

Honestly, it might be a while. I’m starting to work through this Android curriculum that I just put together, so it will probably be a while before I get back to my Sublime Text & Windows projects. I’m sure I’ll get tired of all Android, all the time though, so maybe I’ll take some breaks in between & try to wrap up some projects.

I’ll definitely post @ #general-discussion when it’s done though, since it’s relevant to plugin authors that create visual demos.

1 Like

#8

@fico, all right. Where can I download version of the script, which is shown on your gif? Thanks.

0 Likes

#9

I won’t post my script, since I plan on monetizing the release ( probably will offer free & pro versions ), but here is the original script that I used as a base:

[Script] KeypressOSD - Display key press on screen

1 Like

#10

hello, very nice !!

it needs to be noted that you need to select the exact number of lines that you are about to paste. if you have copied 4 lines of code and you want to insert it into 5 positions, it will not work.

thank you

0 Likes