mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
Attempt to create iterm-terminal commands
This commit is contained in:
parent
74d1dc756a
commit
84da1911be
@ -12,12 +12,10 @@ hook global KakBegin .* %sh{
|
||||
fi
|
||||
}
|
||||
|
||||
define-command -hidden -params 1.. iterm-new-split-impl %{
|
||||
define-command -hidden -params 2 iterm-terminal-split-impl %{
|
||||
nop %sh{
|
||||
direction="$1"
|
||||
shift
|
||||
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$*\\\""; fi
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' kak -c '${kak_session}' ${kakoune_params}"
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' sh -c '$2'"
|
||||
osascript \
|
||||
-e "tell application \"iTerm\"" \
|
||||
-e " tell current session of current window" \
|
||||
@ -27,21 +25,27 @@ define-command -hidden -params 1.. iterm-new-split-impl %{
|
||||
}
|
||||
}
|
||||
|
||||
define-command iterm-new-vertical -params .. -command-completion -docstring "Split the current pane into two, top and bottom" %{
|
||||
iterm-new-split-impl 'vertically' %arg{@}
|
||||
define-command iterm-terminal-vertical -params 1 -shell-completion -docstring '
|
||||
iterm-terminal-vertical <program>: create a new terminal as an iterm pane
|
||||
The current pane is split into two, top and bottom
|
||||
The shell program passed as argument will be executed in the new terminal'\
|
||||
%{
|
||||
iterm-terminal-split-impl 'vertically' %arg{1}
|
||||
}
|
||||
define-command iterm-terminal-horizontal -params 1 -shell-completion -docstring '
|
||||
iterm-terminal-horizontal <program>: create a new terminal as an iterm pane
|
||||
The current pane is split into two, left and right
|
||||
The shell program passed as argument will be executed in the new terminal'\
|
||||
%{
|
||||
iterm-terminal-split-impl 'horizontally' %arg{1}
|
||||
}
|
||||
|
||||
define-command iterm-new-horizontal -params .. -command-completion -docstring "Split the current pane into two, left and right" %{
|
||||
iterm-new-split-impl 'horizontally' %arg{@}
|
||||
}
|
||||
|
||||
define-command -params .. -command-completion \
|
||||
-docstring %{iterm-new-tab [<arguments>]: create a new tab
|
||||
All optional arguments are forwarded to the new kak client} \
|
||||
iterm-new-tab %{
|
||||
define-command iterm-terminal-tab -params 1 -shell-completion -docstring '
|
||||
iterm-terminal-tab <program>: create a new terminal as an iterm tab
|
||||
The shell program passed as argument will be executed in the new terminal'\
|
||||
%{
|
||||
nop %sh{
|
||||
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$*\\\""; fi
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' kak -c '${kak_session}' ${kakoune_params}"
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' sh -c '$1'"
|
||||
osascript \
|
||||
-e "tell application \"iTerm\"" \
|
||||
-e " tell current window" \
|
||||
@ -51,13 +55,12 @@ All optional arguments are forwarded to the new kak client} \
|
||||
}
|
||||
}
|
||||
|
||||
define-command -params .. -command-completion \
|
||||
-docstring %{iterm-new-window [<arguments>]: create a new window
|
||||
All optional arguments are forwarded to the new kak client} \
|
||||
iterm-new-window %{
|
||||
define-command iterm-terminal-window -params 1 -shell-completion -docstring '
|
||||
iterm-terminal-window <program>: create a new terminal as an iterm window
|
||||
The shell program passed as argument will be executed in the new terminal'\
|
||||
%{
|
||||
nop %sh{
|
||||
if [ $# -gt 0 ]; then kakoune_params="-e \\\"$*\\\""; fi
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' kak -c '${kak_session}' ${kakoune_params}"
|
||||
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' sh -c '$1'"
|
||||
osascript \
|
||||
-e "tell application \"iTerm\"" \
|
||||
-e " create window with default profile command \"${cmd}\"" \
|
||||
@ -65,10 +68,38 @@ All optional arguments are forwarded to the new kak client} \
|
||||
}
|
||||
}
|
||||
|
||||
define-command -params ..1 -client-completion \
|
||||
-docstring %{iterm-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used} \
|
||||
iterm-focus %{ evaluate-commands %sh{
|
||||
define-command iterm-new-vertical -params .. -command-completion -docstring '
|
||||
iterm-new-vertical <program>: create a new kakoune client as an iterm pane
|
||||
The current pane is split into two, top and bottom
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-vertical "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-horizontal -params .. -command-completion -docstring '
|
||||
iterm-new-horizontal <program>: create a new kakoune client as an iterm pane
|
||||
The current pane is split into two, left and right
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-horizontal "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-tab -params .. -command-completion -docstring '
|
||||
iterm-new-tab <program>: create a new kakoune client as an iterm tab
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-tab "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-window -params .. -command-completion -docstring '
|
||||
iterm-new-window <program>: create a new kakoune client as an iterm window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-window "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command iterm-focus -params ..1 -client-completion -docstring '
|
||||
iterm-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used' \
|
||||
%{
|
||||
evaluate-commands %sh{
|
||||
if [ $# -eq 1 ]; then
|
||||
printf %s\\n "evaluate-commands -client '$1' focus"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user