diff --git a/.bashrc b/.bashrc index 93cdd9c..389565e 100644 --- a/.bashrc +++ b/.bashrc @@ -8,11 +8,9 @@ # alias ls='ls --color=auto' PS1='[\u@\h \W]\$ ' -if ! pgrep -u "$USER" ssh-agent > /dev/null; then - ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" -fi -if [[ ! "$SSH_AUTH_SOCK" ]]; then - source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi ### ARCHIVE EXTRATION @@ -74,9 +72,23 @@ alias status='git status' alias rebase='git rebase' alias chechkout='git checkout' -# ssh -alias hindley='ssh hindley.adh.auro.re' -alias proxy_hindley='ssh -D 8080 hindley.adh.auro.re' +export EDITOR='vim' alias config='/usr/bin/git --git-dir=/home/me/.cfg/ --work-tree=/home/me' . "$HOME/.cargo/env" + +# Pyenv +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" + +alias cookiecutter='/home/me/bin/cookiecutter_venv/bin/cookiecutter' + +source "$HOME/sources/bash_prompt" + +export PATH="$HOME/bin:$PATH" + +alias tmp='cd `mktemp -d`' +alias tvenv='TMP_ENV="$(mktemp -d)" && python -m venv "$TMP_ENV" && source "$TMP_ENV/bin/activate"' +alias scrap='wget -c -e robots=off -E -p -r -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" -np --convert-links --no-clobber --random-wait' +alias pysrv='python -m http.server -b 127.0.0.1 -d ' diff --git a/sources/bash_prompt b/sources/bash_prompt new file mode 100644 index 0000000..f036cc7 --- /dev/null +++ b/sources/bash_prompt @@ -0,0 +1,24 @@ +parse_git_branch() { + if [ $(git status --porcelain 2> /dev/null | wc -l) != "0" ]; then + color=$'\001\e[31m\002' + elif [ $(git rev-list HEAD@{upstream}..HEAD 2> /dev/null | wc -l) != "0" ]; then + color=$'\001\e[33m\002' + else + color=$'\001\e[32m\002' + fi + reset=$'\001\e[0m\002' + git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(${color}\1${reset}) /" +} + +green=$(tput setaf 2) +reset=$(tput sgr0) +export PROMPT_DIRTRIM=2 # Trimming path to 2 directories +export PROMPT_PATH="[\[$green\]\w\[$reset\]] " +alias fullpath='export PROMPT_DIRTRIM=0; export PROMPT_PATH="[\[$green\]\w\[$reset\]] "; re_export_ps1' +alias partialpath='export PROMPT_DIRTRIM=2; export PROMPT_PATH="[\[$green\]\w\[$reset\]] "; re_export_ps1' +alias lastpath='export PROMPT_PATH="[\[$green\]\W\[$reset\]] "; re_export_ps1' +alias nopath='export PROMPT_PATH=; re_export_ps1' +re_export_ps1() { + export PS1="$PROMPT_PATH\$(parse_git_branch)\$ " +} +re_export_ps1