diff --git a/.bashrc b/.bashrc index b06566b..83237f5 100644 --- a/.bashrc +++ b/.bashrc @@ -1,12 +1,37 @@ -. ~/.profile +source ~/.profile +# ------------------------------------------------------------------------------ +# History config export HISTSIZE=10000 export HISTFILESIZE=10000 shopt -s histappend # Append to history file instead of overwriting shopt -s cmdhist # Write a multi line command in a single line PROMPT_COMMAND="history -a;$PROMPT_COMMAND" # Save history on every command +# ------------------------------------------------------------------------------ +# Aliases alias gitdf='git --git-dir=$HOME/.config/dotfiles/ --work-tree=$HOME' alias ssh='TERM=xterm-256color ssh' alias e="$EDITOR" alias r="trash -r" + +# ------------------------------------------------------------------------------ +# Notify terminal of current working directory +# https://codeberg.org/dnkl/foot/wiki#user-content-bash-and-zsh +_urlencode() { + local length="${#1}" + for (( i = 0; i < length; i++ )); do + local c="${1:$i:1}" + case $c in + %) printf '%%%02X' "'$c" ;; + *) printf "%s" "$c" ;; + esac + done +} + +osc7_cwd() { + printf '\e]7;file://%s%s\e\\' "$HOSTNAME" "$(_urlencode "$PWD")" +} + +PROMPT_COMMAND="osc7_cwd;$PROMPT_COMMAND" +