From e7e42b93ef65edc3b5d14ecb0b90c1e13c758c03 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Sat, 30 Aug 2025 11:53:13 +0200 Subject: [PATCH] Add configuration for `psql` --- .config/psql/psqlrc | 48 ++++++++++++++++++++++++++++++++++++++ .config/shell/env | 1 + .local/state/psql/.gitkeep | 0 3 files changed, 49 insertions(+) create mode 100644 .config/psql/psqlrc create mode 100644 .local/state/psql/.gitkeep diff --git a/.config/psql/psqlrc b/.config/psql/psqlrc new file mode 100644 index 0000000..e65bdc3 --- /dev/null +++ b/.config/psql/psqlrc @@ -0,0 +1,48 @@ +-- `psql` executes the commands in this file creating output +-- => This flag hides that and is unset again at the bottom +\set QUIET 1 + + +-- Show verbose error messages +\set VERBOSITY verbose + + +-- Use normal "table" format by default +-- and "expanded table" with lots of columns +\x auto + + +-- By default, `NULL`s show up as empty spaces, +-- which may be confused with empty strings +-- => Show "NULL" instead for clarity +\pset null 'NULL' + + +-- Ignore errors in interactive sessions +-- but not when executing scripts +\set ON_ERROR_ROLLBACK interactive + + +-- Upper case SQL keywords +\set COMP_KEYWORD_CASE upper + + +-- Make VI the default editor +\set EDITOR vi + + +-- Use separate history files per database +-- and keep them in one folder +\set HISTFILE ~/.local/state/psql/history- :DBNAME + + +-- Don't store the same SQL statement repeatedly +\set HISTCONTROL ignoredups + + +-- Make all queries display query times +\timing + + +-- Unset the flag set at the top of this file +\unset QUIET diff --git a/.config/shell/env b/.config/shell/env index f064294..76326ed 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -29,4 +29,5 @@ export VISUAL=$EDITOR # Move common tools' config and cache files into XDG directories export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config" export LESSHISTFILE="$XDG_STATE_HOME/less/history" +export PSQLRC="$XDG_CONFIG_HOME/psql/psqlrc" export VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc" diff --git a/.local/state/psql/.gitkeep b/.local/state/psql/.gitkeep new file mode 100644 index 0000000..e69de29