Merge remote-tracking branch 'nochiel/nochiel-screen'
This commit is contained in:
commit
2f9deaf067
|
@ -1,9 +1,9 @@
|
||||||
# http://gnu.org/software/screen/
|
# http://gnu.org/software/screen/
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
hook global KakBegin .* %{
|
hook -group GNUscreen global KakBegin .* %{
|
||||||
%sh{
|
%sh{
|
||||||
[ -z "${kak_client_env_STY}" ] && exit
|
[ -z "${STY}" ] && exit
|
||||||
echo "
|
echo "
|
||||||
alias global focus screen-focus
|
alias global focus screen-focus
|
||||||
alias global new screen-new-vertical
|
alias global new screen-new-vertical
|
||||||
|
@ -15,14 +15,24 @@ hook global KakBegin .* %{
|
||||||
define-command screen-new-vertical -params .. -command-completion -docstring "Create a new vertical region" %{
|
define-command screen-new-vertical -params .. -command-completion -docstring "Create a new vertical region" %{
|
||||||
%sh{
|
%sh{
|
||||||
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
||||||
screen -X eval 'split -h' 'focus down' "screen kak -c \"${kak_session}\" -e \"$*\"" < "/dev/$tty"
|
screen -X eval \
|
||||||
|
'split -h' \
|
||||||
|
'focus down' \
|
||||||
|
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
|
||||||
|
screen -X remove'" \
|
||||||
|
< "/dev/$tty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command screen-new-horizontal -params .. -command-completion -docstring "Create a new horizontal region" %{
|
define-command screen-new-horizontal -params .. -command-completion -docstring "Create a new horizontal region" %{
|
||||||
%sh{
|
%sh{
|
||||||
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
||||||
screen -X eval 'split -v' 'focus right' "screen kak -c \"${kak_session}\" -e \"$*\"" < "/dev/$tty"
|
screen -X eval \
|
||||||
|
'split -v' \
|
||||||
|
'focus right' \
|
||||||
|
"screen sh -c 'kak -c \"${kak_session}\" -e \"$*\" ;
|
||||||
|
screen -X remove'" \
|
||||||
|
< "/dev/$tty"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +49,10 @@ If no client is passed then the current one is used} \
|
||||||
screen-focus %{ %sh{
|
screen-focus %{ %sh{
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
printf %s\\n "
|
printf %s\\n "
|
||||||
evaluate-commands -client '$1' %{ %sh{
|
evaluate-commands -client '$1' focus
|
||||||
screen -X focus
|
"
|
||||||
}}"
|
|
||||||
elif [ -n "${kak_client_env_STY}" ]; then
|
elif [ -n "${kak_client_env_STY}" ]; then
|
||||||
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
||||||
screen -X select "$kak_client_env_WINDOW" < "/dev/$tty"
|
screen -X select "${kak_client_env_WINDOW}" < "/dev/$tty"
|
||||||
fi
|
fi
|
||||||
} }
|
} }
|
||||||
|
|
|
@ -14,23 +14,46 @@ define-command \
|
||||||
-docstring %{ranger [<arguments>]: open the file system explorer to select buffers to open
|
-docstring %{ranger [<arguments>]: open the file system explorer to select buffers to open
|
||||||
All the optional arguments are forwarded to the ranger utility} \
|
All the optional arguments are forwarded to the ranger utility} \
|
||||||
ranger %{ %sh{
|
ranger %{ %sh{
|
||||||
if [ -n "$TMUX" ]; then
|
if [ -n "${TMUX}" ]; then
|
||||||
tmux split-window -h \
|
tmux split-window -h \
|
||||||
ranger $@ --cmd " \
|
ranger $@ --cmd " \
|
||||||
map <return> eval \
|
map <return> eval \
|
||||||
fm.execute_console('shell \
|
fm.execute_console('shell \
|
||||||
echo evaluate-commands -client $kak_client edit {file} | \
|
echo evaluate-commands -client ' + ranger.ext.shell_escape.shell_escape('$kak_client') + ' edit {file} | \
|
||||||
kak -p $kak_session; \
|
kak -p '.format(file=fm.thisfile.path) + ranger.ext.shell_escape.shell_escape('$kak_session') + '; \
|
||||||
tmux select-pane -t $kak_client_env_TMUX_PANE'.format(file=fm.thisfile.path)) \
|
tmux select-pane -t $kak_client_env_TMUX_PANE') \
|
||||||
if fm.thisfile.is_file else fm.execute_console('move right=1')"
|
if fm.thisfile.is_file else fm.execute_console('move right=1')"
|
||||||
|
|
||||||
|
elif [ -n "${STY}" ]; then
|
||||||
|
|
||||||
|
script="/tmp/kak-ranger-${kak_client}-${kak_session}.sh"
|
||||||
|
selections="/tmp/kak-ranger-${kak_client}-${kak_session}.txt"
|
||||||
|
cat > "$script" << EOF
|
||||||
|
#! /usr/bin/env sh
|
||||||
|
cd "$PWD"
|
||||||
|
ranger --choosefiles="$selections" $@
|
||||||
|
while read -r f; do
|
||||||
|
printf %s "evaluate-commands -client '${kak_client}' edit '\"\$f\"'" | kak -p '${kak_session}'
|
||||||
|
done < "$selections"
|
||||||
|
screen -X remove
|
||||||
|
rm -f "$selections" "$script"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
||||||
|
screen -X eval \
|
||||||
|
'split -h' \
|
||||||
|
'focus down' \
|
||||||
|
"screen sh '$script'" \
|
||||||
|
< "/dev/$tty"
|
||||||
|
|
||||||
elif [ -n "$WINDOWID" ]; then
|
elif [ -n "$WINDOWID" ]; then
|
||||||
setsid $kak_opt_termcmd " \
|
setsid $kak_opt_termcmd " \
|
||||||
ranger $@ --cmd "'"'" \
|
ranger $@ --cmd "'"'" \
|
||||||
map <return> eval \
|
map <return> eval \
|
||||||
fm.execute_console('shell \
|
fm.execute_console('shell \
|
||||||
echo evaluate-commands -client $kak_client edit {file} | \
|
echo evaluate-commands -client ' + ranger.ext.shell_escape.shell_escape('$kak_client') + ' edit {file} | \
|
||||||
kak -p $kak_session; \
|
kak -p '.format(file=fm.thisfile.path) + ranger.ext.shell_escape.shell_escape('$kak_session') + '; \
|
||||||
xdotool windowactivate $kak_client_env_WINDOWID'.format(file=fm.thisfile.path)) \
|
xdotool windowactivate $kak_client_env_WINDOWID') \
|
||||||
if fm.thisfile.is_file else fm.execute_console('move right=1')"'"' < /dev/null > /dev/null 2>&1 &
|
if fm.thisfile.is_file else fm.execute_console('move right=1')"'"' < /dev/null > /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user