ref: 3a122db65db2b610ed73d41695606a12f2c0ceba
parent: f819a117bffc3342a19a4a28f07fa4a529676234
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri May 17 17:02:17 EDT 2024
plumber-vt: simplify a bit
--- a/plumber-vt.md
+++ b/plumber-vt.md
@@ -22,7 +22,7 @@
osc7_cwd() {
local strlen=${#PWD}
local encoded=""
- local pos c o
+ local pos c o p
for (( pos=0; pos<strlen; pos++ )); do
c=${PWD:$pos:1}
case "$c" in
@@ -31,9 +31,11 @@
esac
encoded+="${o}"
done
- printf '\e]7;file://%s%s\e\\' "${HOSTNAME%.lan}" "${encoded}"
+ p=`printf '\e]7;file://%s%s\e\\' "${HOSTNAME%.lan}" "${encoded}"`
if [ -n "$TMUX" ]; then
- printf '\e]7;file://%s%s\e\\' "${HOSTNAME%.lan}" "${encoded}" > `tmux display-message -p '#{client_tty}'`
+ printf "%s" "$p" >`tmux display-message -p '#{client_tty}'`
+ else
+ printf "%s" "$p"
fi
}
export PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc7_cwd