iterm.kak: use command argument instead of sending text
Instead of starting the default shell and sending it text (hoping it will support POSIX like shell syntax), just use the `env` utility to set the correct environment and exec kakoune.
This commit is contained in:
parent
a732037b53
commit
3ae94d017d
|
@ -18,18 +18,14 @@ define-command -hidden -params 1.. iterm-new-split-impl %{
|
||||||
%sh{
|
%sh{
|
||||||
direction="$1"
|
direction="$1"
|
||||||
shift
|
shift
|
||||||
if [ $# -gt 0 ]; then kakoune_params="-e '$@'"; fi
|
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$@\\\""; fi
|
||||||
sh_cmd="kak -c ${kak_session} ${kakoune_params}"
|
cmd="env -P ${PATH} TMPDIR=${TMPDIR} kak -c ${kak_session} ${kakoune_params}"
|
||||||
osascript \
|
osascript \
|
||||||
-e "tell application \"iTerm\"" \
|
-e "tell application \"iTerm\"" \
|
||||||
-e " tell current session of current window" \
|
-e " tell current session of current window" \
|
||||||
-e " tell (split ${direction} with same profile)" \
|
-e " tell (split ${direction} with same profile command \"${cmd}\") to select" \
|
||||||
-e " select" \
|
-e " end tell" \
|
||||||
-e " write text \"export TMPDIR='${TMPDIR}'\"" \
|
-e "end tell" >/dev/null
|
||||||
-e " write text \"exec ${sh_cmd}\"" \
|
|
||||||
-e " end tell" \
|
|
||||||
-e " end tell" \
|
|
||||||
-e "end tell"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,17 +42,14 @@ define-command -params .. -command-completion \
|
||||||
All optional arguments are forwarded to the new kak client} \
|
All optional arguments are forwarded to the new kak client} \
|
||||||
iterm-new-tab %{
|
iterm-new-tab %{
|
||||||
%sh{
|
%sh{
|
||||||
if [ $# -gt 0 ]; then kakoune_params="-e '$@'"; fi
|
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$@\\\""; fi
|
||||||
sh_cmd="kak -c ${kak_session} ${kakoune_params}"
|
cmd="env -P ${PATH} TMPDIR=${TMPDIR} kak -c ${kak_session} ${kakoune_params}"
|
||||||
osascript \
|
osascript \
|
||||||
-e "tell application \"iTerm\"" \
|
-e "tell application \"iTerm\"" \
|
||||||
-e " tell current window" \
|
-e " tell current window" \
|
||||||
-e " tell current session of (create tab with default profile)" \
|
-e " create tab with default profile command \"${cmd}\"" \
|
||||||
-e " write text \"export TMPDIR='${TMPDIR}'\"" \
|
-e " end tell" \
|
||||||
-e " write text \"exec ${sh_cmd}\"" \
|
-e "end tell" >/dev/null
|
||||||
-e " end tell" \
|
|
||||||
-e " end tell" \
|
|
||||||
-e "end tell"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,16 +58,12 @@ define-command -params .. -command-completion \
|
||||||
All optional arguments are forwarded to the new kak client} \
|
All optional arguments are forwarded to the new kak client} \
|
||||||
iterm-new-window %{
|
iterm-new-window %{
|
||||||
%sh{
|
%sh{
|
||||||
if [ $# -gt 0 ]; then kakoune_params="-e '$@'"; fi
|
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$@\\\""; fi
|
||||||
sh_cmd="kak -c ${kak_session} ${kakoune_params}"
|
cmd="env -P ${PATH} TMPDIR=${TMPDIR} kak -c ${kak_session} ${kakoune_params}"
|
||||||
osascript \
|
osascript \
|
||||||
-e "tell application \"iTerm\"" \
|
-e "tell application \"iTerm\"" \
|
||||||
-e " set-option w to (create window with default profile)" \
|
-e " create window with default profile command \"${cmd}\"" \
|
||||||
-e " tell current session of w" \
|
-e "end tell" >/dev/null
|
||||||
-e " write text \"export TMPDIR='${TMPDIR}'\"" \
|
|
||||||
-e " write text \"exec ${sh_cmd}\"" \
|
|
||||||
-e " end tell" \
|
|
||||||
-e "end tell"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user