Compare commits

...

1 Commits

Author SHA1 Message Date
2e6c687a7c feat(plugins,nix): godot integration 2025-12-14 21:59:29 -03:00
4 changed files with 60 additions and 29 deletions

View File

@@ -42,9 +42,11 @@
neovim = pkgs.callPackage ./package.nix { neovim = pkgs.callPackage ./package.nix {
mdfmt = self.packages.${pkgs.system}.mdfmt; mdfmt = self.packages.${pkgs.system}.mdfmt;
}; };
godot-neovim = pkgs.writeShellApplication { godot-neovim = pkgs.writeShellApplication {
name = "godot-neovim"; name = "godot-neovim";
}; runtimeInputs = with pkgs; [neovim-remote];
text = builtins.readFile ./scripts/godot-neovim.sh;
};
mdfmt = pkgs.buildGoModule { mdfmt = pkgs.buildGoModule {
name = "mdfmt"; name = "mdfmt";
src = inputs.mdfmt; src = inputs.mdfmt;
@@ -90,6 +92,7 @@
type = with types; bool; type = with types; bool;
default = true; default = true;
}; };
integrations.godot.enable = mkEnableOption "";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.variables = { environment.variables = {
@@ -104,6 +107,10 @@
yazi = config.programs.yazi.package; yazi = config.programs.yazi.package;
})) }))
] ]
++ (optionals cfg.integrations.godot.enable [
self.packages."${pkgs.system}".godot-neovim
]);
# Disable NixOS's Neovim # Disable NixOS's Neovim
programs.neovim.enable = mkForce false; programs.neovim.enable = mkForce false;
}; };
@@ -136,6 +143,7 @@
type = with types; bool; type = with types; bool;
default = true; default = true;
}; };
integrations.godot.enable = mkEnableOption "";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.sessionVariables = { home.sessionVariables = {
@@ -151,6 +159,10 @@
yazi = config.programs.yazi.package; yazi = config.programs.yazi.package;
})) }))
] ]
++ (optionals cfg.integrations.godot.enable [
self.packages."${pkgs.system}".godot-neovim
]);
programs.bash.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";}; programs.bash.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
programs.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";}; programs.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";}; programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";};

View File

@@ -8,6 +8,7 @@ lze.load({
-- Language Server Protocol -- Language Server Protocol
{ {
"nvim-lspconfig", "nvim-lspconfig",
dep_of = { "godotdev" },
---@param plugin lze.Plugin ---@param plugin lze.Plugin
lsp = function(plugin) lsp = function(plugin)
local config = plugin.lsp or {} local config = plugin.lsp or {}
@@ -27,6 +28,7 @@ lze.load({
after = function() after = function()
require("dot.debugger") require("dot.debugger")
end, end,
dep_of = { "godotdev.nvim" },
on_require = { "dap", "dapui" }, on_require = { "dap", "dapui" },
}, },
{ "nvim-dap-ui", dep_of = "nvim-dap" }, { "nvim-dap-ui", dep_of = "nvim-dap" },
@@ -180,7 +182,7 @@ lze.load({
-- Treesitter (Syntax Highlighting) -- Treesitter (Syntax Highlighting)
{ {
"nvim-treesitter", "nvim-treesitter",
dep_of = "indent-blankline.nvim", dep_of = { "godotdev", "indent-blankline.nvim" },
on_require = "nvim-treesitter", on_require = "nvim-treesitter",
}, },
{ "nvim-treesitter-textobjects", dep_of = "nvim-treesitter" }, { "nvim-treesitter-textobjects", dep_of = "nvim-treesitter" },
@@ -249,7 +251,14 @@ lze.load({
end, end,
}, },
{ {
"godot.nvim", "godotdev.nvim",
cmd = { "GodotDebug", "GodotBreakAtCursor", "GodotStep", "GodotQuit", "GodotContinue" }, after = function()
require("godotdev").setup({
autostart_editor_server = true,
})
end,
cmd = { "GodotReconnectLSP", "GodotStartEditorServer" },
ft = { "gd", "gdscript", "gdshader", "gdscript3" },
on_require = "godotdev",
}, },
}) })

View File

@@ -87,11 +87,11 @@ in
}; };
}) })
(pkgs.vimUtils.buildVimPlugin { (pkgs.vimUtils.buildVimPlugin {
pname = "godot.nvim"; pname = "godotdev.nvim";
version = "v0.4.4"; version = "v0.2.3";
src = fetchGit { src = fetchGit {
url = "https://github.com/Lommix/godot.nvim"; url = "https://github.com/Mathijs-Bakker/godotdev.nvim";
rev = "349b6b088c15447843fc21b60ba7267b8b49d821"; rev = "79d9315988b7772c03a1cabb6f31f5287c849e2b";
}; };
}) })
]; ];

View File

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