Skip to content

Instantly share code, notes, and snippets.

@blackrobot

blackrobot/.bashrc

Created Feb 3, 2020
Embed
What would you like to do?
Simplified remote dotfiles
# shellcheck shell=bash disable=SC2164,SC1117
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
export TERM='xterm-256color'
export LS_OPTIONS='--color=auto'
alias ls='ls $LS_OPTIONS'
alias ll='ls -alhF'
alias l='l -A'
# Expand '**' wildcard
shopt -s globstar
##
# History control
##
# Save 5,000 lines of history in memory
HISTSIZE=10000
# Save 2,000,000 lines of history to disk (will have to grep ~/.bash_history for full listing)
HISTFILESIZE=2000000
# Ignore redundant or space commands
HISTCONTROL=ignoreboth:erasedups
# Ignore more
HISTIGNORE='ls:ll:ls -alh:pwd:clear:history'
# Set time format
HISTTIMEFORMAT='%F %T '
# Multiple commands on one line show up as a single line
shopt -s cmdhist
# Append to history instead of overwrite
shopt -s histappend
# Don't immediately execute search results
shopt -s histverify
# Save multiline commands with \n in tact
shopt -s lithist
##
# /History control
##
if [ -t 1 ]; then
# Colors
# { black=0 | red=1 | green=2 | yellow=3 | white=7 }
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
# red="$(tput setaf 9)"
# yellow="$(tput setaf 11)"
dim="$(tput dim)"
reset="$(tput sgr0)"
function prompt {
PS1=' \[$cyan\]❯\[$reset\] '
printf '%s %s %s\n' \
"${blue}$(whoami)${reset}" \
"${dim}@${reset}" \
"${magenta}${PWD}${reset}"
}
PROMPT_COMMAND='prompt'
fi
# Append new history lines, clear the history list, re-read the history list, print prompt.
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# set -o vi
# set -o emacs
set editing-mode vi
set keymap vi-command
set show-mode-in-prompt on
set show-all-if-ambiguous on
set completion-ignore-case on
set colored-stats on
set expand-tilde off
set menu-complete-display-prefix on
# set keymap vi-insert
# "\C-l": clear-screen
# set echo-control-characters off
set keymap vi-command
Control-l: clear-screen
set keymap vi-insert
Control-l: clear-screen
TAB: menu-complete
# Shift-TAB cycles completions backward
"\e[Z": menu-complete-backward
set vi-ins-mode-string \1\e[1;34m\2\1\e[0m\2
set vi-cmd-mode-string \1\e[1;30m\2\1\e[0m\2
\set QUIET 1
--+--
-- Config options can be found here:
-- https://www.postgresql.org/docs/11/app-psql.html
--+--
\set ON_ERROR_ROLLBACK interactive
\set COMP_KEYWORD_CASE upper
\set HISTFILE ~/.psql/history- :DBNAME
\set HISTCONTROL ignoredups
\pset pager on
\pset null '(null)'
\timing
-- Wide/Tall layout of tables
\x auto
\unset QUIET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.