diff --git a/flake.nix b/flake.nix index 6dd91a9..0d49ab3 100644 --- a/flake.nix +++ b/flake.nix @@ -42,9 +42,11 @@ neovim = pkgs.callPackage ./package.nix { mdfmt = self.packages.${pkgs.system}.mdfmt; }; - godot-neovim = pkgs.writeShellApplication { - name = "godot-neovim"; - }; + godot-neovim = pkgs.writeShellApplication { + name = "godot-neovim"; + runtimeInputs = with pkgs; [neovim-remote]; + text = builtins.readFile ./scripts/godot-neovim.sh; + }; mdfmt = pkgs.buildGoModule { name = "mdfmt"; src = inputs.mdfmt; @@ -90,6 +92,7 @@ type = with types; bool; default = true; }; + integrations.godot.enable = mkEnableOption ""; }; config = mkIf cfg.enable { environment.variables = { @@ -104,6 +107,10 @@ yazi = config.programs.yazi.package; })) ] + ++ (optionals cfg.integrations.godot.enable [ + self.packages."${pkgs.system}".godot-neovim + ]); + # Disable NixOS's Neovim programs.neovim.enable = mkForce false; }; @@ -136,6 +143,7 @@ type = with types; bool; default = true; }; + integrations.godot.enable = mkEnableOption ""; }; config = mkIf cfg.enable { home.sessionVariables = { @@ -151,6 +159,10 @@ 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.fish.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";}; programs.zsh.shellAliases = mkIf cfg.vimdiffAlias {vimdiff = "nvim -d";}; diff --git a/lua/dot/plugins.lua b/lua/dot/plugins.lua index 89289b1..3e52f8a 100644 --- a/lua/dot/plugins.lua +++ b/lua/dot/plugins.lua @@ -8,6 +8,7 @@ lze.load({ -- Language Server Protocol { "nvim-lspconfig", + dep_of = { "godotdev" }, ---@param plugin lze.Plugin lsp = function(plugin) local config = plugin.lsp or {} @@ -27,6 +28,7 @@ lze.load({ after = function() require("dot.debugger") end, + dep_of = { "godotdev.nvim" }, on_require = { "dap", "dapui" }, }, { "nvim-dap-ui", dep_of = "nvim-dap" }, @@ -180,7 +182,7 @@ lze.load({ -- Treesitter (Syntax Highlighting) { "nvim-treesitter", - dep_of = "indent-blankline.nvim", + dep_of = { "godotdev", "indent-blankline.nvim" }, on_require = "nvim-treesitter", }, { "nvim-treesitter-textobjects", dep_of = "nvim-treesitter" }, @@ -249,7 +251,14 @@ lze.load({ end, }, { - "godot.nvim", - cmd = { "GodotDebug", "GodotBreakAtCursor", "GodotStep", "GodotQuit", "GodotContinue" }, + "godotdev.nvim", + after = function() + require("godotdev").setup({ + autostart_editor_server = true, + }) + end, + cmd = { "GodotReconnectLSP", "GodotStartEditorServer" }, + ft = { "gd", "gdscript", "gdshader", "gdscript3" }, + on_require = "godotdev", }, }) diff --git a/package.nix b/package.nix index bf2282c..fa8d22d 100644 --- a/package.nix +++ b/package.nix @@ -87,11 +87,11 @@ in }; }) (pkgs.vimUtils.buildVimPlugin { - pname = "godot.nvim"; - version = "v0.4.4"; + pname = "godotdev.nvim"; + version = "v0.2.3"; src = fetchGit { - url = "https://github.com/Lommix/godot.nvim"; - rev = "349b6b088c15447843fc21b60ba7267b8b49d821"; + url = "https://github.com/Mathijs-Bakker/godotdev.nvim"; + rev = "79d9315988b7772c03a1cabb6f31f5287c849e2b"; }; }) ]; diff --git a/scripts/godot-neovim.sh b/scripts/godot-neovim.sh index 21924d9..7cb253f 100644 --- a/scripts/godot-neovim.sh +++ b/scripts/godot-neovim.sh @@ -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 "${CMD}" +nvr --servername "$SOCKET" --remote-send "${CMD}" # ----------------------------- # Focus GUI terminal (Hyprland) # ----------------------------- -hyprctl dispatch focuswindow class:$GODOT_TERMINAL - +hyprctl dispatch focuswindow "class:$GODOT_TERMINAL"