diff options
| author | Alex Leferry 2 <alexherbo2@gmail.com> | 2017-11-12 09:54:21 +0100 |
|---|---|---|
| committer | Alex Leferry 2 <alexherbo2@gmail.com> | 2017-11-12 10:36:12 +0100 |
| commit | 048ef06649a620f23070fae1eaff5d208ecb35e1 (patch) | |
| tree | 2cc35e56e4307c810bc6bee11c418d3ec8b29391 /bin | |
Initial commit
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/kak-connect | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/kak-connect b/bin/kak-connect new file mode 100755 index 0000000..92d0475 --- /dev/null +++ b/bin/kak-connect @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ $KAK_SESSION ] && [ $KAK_CLIENT ]; then + # Support to target line and column for the first file + # $ kak <file> +<line>:[column] + if test $# -ge 2; then + file=$(realpath $1) + target=$(echo $2 | pcregrep --om-separator ' ' --only-matching={1,2} '^[+]([0-9]+)(?::([0-9]+))?$') + if test -n "$target"; then + command="edit $file $target" + shift + shift + fi + fi + for file in $@; do + command="edit $(realpath $file); $command" + done + echo "eval -client $KAK_CLIENT '$command'" | kak -p $KAK_SESSION +elif [ $KAK_SESSION ]; then + kak -c $KAK_SESSION "$@" +else + kak "$@" +fi |
