feat(plugins,nix): godot integration

This commit is contained in:
Guz
2025-12-14 20:52:55 -03:00
parent 1c1cd0ca52
commit 43cc8f1eaf
5 changed files with 161 additions and 32 deletions

View File

@@ -3,10 +3,10 @@
# Script provided by Mathijs Bakker's godotdev.nvim, licensed under the Apache
# License Version 2.0.
#
# A copy of the original script can be found at
# A copy of the original script can be found at
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/doc/neovim-external-editor-setup.md#installation
#
# A copy of the original license can be found at
# A copy of the original license can be found at
# https://github.com/Mathijs-Bakker/godotdev.nvim/blob/79d9315988b7772c03a1cabb6f31f5287c849e2b/LICENSE
# Godot → Neovim launcher with GUI terminal focus
@@ -28,8 +28,7 @@ else
shift
fi
SOCKET="${SOCKET:=/tmp/godot.pipe}" # Neovim socket path
NVR="${NVR:=/Library/Frameworks/Python.framework/Versions/3.8/bin/nvr}"
SOCKET="${SOCKET:=/tmp/godot.nvim}" # Neovim socket path
OPEN_MODE="window"
LINE=""
@@ -40,36 +39,47 @@ FILE=""
# -----------------------------
while [[ $# -gt 0 ]]; do
case "$1" in
--tab) OPEN_MODE="tab"; shift ;;
--vsplit) OPEN_MODE="vsplit"; shift ;;
+[0-9]*) LINE="${1#+}"; shift ;;
*) FILE="$1"; shift ;;
--tab)
OPEN_MODE="tab"
shift
;;
--vsplit)
OPEN_MODE="vsplit"
shift
;;
+[0-9]*)
LINE="${1#+}"
shift
;;
*)
FILE="$1"
shift
;;
esac
done
[ -z "$FILE" ] && exit 0
[ "$FILE" = "" ] && exit 0
# -----------------------------
# Open file in Neovim or jump to buffer
# -----------------------------
if $NVR --servername "$SOCKET" --remote-expr \
"bufexists(fnamemodify('$FILE', ':p'))" | grep -q 1; then
CMD=":buffer $(basename "$FILE")"
if nvr --servername "$SOCKET" --remote-expr \
"bufexists(fnamemodify('$FILE', ':p'))" | grep -q 1; then
CMD=":buffer $(basename "$FILE")"
else
case "$OPEN_MODE" in
window) CMD=":e $FILE" ;;
tab) CMD=":tabedit $FILE" ;;
vsplit) CMD=":vsplit $FILE" ;;
window) CMD=":e $FILE" ;;
tab) CMD=":tabedit $FILE" ;;
vsplit) CMD=":vsplit $FILE" ;;
esac
fi
[ -n "$LINE" ] && CMD="$CMD | call cursor($LINE,1)"
[ "$LINE" != "" ] && CMD="$CMD | call cursor($LINE,1)"
CMD="$CMD | normal! zz"
$NVR --servername "$SOCKET" --remote-send "<C-\\><C-N>${CMD}<CR>"
nvr --servername "$SOCKET" --remote-send "<C-\\><C-N>${CMD}<CR>"
# -----------------------------
# Focus GUI terminal (Hyprland)
# -----------------------------
hyprctl dispatch focuswindow class:$GODOT_TERMINAL
hyprctl dispatch focuswindow "class:$GODOT_TERMINAL"