summaryrefslogtreecommitdiff
path: root/mut/bin/tmux-normal-mode
diff options
context:
space:
mode:
Diffstat (limited to 'mut/bin/tmux-normal-mode')
-rw-r--r--mut/bin/tmux-normal-mode28
1 files changed, 28 insertions, 0 deletions
diff --git a/mut/bin/tmux-normal-mode b/mut/bin/tmux-normal-mode
new file mode 100644
index 0000000..5730017
--- /dev/null
+++ b/mut/bin/tmux-normal-mode
@@ -0,0 +1,28 @@
+ # Make our own copy-mode with Kakoune!
+ # cursor_y=$(tmux display-message -t "''${pane_id}" -p "#{cursor_y}") ;\
+ # cursor_x=$(tmux display-message -t "''${pane_id}" -p "#{cursor_x}") ;\
+ # pane_height=$(tmux display-message -t "''${pane_id}" -p "#{pane_height}") ;\
+ # line_count="$(wc -l "$file" |awk "{print \$1}")" ;\
+ # sel_line=$(( line_count - ( pane_height - cursor_y ) + 1 )) ;\
+ # printf "sel = %s\n" "$line_count" >>/tmp/debug.log ;\
+ # cursor="''${sel_line}.''${cursor_x},''${sel_line}.''${cursor_x}" ;\
+ # printf "cursor = %s\n" "$cursor" >>/tmp/debug.log
+
+kakoune_session="$(tmux display-message -p "#{window_name}" | sed "s/kakc@//")"
+dispatch_name="dispatch://$(tmux display-message -p "#{pane_start_command}")"
+case "${@}" in
+ '')
+ output=$(mktemp -d /tmp/kak-tmux.XXXXXXXX)/fifo
+ mkfifo ${output}
+ ( tmux capture-pane -S '-' -E '-' -J -e -p -t $TMUX_PANE | filter-ansi >${output} & )
+ tmux new-window -t kaks@$kakoune_session -n "$dispatch_name" -d "
+ kak -c '$kakoune_session' -e \"edit -fifo ${output} '${dispatch_name}';\
+ set-option buffer readonly true ;\
+ set-option window filetype dispatch ;\
+ hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }\""
+ tmux swap-pane -s kaks@$kakoune_session:"$dispatch_name".0 -t :
+ ;;
+ --quit)
+ tmux break-pane -t kaks@$kakoune_session -a -d -n "$dispatch_name"
+ ;;
+esac