(Question mark in title because I'm not sure what to call it.)
Sublime Text has a cool niche feature where you can have multiple selections. Just hit Alt+Shift+Up/Down, and you'll spawn a second cursor in the line above/below your current one. This is useful when you have some code or other data organized into a nice structure, and you want to make the same edits across multiple lines.
What I just discovered today, though, was that multi-select intelligently handles copy/paste, too.
I had a list of urls, and I needed to wrap them in <a>
s so that they both linked to the url and displayed it as their text.
- Kick off a multi-select for all the lines.
- Highlight all of the urls (they were all the same length, luckily)
- Ctrl+C
- Move back to the beginning of the lines and start typing the
<a href="">
part (every line gets this) - Move the cursors to between the
""
in the attribute. - Ctrl+V
- Boggle.
IT JUST MAGICALLY WORKED. Each line pasted the data from its respective line, rather than (as I feared might happen), each pasting in the entire set of urls, or maybe all pasting the first or last url.
Sublime is one of those delightful and rare programs that just does what you want a surprising amount of the time.
The multi-selection stuff is rather standard on Windows. I do not even remember using any editor not featuring it.
However, the multiline-pasting feature is a nice touch. I just tested and Visual Studio pastes all the urls at all the locations. This behavior actually makes sense if you have only one line of text, but in the case the number of lines matches, Sublime's behavior is actually better!
Reply?
the question is how long have you been using ST and if is more thant a year, how you could live all that time without knowing that!
Just joking, its awesome find "sublime" features in this IDE all the time
Reply?
That is a cool feature. I never tried pasting multiple lines.
I knew about the shortcut, I use it for column selection (Alt + Shift + Down a few rows and then keep Shift pressed and hit Right multiple times until you select the column you wanted). In some editors you can do column selection using middle mouse button (don't have sublime close by to confirm) and it's very useful when you want to replace content on multiple lines or if you want to prefix multiple lines.
Reply?
Fixed as of today in Notepad++ :-)
Reply?