~mehdix/dotfiles

fff7d4005078e26c93d64bf1cf1f63440a21fd0e — Mehdi Sadeghi 6 months ago 45a6e76 master
Fix prompt (extra -e in output)

Moreover, remove debug prints (breaks SSH)
4 files changed, 10 insertions(+), 14 deletions(-)

M .bashrc
M .env
M .local/bin/prompt
M .profile
M .bashrc => .bashrc +4 -4
@@ 1,5 1,4 @@
# .bashrc
echo .bashrc begin

# Make a history backup since history is lost sometimes
BACKUPS=~/Backups/$(date +%Y)/bash_hist/


@@ 9,7 8,10 @@ cp ~/.bash_history $BACKUPS/$(date +%s)
# Load ENV file (shared with POSIX shell)
[ $0 != sh ] && [ -n "${ENV:=$HOME/.env}" ] && . "$ENV"

PS1='\[\033[1;33m\]$($HOME/.local/bin/prompt)\[\033[0m\]'
COLOR="\[$(tput setaf 3)\]" # yellow
RESET="\[$(tput sgr0)\]"

PS1='\[$(tput setaf 3)\]$($HOME/.local/bin/prompt)\[$(tput sgr0)\]'

# Warn if .bash_profile exists (since it will prevent loading .profile)
[[ -f ~/.bash_profile ]] && echo WARN: .bash_profile exists


@@ 51,5 53,3 @@ _direnv_hook() {
if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then
  PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
fi

echo .bashrc end

M .env => .env +0 -3
@@ 1,6 1,4 @@
# .env
echo .env begin

PS1='$(prompt)'

# sh history config


@@ 67,4 65,3 @@ gpg-connect-agent updatestartuptty /bye >/dev/null
# Null keyring for python - avoids problems with wallets
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

echo .env end

M .local/bin/prompt => .local/bin/prompt +2 -2
@@ 4,6 4,6 @@ BRANCH=$(test -n "$BRANCH" && echo "($BRANCH)")
HIST_COUNT=$(grep -v '^#' ~/.bash_history | wc -l)
PROMPT="$USER@$(cat /proc/sys/kernel/hostname)[$HIST_COUNT]:$( test "$PWD" = $HOME && echo '~' || echo "$PWD")$BRANCH"
case $(id -u) in
0) echo -e "$PROMPT\\n# " ;;
*) echo -e "$PROMPT\\n$ " ;;
0) printf "$PROMPT\\n# " ;;
*) printf "$PROMPT\\n$ " ;;
esac

M .profile => .profile +4 -5
@@ 1,10 1,11 @@
# .profile
echo .profile begin
source /etc/profile

export TERM=xterm-256color
export ENV=~/.env
export LANG=en_US.UTF-8
export LANG=en_GB.UTF-8
export LANGUAGE=en
export LC_ALL=en_US.UTF-8
export LC_ALL=en_GB.UTF-8
export EDITOR=vim

# Try wayland for GTK apps first, allow x11 fallback


@@ 28,5 29,3 @@ HOSTNAME=$(cat /proc/sys/kernel/hostname)

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

echo .profile end