HOW-TO: Surround text with quote in IntelliJ

A quick tip on how to surround a selection with quote or brace in IntelliJ.

If you wish to be able to easily surround a selected text with quote or brace you have 2 options I know about. You can create a Live Template in surround group and then call it with either Ctrl+Alt+t or Ctrl+Alt+j or you can configure Smart Keys properly to achieve it.

You can find this option in IDE Settings > Editor > Smart Keys > Surround selection on typing quote or brace. When this option is selected and you type quote (single or double) or brace (curly, square, parentheses , angle) whilst the text is selected, it will be automatically surrounded with either quote or brace. Pretty handy.



  1. Thanks ! That was the thing i was looking for ! ;)

  2. Is it possible to add to the list of characters that trigger this behavior? Now, typing e.g. '*' with some text selected simply overwrites it even with this option checked...


  3. This was mostly helpful, but slightly different on a Mac.

    FWIW with IntelliJ IDEA 2016 on Mac OSX, you configure Smart Keys thusly:

    Menu bar:
    IntelliJ IDEA
    › Preferences...
    › Editor
    › General
    › Smart Keys:
    Check: "Surround selection on typing quote or brace".

  4. very nice!! thanks Gerald for the mac option

  5. very nice!! thanks Gerald for the mac option

  6. nice, that is exactly what i want

  7. thanks , that is exactly what i want !!

  8. Code Leaked! That worked. Thanks for saving my life!

  9. works excelent !! select and press quote :D


Post a Comment

Popular posts from this blog

Different ways of validating @RequestBody in Spring MVC with @Valid annotation

Asynchrouns and Transactional Event Listeners in Spring