0

I would like to add comment line between each block of SQL statements. Is there a easy way to type several -- in DataGrip like this:

------------------------------

In vim, we can type a number followed by i-, in DataGrip, I have to hold down - key for a second.

Nick
  • 8,451
  • 13
  • 57
  • 106

1 Answers1

1

You can do this with Live Templates

Define a new template by navigating to File->settings->Live Templates

Select SQL

click the green + sign on the top left

Add an abbreviation - I use '--'

add your comment string, ie '----------------------' in the 'template text' box

Define the 'application context' as SQL (directly underneath the template text box).

Now, when you are in the SQL editor, just type -- followed by TAB and your '---------------' will appear.

While you're in the Live Templates window, note also the other predefined handy predefined templates for your use.

Full documentation is here

Here's a screenshot of mine (looks slightly different because it's from PyCharm)