-
Notifications
You must be signed in to change notification settings - Fork 1
/
psqlrc
65 lines (47 loc) · 1.67 KB
/
psqlrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- based on thoughtbot/dotfiles
-- Official docs: http://www.postgresql.org/docs/9.3/static/app-psql.html
-- Unofficial docs: http://robots.thoughtbot.com/improving-the-command-line-postgres-experience
-- Don't display the "helpful" message on startup.
\set QUIET 1
\pset null '[NULL]'
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
-- PROMPT2 is printed when the prompt expects more input, like when you type
-- SELECT * FROM<enter>. %R shows what type of input it expects.
\set PROMPT2 '[more] %R > '
-- Show how long each query takes to execute
\timing
-- Use best available output format
\x auto
\set VERBOSITY verbose
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\unset quiet
-- psql can't check for a file's existence, so we'll provide an empty local
-- file that users can override with their custom dotfiles. To set your own
-- personal settings, place your own file in ~/.psqlrc.local
\i ~/.psqlrc.local
-- disable output temporarily
\set QUIET on
-- nicer rendering for null
\pset null '❌ '
-- nicer tables
\pset linestyle unicode
-- enable timers
\timing
-- disable default pager
\pset pager off
-- automatically switch to \x for large outputs
\x auto
-- nicer prompt
\set PROMPT1 '\npsql %[%033[0;33;32m%]%/%[%033[0m%] on %[%033[0;33;33m%]%M%[%033[0m%] as %[%033[0;33;35m%]%n%[%033[0m%] %[%033[0;33;36m%]%x%[%033[0m%]\n%R> '
\set PROMPT2 '%R> '
-- better errors
\set VERBOSITY verbose
-- keep inputs in the history once
\set HISTCONTROL ignoredups
-- always auto complete in lowercase
\set COMP_KEYWORD_CASE lower
-- output back on
\set QUIET off