Skip to content

Instantly share code, notes, and snippets.

@kljensen
Last active February 16, 2025 20:45
Show Gist options
  • Save kljensen/63ff85a7ebaf3f5573477fb333172bcc to your computer and use it in GitHub Desktop.
Save kljensen/63ff85a7ebaf3f5573477fb333172bcc to your computer and use it in GitHub Desktop.
My glamorous .psqlrc

I use psql a lot when interacting with Postgres databases. I recently took the time to glam up my ~/.pgsqlrc and the results are pretty πŸ”₯πŸ”₯πŸ”₯.



Obviously, I have the nord theme there. Anyhoo, hope you, reader, might find this useful in your own quest for terminal bliss.

\set QUIET on
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set PROMPT1 '%[%033[1;37m%] %[%033[1;36m%]%n%[%033[0m%]@%[%033[1;32m%]%/%[%033[0m%] %[%033[1;35m%]❯ %[%033[0m%]'
\set PROMPT2 '%[%033[1;35m%]β†ͺ %[%033[0m%]'
\encoding unicode
\pset linestyle unicode
\pset border 2
\pset null βˆ…
\x auto
\set HISTFILE ~/.psql_history/psql_history- :HOST - :DBNAME
\pset pager always
\set QUIET off
\echo ''
\echo '\033[1;34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m'
\echo '\033[1;37m\033[0m \033[1;32m Database: \033[0m\033[1;36m' :DBNAME '\033[0m'
\echo '\033[1;37m\033[0m \033[1;32m User:     \033[0m\033[1;33m' :USER '\033[0m'
\echo '\033[1;37m\033[0m \033[1;32m Host:     \033[0m\033[1;35m' :HOST '\033[0m'
\echo '\033[1;37mο€™\033[0m \033[1;32m Port:     \033[0m\033[1;31m' :PORT '\033[0m'
\echo '\033[1;34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m'
\echo ''
@gcallsen
Copy link

πŸ”₯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment