From 580682ff01096b3d40ba73a8d4dbf12c10993d39 Mon Sep 17 00:00:00 2001 From: benj Date: Wed, 16 Jun 2021 17:54:38 -0700 Subject: quite a few changes...many specific to an ad2 setup (to be weeded out) --- .bashrc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to '.bashrc') diff --git a/.bashrc b/.bashrc index 9200aba..34c62cb 100644 --- a/.bashrc +++ b/.bashrc @@ -5,26 +5,33 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return -# History size -HISTSIZE=1000000 +export HISTSIZE=-1 # generic setup function parse_git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } +function show_opam_switch () { + current_switch="$(opam switch show)" + if [ ! -z "$current_switch" ] && [ "$current_switch" != "default" ]; then + echo $(echo $current_switch | rev | cut -d'/' -f1 | rev) "← " + fi +} + # mkdir and follow into dir function mkdirf () { mkdir -p $1 && cd $1 } # Customize prompt -if [ -n "$SSH_CLIENT" ]; then ssh_text="ssh" +if [ -n "$SSH_CLIENT" ]; then + ssh_text="ssh" fi if [ -z $STY ]; then - export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[36;1m\]#$ssh_text\[\033[32m\]:\[\033[33;1m\]\W\[\033[m\]\[\033[34;1m\]\$(parse_git_branch)\[\033[m\]$ " + export PS1="\[\033[0;34m\]\$(show_opam_switch)\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[36;1m\]#$ssh_text\[\033[32m\]:\[\033[33;1m\]\W\[\033[m\]\[\033[34;1m\]\$(parse_git_branch)\[\033[m\]$ " else - export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]$STY\[\033[36;1m\]#$ssh_text\[\033[32m\]:\[\033[33;1m\]\W\[\033[m\]\[\033[34;1m\]\$(parse_git_branch)\[\033[m\]$ " + export PS1="\[\033[0;34m\]\$(show_opam_switch)\[\033[36m\]\u\[\033[m\]@\[\033[32m\]$STY\[\033[36;1m\]#$ssh_text\[\033[32m\]:\[\033[33;1m\]\W\[\033[m\]\[\033[34;1m\]\$(parse_git_branch)\[\033[m\]$ " fi # Alias @@ -95,10 +102,10 @@ if [ -f "/etc/arch-release" ]; then fi source ~/.setup/.git-completion.bash -#source /usr/local/arcanist/resources/shell/bash-completion source ~/.setup/.bashrc.local +complete -cf sudo complete -C /usr/bin/vault vault complete -C /usr/bin/aws_completer aws complete -C /usr/bin/terraform terraform -alias please='python ~/workspace/imagine/infrastructure/scripts/please/please.py' +complete -C /usr/bin/packer packer -- cgit v1.2.3