mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-03 22:25:57 +00:00
Start work on a command to clone the current working env into a new kitty window
This commit is contained in:
parent
7788f48dd5
commit
c19e69855a
4 changed files with 97 additions and 4 deletions
|
|
@ -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\\'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue