From 7d18f4cae5364ff0f4b90f88331e6519983ba3f2 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:52:01 +0900 Subject: updates --- fedora/.local/bin/restartvim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 fedora/.local/bin/restartvim (limited to 'fedora/.local/bin/restartvim') diff --git a/fedora/.local/bin/restartvim b/fedora/.local/bin/restartvim new file mode 100755 index 0000000..3c63f8b --- /dev/null +++ b/fedora/.local/bin/restartvim @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e + +# Set new line and tab for word splitting +IFS=" + " + +# Check if the script is running inside a tmux session +if [ -z "$TMUX" ]; then + echo "This script must be run from inside a tmux session." + exit 1 +fi + +# Get the current tmux pane ID +tmux_pane=$(tmux display-message -p '#D') + +# Send Escape, :wq, and Enter to Vim in the tmux pane +tmux send-keys -t "$tmux_pane" Escape C-m ':wq' C-m + +# Wait to ensure Vim exits +sleep 0.5 + +# Detach the script from Vim and wait a bit to ensure Vim exits +(nohup sh -c "sleep 0.5; tmux send-keys -t \"$tmux_pane\" 'vim -c \"execute \\\"edit \\\" . v:oldfiles[0] | normal '\''0\"' C-m" >/dev/null 2>&1 &) -- cgit v1.2.3