-1

Is there a simple, small, fast text editor (like Gedit) for Ubuntu that has very good syntax highlighting for PostgreSQL? Don't suggest something you haven't used. I tested Gedit, Atom, and pgAdmin 4 and all of them don't have decent or even bad highlighting.

This is what PostgreSQL syntax highlighting needs to look like.

karel
  • 110,292
  • 102
  • 269
  • 299
  • 1
    You can create your own [custom syntax highlighting options for Gedit](https://askubuntu.com/questions/473114/create-a-custom-syntax-highlight-in-gedit/473135#473135) and [tell Gedit to use them](https://askubuntu.com/q/916083). – TRiG Nov 14 '18 at 13:27
  • 1
    Properly done this will take weeks. This is not an option. Also, this is really boring stuff... –  Nov 14 '18 at 16:13

2 Answers2

0

For web development generally and for PostgreSQL syntax highlighting in particular I recommend Sublime text editor over its two biggest competitors, Atom text editor and VSCode. To install the native Sublime text editor snap package (currently version 3.1.1) in all currently supported versions of Ubuntu open the terminal and type:

sudo snap install sublime-text --classic  

After Sublime text editor is installed it can be opened from the Dash by clicking on the Sublime icon or from the terminal with subl . The Sublime text editor snap package will be updated automatically when updates are available.

The PostgreSQL syntax highlighting in Sublime text editor is smarter and much easier to read than the SQL syntax highlighting in Atom text editor. Install the PostgreSQL Syntax Highlighting plugin in Sublime text editor as follows:

  1. Select Tools -> Install Package Control to install Package Control.

  2. Select Tools -> Command Palette.

  3. In the Command Palette select the Package Control: Install Package option. This changes the Command Palette to show a list of installable packages. Find and click to install PostgreSQL Syntax Highlighting plugin which is marked by the mouse cursor in the below screenshot.

    enter image description here
    (Click image to enlarge)

  4. Restart Sublime Text editor.

  5. 1337 Color Scheme looks more like what you want PostgreSQL syntax highlighting to look like than the default Monokai color scheme. In the Command Palette select the Package Control: Install Package option and install the 1337 Color Scheme package. Select the 1337 Color Scheme in Preferences -> Color Scheme instead of the default Monokai color scheme for PostgreSQL. This changes the color scheme for the file that you are working on without changing the default Monokai color scheme for all other files.

  6. To select SQL syntax highlighting in Sublime text editor select View -> Syntax -> SQL (PostgreSQL).

    enter image description here
    (Click image to enlarge)

    enter image description here This is what it needs to look like.

karel
  • 110,292
  • 102
  • 269
  • 299
0

If you are already using VS Code (see more here in this case) or you can install VS Code, then you can proceed as follows:

  • Press CTRL+SHIFT+X or click on "Extensions" icon by your left and search for Postgres as shown in the image below.

    VS Code - PostgreSQL Extensions

  • Select a desired Extension from the suggested list and install. You can go through its brief documentation if need be.

  • Reload and you can start using your extension in VS Code.
muru
  • 193,181
  • 53
  • 473
  • 722
ThunderBird
  • 1,915
  • 13
  • 19
  • 31