bash: Ordenar y OSC 7

This commit is contained in:
Cat /dev/Nulo 2022-01-14 22:24:15 -03:00
parent 153d5e897b
commit 593089dcfe

27
.bashrc
View file

@ -1,12 +1,37 @@
. ~/.profile source ~/.profile
# ------------------------------------------------------------------------------
# History config
export HISTSIZE=10000 export HISTSIZE=10000
export HISTFILESIZE=10000 export HISTFILESIZE=10000
shopt -s histappend # Append to history file instead of overwriting shopt -s histappend # Append to history file instead of overwriting
shopt -s cmdhist # Write a multi line command in a single line shopt -s cmdhist # Write a multi line command in a single line
PROMPT_COMMAND="history -a;$PROMPT_COMMAND" # Save history on every command PROMPT_COMMAND="history -a;$PROMPT_COMMAND" # Save history on every command
# ------------------------------------------------------------------------------
# Aliases
alias gitdf='git --git-dir=$HOME/.config/dotfiles/ --work-tree=$HOME' alias gitdf='git --git-dir=$HOME/.config/dotfiles/ --work-tree=$HOME'
alias ssh='TERM=xterm-256color ssh' alias ssh='TERM=xterm-256color ssh'
alias e="$EDITOR" alias e="$EDITOR"
alias r="trash -r" 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"