diff options
| author | Alex Leferry 2 <alexherbo2@gmail.com> | 2020-06-21 00:01:24 +0200 |
|---|---|---|
| committer | Alex Leferry 2 <alexherbo2@gmail.com> | 2020-06-21 00:01:24 +0200 |
| commit | 15a8119fe2ba2f61c1bda8a02018d7cce9b036b4 (patch) | |
| tree | 28f60ac1b1391f5d29cbbefb1fa4fa7d5419ae89 /bin | |
| parent | 4773af381ef5b6fc9ffdc99d13700b274535a428 (diff) | |
kak-connect: Add attach command
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/kak-connect | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/kak-connect b/bin/kak-connect index d5a4678..0dc6232 100755 --- a/bin/kak-connect +++ b/bin/kak-connect @@ -2,9 +2,18 @@ # Environment variables XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share} +CONNECT_SCRIPT_PATH=$XDG_DATA_HOME/kak/connect/script.sh + +attach() { + mv "$CONNECT_SCRIPT_PATH" "$CONNECT_SCRIPT_PATH~" + sh "$CONNECT_SCRIPT_PATH~" + rm -f "$CONNECT_SCRIPT_PATH~" +} if test -n "$KAKOUNE_SESSION" -o -n "$KAKOUNE_CLIENT"; then edit "$@" +elif test -t 1 -a -e "$CONNECT_SCRIPT_PATH"; then + attach elif test -t 1; then kak_session=$$ # Start a connected shell or edit files. @@ -39,11 +48,8 @@ EOF " # Attach the connect terminal command. # Act as a “boot loader”. - script_path=$XDG_DATA_HOME/kak/connect/script.sh - if test -e "$script_path"; then - mv "$script_path" "$script_path~" - sh "$script_path~" - rm -f "$script_path~" + if test -e "$CONNECT_SCRIPT_PATH"; then + attach fi else file=$1 line=$2 column=$3 |
