diff options
| author | José Juan Loeza Sierra <jj@xz6ze.com> | 2025-11-19 12:53:07 -0800 |
|---|---|---|
| committer | José Juan Loeza Sierra <jj@xz6ze.com> | 2025-11-19 12:53:07 -0800 |
| commit | 425ad95a972210b07edba4db43206068aa976ab8 (patch) | |
| tree | b318745d34bdeaf59f463a12cb172bb41418acfa /dot-bashrc | |
| parent | af4a04b8f6172131c0e143b112bc66ef11ec0f18 (diff) | |
add script for reporting directy changes to foot
This is done to that doing ctrl+shift+n will spawn a new instance in the
cwd.
See
https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory
for more info.
Diffstat (limited to 'dot-bashrc')
| -rw-r--r-- | dot-bashrc | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -101,3 +101,21 @@ eval "$(zoxide init bash)" if [ "$CONTAINER_ID" = "dev" ]; then source ~/.bashrc.d/dev.bashrc fi + +# for spawning new terminal in cwd +# see https://codeberg.org/dnkl/foot/wiki#spawning-new-terminal-instances-in-the-current-working-directory +osc7_cwd() { + local strlen=${#PWD} + local encoded="" + local pos c o + for (( pos=0; pos<strlen; pos++ )); do + c=${PWD:$pos:1} + case "$c" in + [-/:_.!\'\(\)~[:alnum:]] ) o="${c}" ;; + * ) printf -v o '%%%02X' "'${c}" ;; + esac + encoded+="${o}" + done + printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}" +} +PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }osc7_cwd |
