summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAlex Leferry 2 <alexherbo2@gmail.com>2020-06-18 14:24:19 +0200
committerAlex Leferry 2 <alexherbo2@gmail.com>2020-06-18 14:35:14 +0200
commit4ee81766fee8e715560f304a2931d1bdaaf8afb1 (patch)
treec182de2548b211afdcc029c7a97ebb314353a71e /bin
parent796c06debabf2c3c2b3e5447b1712307f97a1864 (diff)
Add a way to connect to the current terminal
Diffstat (limited to 'bin')
-rwxr-xr-xbin/kak-connect19
1 files changed, 17 insertions, 2 deletions
diff --git a/bin/kak-connect b/bin/kak-connect
index 473067b..1a6a7bc 100755
--- a/bin/kak-connect
+++ b/bin/kak-connect
@@ -1,9 +1,24 @@
#!/bin/sh
-if test -n "$KAKOUNE_SESSION" -a -n "$KAKOUNE_CLIENT"; then
+if test -n "$KAKOUNE_SESSION" -o -n "$KAKOUNE_CLIENT"; then
edit "$@"
elif test -t 1; then
- kak "$@"
+ kak_session=$$
+ kak -s "$kak_session" -d
+ kak -c "$kak_session" -e "
+ alias global terminal connect-detach
+ set-option global connect_environment %{
+ KAKOUNE_CLIENT=''
+ }
+ connect-terminal edit $@
+ "
+ # Attach the connect terminal command
+ script_path=$XDG_DATA_HOME/kak/connect/$kak_session/script.sh
+ if test -e "$script_path"; then
+ mv "$script_path" "$script_path~"
+ sh "$script_path~"
+ rm -f "$script_path~"
+ fi
else
file=$1 line=$2 column=$3
kak -ui dummy -e "