From 54476b5a8bea713eb0480b4f3a66478cc15ef813 Mon Sep 17 00:00:00 2001 From: Ben Mayer <90480641+Libadoxon@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:50:26 +0100 Subject: [PATCH 1/3] languages/go: add gofmt, golines and gofumpt formatter (#654) --- docs/release-notes/rl-0.8.md | 1 + modules/plugins/languages/go.nix | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 621e976f..63be2209 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -170,3 +170,4 @@ [Libadoxon](https://github.com/Libadoxon) - Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for resolving git conflicts +- Add formatters for go: [gofmt](https://go.dev/blog/gofmt), [golines](https://github.com/segmentio/golines) and [gofumpt](https://github.com/mvdan/gofumpt) diff --git a/modules/plugins/languages/go.nix b/modules/plugins/languages/go.nix index e0eded0d..3ac9ae77 100644 --- a/modules/plugins/languages/go.nix +++ b/modules/plugins/languages/go.nix @@ -34,6 +34,43 @@ }; }; + defaultFormat = "gofmt"; + formats = { + gofmt = { + package = pkgs.go; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.gofmt.with({ + command = "${cfg.format.package}/bin/gofmt", + }) + ) + ''; + }; + gofumpt = { + package = pkgs.gofumpt; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.gofumpt.with({ + command = "${cfg.format.package}/bin/gofumpt", + }) + ) + ''; + }; + golines = { + package = pkgs.golines; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.golines.with({ + command = "${cfg.format.package}/bin/golines", + }) + ) + ''; + }; + }; + defaultDebugger = "delve"; debuggers = { delve = { @@ -67,6 +104,22 @@ in { }; }; + format = { + enable = mkEnableOption "Go formatting" // {default = config.vim.languages.enableFormat;}; + + type = mkOption { + description = "Go formatter to use"; + type = enum (attrNames formats); + default = defaultFormat; + }; + + package = mkOption { + description = "Go formatter package"; + type = package; + default = formats.${cfg.format.type}.package; + }; + }; + dap = { enable = mkOption { description = "Enable Go Debug Adapter via nvim-dap-go plugin"; @@ -99,6 +152,11 @@ in { vim.lsp.lspconfig.sources.go-lsp = servers.${cfg.lsp.server}.lspConfig; }) + (mkIf cfg.format.enable { + vim.lsp.null-ls.enable = true; + vim.lsp.null-ls.sources.go-format = formats.${cfg.format.type}.nullConfig; + }) + (mkIf cfg.dap.enable { vim = { startPlugins = ["nvim-dap-go"]; From 4aac51ec19fef16703bc6f3c27f2482071025b12 Mon Sep 17 00:00:00 2001 From: MaxMur <31189199+TheMaxMur@users.noreply.github.com> Date: Fri, 21 Feb 2025 16:29:45 +0300 Subject: [PATCH 2/3] languages/flutter: Update pin name for match (#658) --- modules/wrapper/build/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index 1f14b3a6..d145f798 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -45,7 +45,7 @@ pluginBuilders = { nvim-treesitter = buildTreesitterPlug config.vim.treesitter.grammars; flutter-tools-patched = buildPlug { - pname = "flutter-tools"; + pname = "flutter-tools-nvim"; patches = [./patches/flutter-tools.patch]; # Disable failing require check hook checks From 5fbc72d697e53c8d4ff3cb8b7bbc60b6c96ffd02 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Fri, 21 Feb 2025 14:44:05 +0100 Subject: [PATCH 3/3] git/git-conflict: avoid shadowing builtin keybinds (#651) * git/git-conflict: avoid shadowing builtin keybinds * docs: update release notes --------- Co-authored-by: raf --- docs/release-notes/rl-0.8.md | 5 +++++ modules/plugins/git/git-conflict/git-conflict.nix | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 63be2209..93e93e8d 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -1,5 +1,10 @@ # Release 0.8 {#sec-release-0.8} +## Breaking changes + +- `git-conflict` keybinds are now prefixed with `` to avoid conflicting + with builtins + [NotAShelf](https://github.com/notashelf): [typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim diff --git a/modules/plugins/git/git-conflict/git-conflict.nix b/modules/plugins/git/git-conflict/git-conflict.nix index bffb926c..44ab79c5 100644 --- a/modules/plugins/git/git-conflict/git-conflict.nix +++ b/modules/plugins/git/git-conflict/git-conflict.nix @@ -12,10 +12,10 @@ in { setupOpts = mkPluginSetupOption "git-conflict" {}; mappings = { - ours = mkMappingOption "Choose Ours [Git-Conflict]" "co"; - theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "ct"; - both = mkMappingOption "Choose Both [Git-Conflict]" "cb"; - none = mkMappingOption "Choose None [Git-Conflict]" "c0"; + ours = mkMappingOption "Choose Ours [Git-Conflict]" "co"; + theirs = mkMappingOption "Choose Theirs [Git-Conflict]" "ct"; + both = mkMappingOption "Choose Both [Git-Conflict]" "cb"; + none = mkMappingOption "Choose None [Git-Conflict]" "c0"; prevConflict = mkMappingOption "Go to the previous Conflict [Git-Conflict]" "]x"; nextConflict = mkMappingOption "Go to the next Conflict [Git-Conflict]" "[x"; };