diff options
| -rw-r--r-- | .bashrc | 24 | ||||
| -rw-r--r-- | .env | 37 | ||||
| -rwxr-xr-x | .local/bin/prompt | 3 | ||||
| -rw-r--r-- | .profile | 19 |
4 files changed, 61 insertions, 22 deletions
@@ -1,17 +1,21 @@ -echo .bashrc begin # .bashrc +echo .bashrc begin + +# Load ENV file (shared with POSIX shell) [ $0 != sh ] && [ -n "${ENV:=$HOME/.env}" ] && . "$ENV" PS1='\[\033[1;33m\]$($HOME/.local/bin/prompt)\[\033[0m\]' -HISTCONTROL=ignoreboth:erasedups + +# Bash history config +HISTSIZE=65535 +HISTFILE=$HOME/.bash_history +HISTCONTROL=ignoreboth HISTIGNORE="gst" # see man strftime HISTTIMEFORMAT="%F " - # Uncomment this line and remove `histappend' to enable shared history. PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r;" #shopt -s histappend - # Enable recursive search including hidden subs shopt -s globstar dotglob @@ -28,4 +32,16 @@ complete -D -F _completion_loader -o bashdefault -o default [ -f ~/.config/broot/launcher/bash/br ] && . ~/.config/broot/launcher/bash/br [ -f ~/.local/src/z.sh ] && . ~/.local/src/z.sh +# direnv +_direnv_hook() { + local previous_exit_status=$?; + trap -- '' SIGINT; + eval "$("/usr/bin/direnv" export bash)"; + trap - SIGINT; + return $previous_exit_status; +}; +if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then + PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" +fi + echo .bashrc end @@ -1,7 +1,15 @@ -echo .env begin # .env +echo .env begin + PS1='$(prompt)' +# sh history config +HISTSIZE=65535 +HISTFILE=.sh_history + +# Tell Readline to use vi-style keybindings +#set -o vi + if [ -z "${SSH_AGENT_PID}" ]; then if ! [ -e /tmp/ssh-agent-$USER ] then @@ -28,22 +36,31 @@ alias githome='git --git-dir ~/.githome --work-tree ~' alias ls='ls --color -A --group-directories-first --sort=extension' alias recent='ls -ltch' alias gl='git pull' +alias gsl='git stash && git pull && git stash pop' alias gcm='git checkout master' +alias gcd='git checkout develop' alias gco='git checkout' alias gst='git status' alias mbsync="mbsync -c ~/.config/isync/mbsyncrc" +alias rm="rm -i" + +PATH=$HOME/.local/bin:$PATH +HOSTNAME=$(cat /proc/sys/kernel/hostname) +PATH=$HOME/.local/bin/$HOSTNAME:$PATH +PATH=$HOME/.local/bin/`uname -m`:$PATH +PATH=$HOME/.cargo/bin:$PATH +GOPATH="$HOME/.local/share/go" +PATH=$GOPATH/bin:$PATH +export PATH +export LANGUAGE=en +BROWSER=w3m + +# Load nix if available +[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ] \ + && . $HOME/.nix-profile/etc/profile.d/nix.sh # Use correct TTY for GPG Pinentry export GPG_TTY="$(tty)" gpg-connect-agent updatestartuptty /bye >/dev/null -export PATH=$HOME/.local/bin:$PATH -HOSTNAME=$(cat /proc/sys/kernel/hostname) -export PATH=$HOME/.local/bin/$HOSTNAME:$PATH -export PATH=$HOME/.local/bin/`uname -m`:$PATH -export PATH=$HOME/.cargo/bin:$PATH -export GOPATH="$HOME/.local/share/go" -export PATH=$GOPATH/bin:$PATH -export BROWSER=w3m -export LANGUAGE=en echo .env end diff --git a/.local/bin/prompt b/.local/bin/prompt index d4d6592..920a5ef 100755 --- a/.local/bin/prompt +++ b/.local/bin/prompt @@ -1,7 +1,8 @@ #!/bin/sh BRANCH=$(git branch --show-current 2>/dev/null) BRANCH=$(test -n "$BRANCH" && echo "($BRANCH)") -PROMPT="$USER@$(cat /proc/sys/kernel/hostname):$( test "$PWD" = $HOME && echo '~' || echo "$PWD")$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$ " ;; @@ -1,23 +1,28 @@ -echo .profile begin # .profile +echo .profile begin + export ENV=~/.env export LANG=en_US.UTF-8 -export LANGUAGE=en_US:de_DE +export LANGUAGE=en export LC_ALL=en_US.UTF-8 export EDITOR=vim -export HISTSIZE=65535 + +#export GDK_BACKEND=wayland export MAKEFLAGS=-j`lscpu | grep '^CPU(s):' | awk -F' ' '{ print $2 }'` export CFLAGS="-O2 -pipe -march=native" export CXXFLAGS="${CFLAGS}" + # Sway compatiblity https://github.com/swaywm/sway/issues/595 export _JAVA_AWT_WM_NONREPARENTING=1 -#export GDK_BACKEND=wayland HOSTNAME=$(cat /proc/sys/kernel/hostname) [ -e .config/$HOSTNAME.profile ] && . .config/$HOSTNAME.profile -[ $0 != sh ] && [ -n "$BASH_VERSION" ] && shopt login_shell 2>&1 > /dev/null && [ -f ~/.bashrc ] && . ~/.bashrc -echo .profile end +# Load .bashrc in login shells for bash +[ $0 != sh ] && [ -n "$BASH_VERSION" ] \ + && shopt login_shell 2>&1 > /dev/null \ + && [ -f ~/.bashrc ] && . ~/.bashrc \ + && echo "$(date): .bashrc loaded from .profile" >> ~/debug_logs -if [ -e /home/mx/.nix-profile/etc/profile.d/nix.sh ]; then . /home/mx/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer +echo .profile end |
