lib, themes: Preserve users' PROMPT_DIRTRIM

These changes in "themes/{agnoster,roderik,vscode}.sh" and "lib/shopt.sh" will
allow a user to set the PROMPT_DIRTRIM variable in their .bashrc and change the
prompt path length.

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
This commit is contained in:
David Dreggors
2020-06-11 09:31:37 -04:00
committed by Koichi Murase
parent 02df6627ae
commit bea5dc9406
4 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ set -o noclobber
shopt -s checkwinsize
# Automatically trim long paths in the prompt (requires Bash 4.x)
PROMPT_DIRTRIM=2
PROMPT_DIRTRIM=${PROMPT_DIRTRIM:-2}
# Enable history expansion with space
# E.g. typing !!<space> will replace the !! with your last command

View File

@ -135,7 +135,7 @@
# note: requires bash v4+... Mac users - you often have bash3.
# 'brew install bash' will set you free
PROMPT_DIRTRIM=2 # bash4 and above
PROMPT_DIRTRIM=${PROMPT_DIRTRIM:-2} # bash4 and above
######################################################################
## Configurations in Oh My Bash

View File

@ -4,7 +4,7 @@ export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWSTASHSTATE=true
export PROMPT_DIRTRIM=3
export PROMPT_DIRTRIM=${PROMPT_DIRTRIM:-3}
function _omb_theme_PROMPT_COMMAND() {
if [[ ${EUID} == 0 ]] ; then

View File

@ -38,4 +38,4 @@ function _omb_theme_vscode_initialize {
_omb_theme_vscode_initialize
function _omb_theme_PROMPT_COMMAND { true; }
PROMPT_DIRTRIM=4
PROMPT_DIRTRIM=${PROMPT_DIRTRIM:-4}