Wrapping selected text with quotes or with a tag

已回答

Hi, is there a way, similar to TextMate, where if I select some text I can then wrap it in quotes or some other tag on either side of the selected string?

Thanks

3

Try Code|Surround With... action

0
Avatar
Permanently deleted user

I did... nothing happens, what do I do after that? Or what is the procedure for using it properly?

0
Avatar
Permanently deleted user

submited a feature request today... please vote:

http://youtrack.jetbrains.net/issue/WI-1829?query=by:+me

0

2010-05-05_2034.png
"nothing happens"? you don't get this popup?

0
Avatar
Permanently deleted user

Not in .css files to be more precise... I did test it in php files and i saw the popup.

0

Okay, we'll discuss the matter internally and will post updates directly to the issue http://youtrack.jetbrains.net/issue/WI-1829

0
Avatar
Permanently deleted user

For google's search sake.

The option is in:

Preferences> Editor > General > Smart Keys: Surround selection on typing quote or brace.

 

 

17

For google's search sake. <- how do you think we got here?

5

@Jasson works with quotes and brackets, but cannot wrap with tags.

 

0

@Erika

Screenshot from Alexey Gopachenko's post shows what can be used for tags. It even has Emmet there (e.g. so you can surround multiple lines into <li> tag each).

Quote (double or single), braces -- they are all single symbols. But tag requires at least 3 symbols to type so such "surround" that Jasson have mentioned cannot be applied here.

1

Hi,

Is it possible to wrap with a dynamic live template? For example assume I have three lines of texts as:

text1

text2

text3

I want to wrap them with something like System.out.println(" ");. 

System.out.println("text1");

System.out.println("text2");

System.out.println("text3");

But this can change next time as list.add("");

list.add("text1");

list.add("text2");

list.add("text3");

So I want to have a popup to ask me what I want to to wrap it with and I'll be able to enter System.out.println("<text to wrap>");

I can do this by vertical typing but would be quicker if I had a template for that.

Thanks!

0

No, that's unfortunately not supported

1

You may use Multiple Carets for this. Not the same, but does the job in most cases.

2

Thanks @Andriy that looks like a useful one!

1

请先登录再写评论。