Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my prototyping I'm doing much copy&pasting from .js file to .html where the .js file needs wrapped text in a string. So I find myself wasting time "plussing/unplussing" (if that are even real words) my html. It's a pain.

example: I'd like to "copy&paste"


and get


and viceversa if it goes ;)

Now, I'm using IntelliJ IDEA on Ubuntu(linux) as the editor of choice but anything that solves problem would be great. Just some simple tool or something...tnx.

share|improve this question

migrated from Dec 21 '12 at 13:32

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

Consider using coffeescript. It's a language which compiles to javascript. It has a learning curve, but is great for solving such problems:

share|improve this answer
Now I have a reason (for myself) why migrate to CoffeeScript. I did some minor work with it in the past and liked it. I'll go with this approach. Don't know why I didn't thought of this sooner ;) Tnx. – Alan Ristić Dec 22 '12 at 8:51

Here is a quick solution.

  1. Replace all single quote (') with double quotes ("). Ideally it should not break anything but just verify.

  2. Replace all the \n with \n in a regex capable find/replace editor. Eclipse works.

  3. Now you have all the code in single line. Just put single quotes around it and you are ready to transport it to JS

  4. In JS: Do line break where deemed fit by doing ' + '

share|improve this answer

EDIT: IntelliJ has macros. Record yourself doing it once then play it back

a lot of editors nowadays support Column edit or multiple cursors, which would really help in what you want to achieve, but I am not sure if IntelliJ is one of them however.

Have a look at Sublime Text 2, its free to evaluate and offers a wealth of tools

To select a column in Sublime Text 2, just drag using the Middle mouse button. To place multiple cursors, hold Ctrl, while clicking on where you want the cursors to be placed

If you want a more automated approach, you can try writing a simple bash script, but I am no expert on bash scripting, so I cant help you there

share|improve this answer
I know for IntelliJ macros and plugins. Even tried few back in time but nothing that would meed needs. It's just weird that functionality like this doesn't come boxed in product - it seems basic..but ok their choice. – Alan Ristić Dec 22 '12 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .