From 593089dcfe4914581b4a9d040c21d7f48655de74 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 14 Jan 2022 22:24:15 -0300 Subject: [PATCH] bash: Ordenar y OSC 7 --- .bashrc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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" +