Compare commits

...

7 Commits

7 changed files with 190 additions and 54 deletions

23
flake.lock generated
View File

@@ -1,5 +1,21 @@
{
"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": {
"flake": false,
"locked": {
@@ -18,11 +34,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1765186076,
"narHash": "sha256-hM20uyap1a0M9d344I692r+ik4gTMyj60cQWO+hAYP8=",
"lastModified": 1767892417,
"narHash": "sha256-dhhvQY67aboBk8b0/u0XB6vwHdgbROZT3fJAjyNh5Ww=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8",
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
"type": "github"
},
"original": {
@@ -34,6 +50,7 @@
},
"root": {
"inputs": {
"godotdev": "godotdev",
"mdfmt": "mdfmt",
"nixpkgs": "nixpkgs"
}

View File

@@ -6,6 +6,13 @@
url = "github:moorereason/mdfmt";
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 = {
self,
@@ -41,10 +48,88 @@
}: {
neovim = pkgs.callPackage ./package.nix {
mdfmt = self.packages.${pkgs.system}.mdfmt;
godotdev = self.packages.${pkgs.system}.godotdev;
};
godot-neovim = pkgs.writeShellApplication {
name = "godot-neovim";
godotdev = pkgs.vimUtils.buildVimPlugin {
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 {
name = "mdfmt";
src = inputs.mdfmt;
@@ -90,6 +175,7 @@
type = with types; bool;
default = true;
};
integrations.godot.enable = mkEnableOption "";
};
config = mkIf cfg.enable {
environment.variables = {
@@ -104,6 +190,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 +226,7 @@
type = with types; bool;
default = true;
};
integrations.godot.enable = mkEnableOption "";
};
config = mkIf cfg.enable {
home.sessionVariables = {
@@ -151,6 +242,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";};

View File

@@ -1,9 +1,6 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
---- Plugins
require("dot.plugins")
-- Filetype plugins
vim.o.filetype = "on"
@@ -28,9 +25,6 @@ vim.o.breakindent = true
vim.o.list = true
vim.opt.listchars = { tab = "", trail = ".", nbsp = "" }
-- Theme
vim.cmd.colorscheme("catppuccin")
----
-- Mouse support
@@ -87,9 +81,15 @@ vim.diagnostic.config({
},
})
---- Plugins
require("dot.plugins")
require("dot.commands")
require("dot.keymaps")
-- Theme
vim.cmd.colorscheme("catppuccin")
require("nvim-treesitter.configs").setup({
auto_install = false,
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", "<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>", {
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 })
end
map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
map("gra", 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("gri", ":lua require('telescope.builtin').lsp_implementations<cr>", "[G]oto [I]mplementation")
map("grd", ":lua require('telescope.builtin').lsp_definitions", "[G]oto [D]efinition")
map("grt", ":lua require('telescope.builtin').lsp_type_definitions", "[G]oto [T]ype Definition")
map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
map("gO", ":lua require('telescope.builtin').lsp_document_symbols", "[O]pen Document Symbols")
map("gW", ":lua require('telescope.builtin').lsp_dynamic_workspace_symbols", "Open [W]orkspace Symbols")
map("gn", vim.lsp.buf.rename, "Re[n]ame")
map("ga", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
map("gr", ":lua require('telescope.builtin').lsp_references()<cr>", "[G]oto [R]eferences")
map("gi", ":lua require('telescope.builtin').lsp_implementations()<cr>", "[G]oto [I]mplementation")
map("gd", ":lua require('telescope.builtin').lsp_definitions()<cr>", "[G]oto [D]efinition")
map("gt", ":lua require('telescope.builtin').lsp_type_definitions()<cr>", "[G]oto [T]ype Definition")
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration<cr>")
map("gO", ":lua require('telescope.builtin').lsp_document_symbols()<cr>", "[O]pen Document Symbols")
map("gW", ":lua require('telescope.builtin').lsp_dynamic_workspace_symbols()<cr>", "Open [W]orkspace Symbols")
end,
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>", {
desc = "Debugger: Toggle [B]reakpointn",
})
vim.keymap.set("n", "<leader>x", ":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", "<F5>", ":lua require('dap').continue()<cr>", { desc = "Debugger: Continue 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>", {
desc = "Debugger: Clear all breakpoints",
})

View File

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

View File

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

View File

@@ -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,19 +39,31 @@ 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 \
if nvr --servername "$SOCKET" --remote-expr \
"bufexists(fnamemodify('$FILE', ':p'))" | grep -q 1; then
CMD=":buffer $(basename "$FILE")"
else
@@ -63,13 +74,12 @@ else
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"