1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 20:41:49 +03:00

split x11 repl functionality to x11-repl.kak

This commit is contained in:
Gokcehan Kara 2016-01-26 15:05:35 +02:00
parent e25490dc7f
commit 31b4c5c4c8
2 changed files with 25 additions and 24 deletions

25
rc/x11-repl.kak Normal file
View File

@ -0,0 +1,25 @@
# termcmd should already be set in x11.kak
def -docstring 'create a new window for repl interaction' \
-params 0..1 \
-command-completion \
x11-repl %{ %sh{
if [ -z "${kak_opt_termcmd}" ]; then
echo "echo -color Error 'termcmd option is not set'"
exit
fi
if [ $# -eq 0 ]; then cmd="bash"; else cmd="$1"; fi
setsid ${kak_opt_termcmd} ${cmd} -t kak_repl_window < /dev/null > /dev/null 2>&1 &
}}
def x11-send-text -docstring "send selected text to the repl window" %{
%sh{
echo "${kak_selection}" | xsel -i
wid=$(xdotool getactivewindow)
xdotool search --name kak_repl_window windowactivate
xdotool key --clearmodifiers "Shift+Insert"
xdotool windowactivate $wid
}
}
alias global repl x11-repl
alias global send-text x11-send-text

View File

@ -30,28 +30,6 @@ def -docstring 'create a new kak client for current session' \
setsid ${kak_opt_termcmd} "kak -c ${kak_session} ${kakoune_params}" < /dev/null > /dev/null 2>&1 &
}}
def -docstring 'create a new window for repl interaction' \
-params 0..1 \
-command-completion \
x11-repl %{ %sh{
if [ -z "${kak_opt_termcmd}" ]; then
echo "echo -color Error 'termcmd option is not set'"
exit
fi
if [ $# -eq 0 ]; then cmd="bash"; else cmd="$1"; fi
setsid ${kak_opt_termcmd} ${cmd} -t kak_repl_window < /dev/null > /dev/null 2>&1 &
}}
def x11-send-text -docstring "send selected text to the repl window" %{
%sh{
echo "${kak_selection}" | xsel -i
wid=$(xdotool getactivewindow)
xdotool search --name kak_repl_window windowactivate
xdotool key --clearmodifiers "Shift+Insert"
xdotool windowactivate $wid
}
}
def -docstring 'focus given client\'s window' \
-params 0..1 -client-completion \
x11-focus %{ %sh{
@ -66,5 +44,3 @@ def -docstring 'focus given client\'s window' \
alias global focus x11-focus
alias global new x11-new
alias global repl x11-repl
alias global send-text x11-send-text