mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
Start work on a command to clone the current working env into a new kitty window
This commit is contained in:
@@ -354,3 +354,24 @@ _ksi_deferred_init() {
|
||||
# to unfunction themselves when invoked. Unfunctioning is done by calling code.
|
||||
builtin unfunction _ksi_deferred_init
|
||||
}
|
||||
|
||||
clone-in-kitty() {
|
||||
builtin local data="pid=$$,cwd=$(builtin pwd -P | builtin command base64),env=$(builtin command env -0 | builtin command base64)"
|
||||
while :; do
|
||||
case "$1" in
|
||||
"") break;;
|
||||
*) data="$data,a=$(builtin printf "%s" "$1" | builtin command base64)";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
data="${data//[[:space:]]}"
|
||||
builtin local pos=0
|
||||
builtin local chunk_num=0
|
||||
while [ $pos -lt ${#data} ]; do
|
||||
builtin local chunk="${data:$pos:2048}"
|
||||
pos=$(($pos+2048))
|
||||
builtin print -nu "$_ksi_fd" '\eP@kitty-clone|'"${chunk}:"'\e\\'
|
||||
chunk_num=$(($chunk_num+1))
|
||||
done
|
||||
builtin print -nu "$_ksi_fd" '\eP@kitty-clone|\e\\'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user