diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 8c06cfcf..16bc1cf0 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -1,26 +1,8 @@ # Release 0.9 {#sec-release-0-9} -## Breaking changes - -- Nixpkgs merged a full and incompatible rewrite of vimPlugins.nvim-treesitter. - The changes affected how grammars are built and it caused issues when neovim - attempted to load languages and could not find files in expected locations. - ## Changelog {#sec-release-0-9-changelog} [suimong](https://github.com/suimong): - Fix `vim.tabline.nvimBufferline` where `setupOpts.options.hover` requires `vim.opt.mousemoveevent` to be set. - -[thamenato](https://github.com/thamenato): - -- Attempt to adapt nvim-treesitter to (breaking) Nixpkgs changes. Some treesitte grammars - were changed to prefer `grammarPlugins` over `builtGrammars`. - -[jfeo](https://github.com/jfeo): - -[ccc.nvim]: https://github.com/uga-rosa/ccc.nvim - -- Added [ccc.nvim] option {option}`vim.utility.ccc.setupOpts` with the existing - hard-coded options as default values. diff --git a/flake.lock b/flake.lock index 0b4c58d5..9f6d599a 100644 --- a/flake.lock +++ b/flake.lock @@ -73,11 +73,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1767364772, - "narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=", + "lastModified": 1764081664, + "narHash": "sha256-sUoHmPr/EwXzRMpv1u/kH+dXuvJEyyF2Q7muE+t0EU4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa", + "rev": "dc205f7b4fdb04c8b7877b43edb7b73be7730081", "type": "github" }, "original": { diff --git a/lib/types/languages.nix b/lib/types/languages.nix index 45515f55..b1865c41 100644 --- a/lib/types/languages.nix +++ b/lib/types/languages.nix @@ -30,7 +30,7 @@ mkGrammarOption = pkgs: grammar: mkPackageOption pkgs ["${grammar} treesitter"] { - default = ["vimPlugins" "nvim-treesitter" "grammarPlugins" grammar]; + default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar]; }; in { inherit diagnostics diagnosticSubmodule mkGrammarOption; diff --git a/modules/plugins/languages/csharp.nix b/modules/plugins/languages/csharp.nix index ef973301..20e5bd72 100644 --- a/modules/plugins/languages/csharp.nix +++ b/modules/plugins/languages/csharp.nix @@ -178,7 +178,7 @@ in { treesitter = { enable = mkEnableOption "C# treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = mkGrammarOption pkgs "c_sharp"; + package = mkGrammarOption pkgs "c-sharp"; }; lsp = { diff --git a/modules/plugins/languages/markdown.nix b/modules/plugins/languages/markdown.nix index feb3f2a5..59615cec 100644 --- a/modules/plugins/languages/markdown.nix +++ b/modules/plugins/languages/markdown.nix @@ -63,7 +63,7 @@ in { description = "Enable Markdown treesitter"; }; mdPackage = mkGrammarOption pkgs "markdown"; - mdInlinePackage = mkGrammarOption pkgs "markdown_inline"; + mdInlinePackage = mkGrammarOption pkgs "markdown-inline"; }; lsp = { diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 9cfb82f6..b1cbe224 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -228,7 +228,7 @@ in { package = mkOption { description = "Python treesitter grammar to use"; type = package; - default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.python; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python; }; }; diff --git a/modules/plugins/languages/sql.nix b/modules/plugins/languages/sql.nix index e5787e43..e3e686ec 100644 --- a/modules/plugins/languages/sql.nix +++ b/modules/plugins/languages/sql.nix @@ -66,7 +66,7 @@ in { package = mkOption { type = package; - default = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.sql; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql; description = "SQL treesitter grammar to use"; }; }; diff --git a/modules/plugins/notes/orgmode/config.nix b/modules/plugins/notes/orgmode/config.nix index 19b47aa1..3f1b7eaf 100644 --- a/modules/plugins/notes/orgmode/config.nix +++ b/modules/plugins/notes/orgmode/config.nix @@ -21,7 +21,7 @@ in { pluginRC.orgmode = entryAnywhere '' -- Treesitter configuration - require('nvim-treesitter.config').setup { + require('nvim-treesitter.configs').setup { -- If TS highlights are not enabled at all, or disabled via `disable` prop, -- highlighting will fallback to default Vim syntax highlighting diff --git a/modules/plugins/treesitter/config.nix b/modules/plugins/treesitter/config.nix index d10e1e89..f7955110 100644 --- a/modules/plugins/treesitter/config.nix +++ b/modules/plugins/treesitter/config.nix @@ -52,7 +52,7 @@ in { ''); pluginRC.treesitter = entryAfter ["basic"] '' - require('nvim-treesitter.config').setup { + require('nvim-treesitter.configs').setup { -- Disable imperative treesitter options that would attempt to fetch -- grammars into the read-only Nix store. To add additional grammars here -- you must use the `config.vim.treesitter.grammars` option. diff --git a/modules/plugins/treesitter/treesitter.nix b/modules/plugins/treesitter/treesitter.nix index cf1c5375..d761d6b3 100644 --- a/modules/plugins/treesitter/treesitter.nix +++ b/modules/plugins/treesitter/treesitter.nix @@ -25,14 +25,14 @@ in { type = listOf package; default = []; example = literalExpression '' - with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [ + with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ regex kdl ]; ''; description = '' List of treesitter grammars to install. For grammars to be installed properly, - you must use grammars from `pkgs.vimPlugins.nvim-treesitter.grammarPlugins`. + you must use grammars from `pkgs.vimPlugins.nvim-treesitter.builtGrammars`. You can use `pkgs.vimPlugins.nvim-treesitter.allGrammars` to install all grammars. For languages already supported by nvf, you may use @@ -56,7 +56,7 @@ in { internal = true; readOnly = true; type = listOf package; - default = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [c lua vim vimdoc query]; + default = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [c lua vim vimdoc query]; description = '' A list of treesitter grammars that will be installed by default if treesitter has been enabled and {option}`vim.treeesitter.addDefaultGrammars` diff --git a/modules/plugins/treesitter/ts-textobjects/config.nix b/modules/plugins/treesitter/ts-textobjects/config.nix index 511ebdce..7a9239d1 100644 --- a/modules/plugins/treesitter/ts-textobjects/config.nix +++ b/modules/plugins/treesitter/ts-textobjects/config.nix @@ -16,7 +16,7 @@ in { # set up treesitter-textobjects after Treesitter, whose config we're adding to. pluginRC.treesitter-textobjects = entryAfter ["treesitter"] '' - require("nvim-treesitter.config").setup({textobjects = ${toLuaObject cfg.setupOpts}}) + require("nvim-treesitter.configs").setup({textobjects = ${toLuaObject cfg.setupOpts}}) ''; }; }; diff --git a/modules/plugins/ui/noice/config.nix b/modules/plugins/ui/noice/config.nix index 1f81f4a9..fe82f588 100644 --- a/modules/plugins/ui/noice/config.nix +++ b/modules/plugins/ui/noice/config.nix @@ -12,7 +12,7 @@ cfg = config.vim.ui.noice; tscfg = config.vim.treesitter; - defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.grammarPlugins; [vim regex lua bash markdown]; + defaultGrammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [vim regex lua bash markdown]; in { config = mkIf cfg.enable { vim = { diff --git a/modules/plugins/utility/ccc/ccc.nix b/modules/plugins/utility/ccc/ccc.nix index 99c169fb..f900b531 100644 --- a/modules/plugins/utility/ccc/ccc.nix +++ b/modules/plugins/utility/ccc/ccc.nix @@ -1,148 +1,10 @@ {lib, ...}: let - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) anything attrsOf listOf enum; + inherit (lib.options) mkEnableOption; inherit (lib.nvim.binds) mkMappingOption; - inherit (lib.nvim.types) mkPluginSetupOption luaInline; - inherit (lib.generators) mkLuaInline; in { options.vim.utility.ccc = { enable = mkEnableOption "ccc color picker for neovim"; - setupOpts = mkPluginSetupOption "ccc.nvim" { - highlighter = mkOption { - type = attrsOf anything; - default = { - auto_enable = true; - max_byte = 2 * 1024 * 1024; # 2mb - lsp = true; - filetypes = mkLuaInline "colorPickerFts"; - }; - description = '' - Settings for the highlighter. See {command}`:help ccc` for options. - ''; - }; - - pickers = mkOption { - type = listOf luaInline; - default = map mkLuaInline [ - "ccc.picker.hex" - "ccc.picker.css_rgb" - "ccc.picker.css_hsl" - "ccc.picker.ansi_escape { meaning1 = \"bold\", }" - ]; - description = '' - List of formats that can be detected by {command}`:CccPick` to be - activated. - - Must be inline lua references to `ccc.picker`, for example - `mkLuaInline "ccc.picker.hex"`. See {command}`:help ccc` for options. - ''; - }; - - alpha_show = mkOption { - type = enum [ - "show" - "hide" - "auto" - ]; - default = "hide"; - description = '' - This option determines whether the alpha slider is displayed when the - UI is opened. "show" and "hide" mean as they are. "auto" makes the - slider appear only when the alpha value can be picked up. - ''; - }; - - recognize = mkOption { - type = attrsOf anything; - default = { - output = true; - }; - description = '' - Settings for recognizing the color format. See {command}`:help ccc` for options. - ''; - }; - - inputs = mkOption { - type = listOf luaInline; - default = map mkLuaInline ["ccc.input.hsl"]; - description = '' - List of color systems to be activated. Must be inline lua references to - `ccc.input`, for example `mkLuaInline "ccc.input.rgb"`. See - {command}`:help ccc` for options. - - The toggle input mode action toggles in this order. The first one is - the default used at the first startup. Once activated, it will keep the - previous input mode. - ''; - }; - - outputs = mkOption { - type = listOf luaInline; - default = map mkLuaInline [ - "ccc.output.css_hsl" - "ccc.output.css_rgb" - "ccc.output.hex" - ]; - description = '' - List of output formats to be activated. Must be inline Lua references to - `ccc.output`, for example `mkLuaInline "ccc.output.rgb"`. See - {command}`:help ccc` for options. - - The toggle output mode action toggles in this order. The first one is - the default used at the first startup. Once activated, it will keep the - previous output mode. - ''; - }; - - convert = mkOption { - type = listOf (listOf luaInline); - default = map (map mkLuaInline) [ - [ - "ccc.picker.hex" - "ccc.output.css_hsl" - ] - [ - "ccc.picker.css_rgb" - "ccc.output.css_hsl" - ] - [ - "ccc.picker.css_hsl" - "ccc.output.hex" - ] - ]; - description = '' - Specify the correspondence between picker and output. Must be a list of - two-element lists defining picker/output pairs as inline Lua references, - for example: - - ```nix - map (map mkLuaInline) [ - ["ccc.picker.hex", "ccc.output.css_rgb"] - ["ccc.picker.css_rgb", "ccc.output.hex"] - ]; - ``` - - See {command}`:help ccc` for options. - ''; - }; - - mappings = mkOption { - type = attrsOf luaInline; - default = { - "q" = mkLuaInline "ccc.mapping.quit"; - "L" = mkLuaInline "ccc.mapping.increase10"; - "H" = mkLuaInline "ccc.mapping.decrease10"; - }; - description = '' - The mappings are set in the UI of ccc. The table where lhs is key and - rhs is value. To disable all default mappings, use - {option}`vim.utility.ccc.setupOpts.disable_default_mappings`. To - disable only some of the default mappings, set `ccc.mapping.none`. - ''; - }; - }; - mappings = { quit = mkMappingOption "Cancel and close the UI without replace or insert" ""; increase10 = mkMappingOption "Increase the value times delta of the slider" ""; diff --git a/modules/plugins/utility/ccc/config.nix b/modules/plugins/utility/ccc/config.nix index e0654ceb..33948562 100644 --- a/modules/plugins/utility/ccc/config.nix +++ b/modules/plugins/utility/ccc/config.nix @@ -5,7 +5,7 @@ }: let inherit (lib.modules) mkIf; inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; + cfg = config.vim.utility.ccc; in { config = mkIf cfg.enable { @@ -13,7 +13,40 @@ in { vim.pluginRC.ccc = entryAnywhere '' local ccc = require("ccc") - ccc.setup(${toLuaObject cfg.setupOpts}) + ccc.setup { + highlighter = { + auto_enable = true, + max_byte = 2 * 1024 * 1024, -- 2mb + lsp = true, + filetypes = colorPickerFts, + }, + pickers = { + ccc.picker.hex, + ccc.picker.css_rgb, + ccc.picker.css_hsl, + ccc.picker.ansi_escape { + meaning1 = "bright", -- whether the 1 means bright or yellow + }, + }, + alpha_show = "hide", -- needed when highlighter.lsp is set to true + recognize = { output = true }, -- automatically recognize color format under cursor + inputs = { ccc.input.hsl }, + outputs = { + ccc.output.css_hsl, + ccc.output.css_rgb, + ccc.output.hex, + }, + convert = { + { ccc.picker.hex, ccc.output.css_hsl }, + { ccc.picker.css_rgb, ccc.output.css_hsl }, + { ccc.picker.css_hsl, ccc.output.hex }, + }, + mappings = { + ["q"] = ccc.mapping.quit, + ["L"] = ccc.mapping.increase10, + ["H"] = ccc.mapping.decrease10, + }, + } ''; }; }