Split modules and allow kitty-send-text to take a parameter
This commit is contained in:
parent
952aa0ed0a
commit
d287251326
|
@ -41,30 +41,8 @@ If no client is passed then the current one is used' \
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command kitty-repl -params .. -shell-completion -docstring '
|
|
||||||
kitty-repl [<arguments>]: create a new window for repl interaction
|
|
||||||
All optional parameters are forwarded to the new window' \
|
|
||||||
%{
|
|
||||||
nop %sh{
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
cmd="${SHELL:-/bin/sh}"
|
|
||||||
else
|
|
||||||
cmd="$*"
|
|
||||||
fi
|
|
||||||
kitty @ new-window --no-response --window-type $kak_opt_kitty_window_type --title kak_repl_window --cwd "$PWD" $cmd < /dev/null > /dev/null 2>&1 &
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
define-command kitty-send-text -docstring "send the selected text to the repl window" %{
|
|
||||||
nop %sh{
|
|
||||||
kitty @ send-text -m=title:kak_repl_window "${kak_selection}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
alias global terminal kitty-terminal
|
alias global terminal kitty-terminal
|
||||||
alias global terminal-tab kitty-terminal-tab
|
alias global terminal-tab kitty-terminal-tab
|
||||||
alias global focus kitty-focus
|
alias global focus kitty-focus
|
||||||
alias global repl kitty-repl
|
|
||||||
alias global send-text kitty-send-text
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
44
rc/windowing/repl/kitty.kak
Normal file
44
rc/windowing/repl/kitty.kak
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
hook global ModuleLoaded kitty %{
|
||||||
|
require-module kitty-repl
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module kitty-repl %{
|
||||||
|
|
||||||
|
define-command -params .. -shell-completion \
|
||||||
|
-docstring %{
|
||||||
|
kitty-repl [<arguments>]: Create a new window for repl interaction.
|
||||||
|
|
||||||
|
All optional parameters are forwarded to the new window.
|
||||||
|
} \
|
||||||
|
kitty-repl %{
|
||||||
|
nop %sh{
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
cmd="${SHELL:-/bin/sh}"
|
||||||
|
else
|
||||||
|
cmd="$*"
|
||||||
|
fi
|
||||||
|
kitty @ new-window --no-response --window-type $kak_opt_kitty_window_type --title kak_repl_window --cwd "$PWD" $cmd < /dev/null > /dev/null 2>&1 &
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
define-command -hidden -params 0..1 \
|
||||||
|
-docstring %{
|
||||||
|
kitty-send-text [text]: Send text to the REPL window.
|
||||||
|
|
||||||
|
If no text is passed, the selection is used.
|
||||||
|
} \
|
||||||
|
kitty-send-text %{
|
||||||
|
nop %sh{
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
text="$kak_selection"
|
||||||
|
else
|
||||||
|
text="$1"
|
||||||
|
fi
|
||||||
|
kitty @ send-text -m=title:kak_repl_window "$text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
alias global repl kitty-repl
|
||||||
|
alias global send-text kitty-send-text
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user