From 599a325a6a19b940fe319b4fd7932ce86d8772db Mon Sep 17 00:00:00 2001 From: A Farzat Date: Tue, 29 Oct 2024 06:17:29 +0900 Subject: Add a script to edit files in nvim for tridactyl --- bin/external/tridactyl_edit | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/external/tridactyl_edit (limited to 'bin') diff --git a/bin/external/tridactyl_edit b/bin/external/tridactyl_edit new file mode 100755 index 0000000..ab433b5 --- /dev/null +++ b/bin/external/tridactyl_edit @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Open file in $EDITOR using tmux for tridactyl. +# Uses wait-for to make the process blocking. +# $1 is the temporary file, $2 is the line number and $3 is the column number. +# The browser window id is saved and reactivated as the editing is finished. + +browser_window="$(xdotool getactivewindow)" + +wait_for="tridactyl-$(basename "$1")" # The name used in tmux's wait-for + +tmux_cmd_dmenu '' "${EDITOR:-nvim} $(printf %q "$1") '+normal!$2Gzv$3|'; tmux wait-for -S $(printf %q "$wait_for")" + +tmux wait-for "$wait_for" + +xdotool windowactivate "$browser_window" -- cgit v1.2.3-70-g09d2