Compare commits

...

7 Commits

7 changed files with 190 additions and 54 deletions

23
flake.lock generated
View File

@@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"godotdev": {
"flake": false,
"locked": {
"lastModified": 1768050065,
"narHash": "sha256-52tWEZ092Sskxn1113aWBSTQW6iBPPhyAfpwCS+F9XI=",
"ref": "refs/heads/master",
"rev": "61fcb7a627d6a417d70913cecb0fda17a181a49a",
"revCount": 80,
"type": "git",
"url": "https://code.capytal.cc/dot013/godotdev.nvim"
},
"original": {
"type": "git",
"url": "https://code.capytal.cc/dot013/godotdev.nvim"
}
},
"mdfmt": { "mdfmt": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -18,11 +34,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1765186076, "lastModified": 1767892417,
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=", "narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8", "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -34,6 +50,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"godotdev": "godotdev",
"mdfmt": "mdfmt", "mdfmt": "mdfmt",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View File

@@ -6,6 +6,13 @@
url = "github:moorereason/mdfmt"; url = "github:moorereason/mdfmt";
flake = false; flake = false;
}; };
godotdev = {
url = "git+https://code.capytal.cc/dot013/godotdev.nvim";
# url = "github:Mathijs-Bakker/godotdev.nvim";
# url = "git+file:///home/guz/.projects/guz013-godotdev-nvim";
flake = false;
};
}; };
outputs = { outputs = {
self, self,
@@ -41,10 +48,88 @@
}: { }: {
neovim = pkgs.callPackage ./package.nix { neovim = pkgs.callPackage ./package.nix {
mdfmt = self.packages.${pkgs.system}.mdfmt; mdfmt = self.packages.${pkgs.system}.mdfmt;
godotdev = self.packages.${pkgs.system}.godotdev;
}; };
godot-neovim = pkgs.writeShellApplication { godotdev = pkgs.vimUtils.buildVimPlugin {
name = "godot-neovim"; pname = "godotdev.nvim";
version = "v0.2.3";
src = inputs.godotdev;
};
godot-neovim = pkgs.writeShellScriptBin "godot-neovim" (builtins.readFile ./scripts/godot-neovim.sh);
gh-actions-language-server = pkgs.callPackage ({
stdenv,
lib,
makeBinaryWrapper,
buildNpmPackage,
bun,
nodejs,
npmHooks,
...
}: let
pname = "gh-actions-language-server";
src = fetchGit {
url = "https://github.com/lttb/gh-actions-language-server";
rev = "0287d3081d7b74fef88824ca3bd6e9a44323a54d";
}; };
packageJson = lib.importJSON "${src}/package.json";
version = packageJson.version;
node_modules = stdenv.mkDerivation {
inherit src version;
pname = "${pname}-node_modules";
nativeBuildInputs = [bun];
dontConfigure = true;
buildPhase = ''
bun install --no-progress --frozen-lockfile
'';
installPhase = ''
mkdir -p $out/node_modules
cp -R ./node_modules/* $out/node_modules
ls -la $out/node_modules
'';
dontFixup = true;
dontPathShebangs = true;
outputHash = "sha256-HfMP9OI07CpiOQw5xkpcRPKPv/MflU1FjtSMOuCkYtg=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
in
stdenv.mkDerivation {
inherit pname src version;
buildInputs = [bun nodejs];
nativeBuildInputs = [makeBinaryWrapper];
dontConfigure = true;
buildPhase = ''
runHook preBuild
ln -s "${node_modules}/node_modules" ./
bun run build:node
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
mv ./bin/$pname $out/$pname
makeBinaryWrapper ${lib.getExe nodejs} $out/bin/$pname \
--prefix PATH : ${lib.makeBinPath [nodejs]} \
--add-flags "$out/$pname"
runHook postInstall
'';
# installPhase = ''
# runHook preInstall
#
# mkdir -p $out/bin
# makeBinaryWrapper ${lib.getExe nodejs} $out/bin/$pname \
# --prefix PATH : "${lib.makeBinPath [nodejs]}"
# --add-flags "$out/$pname"
#
# runHook postInstall
# '';
}) {};
mdfmt = pkgs.buildGoModule { mdfmt = pkgs.buildGoModule {
name = "mdfmt"; name = "mdfmt";
src = inputs.mdfmt; src = inputs.mdfmt;
@@ -90,6 +175,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 +190,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 +226,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 +242,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

@@ -1,9 +1,6 @@
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = " " vim.g.maplocalleader = " "
---- Plugins
require("dot.plugins")
-- Filetype plugins -- Filetype plugins
vim.o.filetype = "on" vim.o.filetype = "on"
@@ -28,9 +25,6 @@ vim.o.breakindent = true
vim.o.list = true vim.o.list = true
vim.opt.listchars = { tab = "", trail = ".", nbsp = "" } vim.opt.listchars = { tab = "", trail = ".", nbsp = "" }
-- Theme
vim.cmd.colorscheme("catppuccin")
---- ----
-- Mouse support -- Mouse support
@@ -87,9 +81,15 @@ vim.diagnostic.config({
}, },
}) })
---- Plugins
require("dot.plugins")
require("dot.commands") require("dot.commands")
require("dot.keymaps") require("dot.keymaps")
-- Theme
vim.cmd.colorscheme("catppuccin")
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
auto_install = false, auto_install = false,
highlight = { enable = true }, highlight = { enable = true },

View File

@@ -7,6 +7,8 @@ vim.keymap.set("n", "<C-j>", "<C-w><C-l>", { desc = "Move focus to the lower win
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" }) vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
vim.keymap.set("n", "<leader>w", ":lua require('harpoon'):list():add()<cr>", { desc = "Harpoon: Add file to list" }) vim.keymap.set("n", "<leader>w", ":lua require('harpoon'):list():add()<cr>", { desc = "Harpoon: Add file to list" })
vim.keymap.set("n", "<C-p>", ":lua require('harpoon'):list():prev()<cr>", { desc = "Harpoon: Previous file" })
vim.keymap.set("n", "<C-n>", ":lua require('harpoon'):list():next()<cr>", { desc = "Harpoon: Next file" })
vim.keymap.set("n", "<leader>e", ":lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<cr>", { vim.keymap.set("n", "<leader>e", ":lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())<cr>", {
desc = "Harpoon: Add file to list", desc = "Harpoon: Add file to list",
}) })
@@ -41,15 +43,15 @@ vim.api.nvim_create_autocmd("LspAttach", {
vim.keymap.set(mode or "n", lhs, rhs, { buffer = e.buf, desc = "LSP: " .. desc }) vim.keymap.set(mode or "n", lhs, rhs, { buffer = e.buf, desc = "LSP: " .. desc })
end end
map("grn", vim.lsp.buf.rename, "[R]e[n]ame") map("gn", vim.lsp.buf.rename, "Re[n]ame")
map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" }) map("ga", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
map("grr", ":lua require('telescope.builtin').lsp_references<cr>", "[G]oto [R]eferences") map("gr", ":lua require('telescope.builtin').lsp_references()<cr>", "[G]oto [R]eferences")
map("gri", ":lua require('telescope.builtin').lsp_implementations<cr>", "[G]oto [I]mplementation") map("gi", ":lua require('telescope.builtin').lsp_implementations()<cr>", "[G]oto [I]mplementation")
map("grd", ":lua require('telescope.builtin').lsp_definitions", "[G]oto [D]efinition") map("gd", ":lua require('telescope.builtin').lsp_definitions()<cr>", "[G]oto [D]efinition")
map("grt", ":lua require('telescope.builtin').lsp_type_definitions", "[G]oto [T]ype Definition") map("gt", ":lua require('telescope.builtin').lsp_type_definitions()<cr>", "[G]oto [T]ype Definition")
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration<cr>")
map("gO", ":lua require('telescope.builtin').lsp_document_symbols", "[O]pen Document Symbols") map("gO", ":lua require('telescope.builtin').lsp_document_symbols()<cr>", "[O]pen Document Symbols")
map("gW", ":lua require('telescope.builtin').lsp_dynamic_workspace_symbols", "Open [W]orkspace Symbols") map("gW", ":lua require('telescope.builtin').lsp_dynamic_workspace_symbols()<cr>", "Open [W]orkspace Symbols")
end, end,
group = vim.api.nvim_create_augroup("dot-lsp-attach-keymaps", { clear = true }), group = vim.api.nvim_create_augroup("dot-lsp-attach-keymaps", { clear = true }),
}) })
@@ -58,8 +60,8 @@ vim.api.nvim_create_autocmd("LspAttach", {
vim.keymap.set("n", "<leader>b", ":lua require('dap').toggle_breakpoint()<cr>", { vim.keymap.set("n", "<leader>b", ":lua require('dap').toggle_breakpoint()<cr>", {
desc = "Debugger: Toggle [B]reakpointn", desc = "Debugger: Toggle [B]reakpointn",
}) })
vim.keymap.set("n", "<leader>x", ":lua require('dap').continue()<cr>", { desc = "Debugger: Continue debugger" }) vim.keymap.set("n", "<F5>", ":lua require('dap').continue()<cr>", { desc = "Debugger: Continue debugger" })
vim.keymap.set("n", "<leader>X", ":lua require('dap').terminate()<cr>", { desc = "Debugger: Terminate debugger" }) vim.keymap.set("n", "<F8>", ":lua require('dap').terminate()<cr>", { desc = "Debugger: Terminate debugger" })
vim.keymap.set("n", "<leader>C", ":lua require('dap').clear_breakpoints()<cr>", { vim.keymap.set("n", "<leader>C", ":lua require('dap').clear_breakpoints()<cr>", {
desc = "Debugger: Clear all breakpoints", desc = "Debugger: Clear all breakpoints",
}) })

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" },
@@ -160,7 +162,7 @@ lze.load({
"SessionSearch", "SessionSearch",
"Auutosession", "Auutosession",
}, },
lazy = not (#(vim.fs.root(0, ".git") or 0) > 0), lazy = not (#(vim.fs.root(0, ".git") or {}) > 0),
}, },
-- Secrets hiding -- Secrets hiding
@@ -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" },
@@ -230,7 +232,7 @@ lze.load({
desc = "[Git] Toggle line blame", desc = "[Git] Toggle line blame",
}, },
}, },
lazy = not (#vim.fs.root(0, ".git") > 0), lazy = not (#(vim.fs.root(0, ".git") or {}) > 0),
}, },
-- Todo comments -- Todo comments
@@ -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

@@ -4,6 +4,14 @@
neovim ? pkgs.neovim, neovim ? pkgs.neovim,
mdfmt ? null, mdfmt ? null,
yazi ? pkgs.yazi, yazi ? pkgs.yazi,
godotdev ? (pkgs.vimUtils.buildVimPlugin {
pname = "godotdev.nvim";
version = "v0.2.3";
src = fetchGit {
url = "https://github.com/Mathijs-Bakker/godotdev.nvim";
rev = "79d9315988b7772c03a1cabb6f31f5287c849e2b";
};
}),
... ...
}: let }: let
dot-nvim = pkgs.vimUtils.buildVimPlugin { dot-nvim = pkgs.vimUtils.buildVimPlugin {
@@ -86,14 +94,7 @@ in
rev = "be7b03748f59b6602502baf08e7f7736cc7279a5"; rev = "be7b03748f59b6602502baf08e7f7736cc7279a5";
}; };
}) })
(pkgs.vimUtils.buildVimPlugin { godotdev
pname = "godot.nvim";
version = "v0.4.4";
src = fetchGit {
url = "https://github.com/Lommix/godot.nvim";
rev = "349b6b088c15447843fc21b60ba7267b8b49d821";
};
})
]; ];
# inherit start opt; # inherit start opt;
}; };
@@ -105,6 +106,7 @@ in
vscode-langservers-extracted # cssls, eslint, html, jsonls, typescript vscode-langservers-extracted # cssls, eslint, html, jsonls, typescript
docker-language-server
emmet-language-server emmet-language-server
golangci-lint-langserver golangci-lint-langserver
gopls gopls
@@ -115,6 +117,7 @@ in
nil nil
rust-analyzer rust-analyzer
tailwindcss-language-server tailwindcss-language-server
typescript-language-server
] ]
++ [ ++ [
# INFO: Formatters # INFO: Formatters

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"