mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-10-02 16:03:47 +02:00
fix(tmux): sanitize tds session names (#14109)
This commit is contained in:
1 parent
e7852049a5
commit
157eb033f2
1 file changed
+5
@@ -178,6 +178,11 @@ alias tmux=_zsh_tmux_plugin_run
|
|||||||
function _tmux_directory_session() {
|
function _tmux_directory_session() {
|
||||||
# current directory without leading path
|
# current directory without leading path
|
||||||
local dir=${PWD##*/}
|
local dir=${PWD##*/}
|
||||||
|
# tmux target syntax treats '.' and ':' as separators, a leading '$', '@' or '%'
|
||||||
|
# as an id and a leading '=' as an exact-match prefix, so a session named after
|
||||||
|
# such a directory can't be found on reattach
|
||||||
|
dir=${dir//[.:]/_}
|
||||||
|
dir=${dir/#[\$@%=]/_}
|
||||||
# md5 hash for the full working directory path
|
# md5 hash for the full working directory path
|
||||||
local md5=$(printf '%s' "$PWD" | md5sum | cut -d ' ' -f 1)
|
local md5=$(printf '%s' "$PWD" | md5sum | cut -d ' ' -f 1)
|
||||||
# human friendly unique session name for this directory
|
# human friendly unique session name for this directory
|
||||||
|
|||||||
Reference in new issue
Block a user