diff options
author | A Farzat <a@farzat.xyz> | 2024-10-29 06:17:29 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2024-11-10 06:17:29 +0900 |
commit | 599a325a6a19b940fe319b4fd7932ce86d8772db (patch) | |
tree | cc1a6ad50de9e0df42ffebb62bf0a92fe6c01488 /bin/external | |
parent | 15a80a31ff56a24da9918a6bfcfe51aab809aa19 (diff) | |
download | dotfiles-599a325a6a19b940fe319b4fd7932ce86d8772db.tar.gz dotfiles-599a325a6a19b940fe319b4fd7932ce86d8772db.zip |
Add a script to edit files in nvim for tridactyl
Diffstat (limited to 'bin/external')
-rwxr-xr-x | bin/external/tridactyl_edit | 16 |
1 files changed, 16 insertions, 0 deletions
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" |