← til

Summoning the editor from the console

June 8, 2020
development

I use Pry as my Ruby console and it supports a command that opens up the editor. This is helpful, since it gives me the full power of my editor when interacting with the console, so I don't have to worry about typos in the second or third line of the script I'm writing.

Invoking the editor is as simple as writing:

[1] pry(main)> edit

I've been using this command for writing anything that's longer than one line and it has saved me from many frustrations that would happen because of typos.

I've recently discovered that another console tool I use, psql supports invoking the editor too. I no longer write complicated queries directly in the console, but do it from the comfort of my editor.

The editor can be invoked with:

database=# \e