diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 0be6ef39..e030735f 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -26,6 +26,28 @@ making good use of its extensive Lua API. Additionally, Vimscript is slow and brings unnecessary performance overhead while working with different configuration formats. +### `vim.maps` rewrite {#sec-vim-maps-rewrite} + +Instead of specifying map modes using submodules (eg.: `vim.maps.normal`), a new +`mode` option has mode has been introduced. It can be either a string, or a list +of strings, where a string represents the short-name of the map mode(s), that +the mapping should be set for. See `:help map-modes` for more information. + +For example: + +```nix +vim.maps.normal."m" = { ... }; +``` + +has to be replaced by + +```nix +vim.maps."m" = { + mode = "n"; + ... +}; +``` + ### `vim.lsp.nvimCodeActionMenu` removed in favor of `vim.ui.fastaction` {#sec-nvim-code-action-menu-deprecation} The nvim-code-action-menu plugin has been archived and broken for a long time, @@ -37,6 +59,7 @@ Note that we are looking to add more alternatives in the future like dressing.nvim and actions-preview.nvim, in case fastaction doesn't work for everyone. + ## Changelog {#sec-release-0.7-changelog} [ItsSorae](https://github.com/ItsSorae): @@ -135,6 +158,8 @@ everyone. has been introduced for setting up internal plugins. See the "DAG entries in nvf" manual page for more information. +- Rewrite `vim.maps`, see the breaking changes section above. + [NotAShelf](https://github.com/notashelf): [ts-error-translator.nvim]: https://github.com/dmmulroy/ts-error-translator.nvim @@ -211,3 +236,8 @@ everyone. - Add LSP and Treesitter support for R under `vim.languages.R`. - Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with ccc + +[Bloxx12](https://github.com/Bloxx12) + +- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under + `vim.theme` diff --git a/flake.lock b/flake.lock index 7775fb1f..bc0859d7 100644 --- a/flake.lock +++ b/flake.lock @@ -172,6 +172,22 @@ "type": "github" } }, + "plugin-base16": { + "flake": false, + "locked": { + "lastModified": 1716483968, + "narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=", + "owner": "rrethy", + "repo": "base16-nvim", + "rev": "6ac181b5733518040a33017dde654059cd771b7c", + "type": "github" + }, + "original": { + "owner": "rrethy", + "repo": "base16-nvim", + "type": "github" + } + }, "plugin-bufdelete-nvim": { "flake": false, "locked": { @@ -1802,6 +1818,7 @@ "nixpkgs": "nixpkgs", "nmd": "nmd", "plugin-alpha-nvim": "plugin-alpha-nvim", + "plugin-base16": "plugin-base16", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-catppuccin": "plugin-catppuccin", "plugin-ccc": "plugin-ccc", diff --git a/flake.nix b/flake.nix index 987e3e59..c4a1a2a8 100644 --- a/flake.nix +++ b/flake.nix @@ -349,6 +349,11 @@ }; # Themes + plugin-base16 = { + url = "github:rrethy/base16-nvim"; + flake = false; + }; + plugin-tokyonight = { url = "github:folke/tokyonight.nvim"; flake = false; diff --git a/lib/types/default.nix b/lib/types/default.nix index 6751229c..70ca6bef 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -6,10 +6,10 @@ typesDag = import ./dag.nix {inherit lib;}; typesPlugin = import ./plugins.nix {inherit inputs lib;}; typesLanguage = import ./languages.nix {inherit lib;}; - typesCustom = import ./custom.nix {inherit lib;}; + typesTypes = import ./types.nix {inherit lib;}; in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType; inherit (typesLanguage) diagnostics mkGrammarOption; - inherit (typesCustom) anythingConcatLists char; + inherit (typesTypes) anythingConcatLists char hexColor; } diff --git a/lib/types/custom.nix b/lib/types/types.nix similarity index 90% rename from lib/types/custom.nix rename to lib/types/types.nix index a94735c5..250d7636 100644 --- a/lib/types/custom.nix +++ b/lib/types/types.nix @@ -1,8 +1,9 @@ {lib}: let inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType; + inherit (lib.strings) isString; inherit (lib.types) anything attrsOf; inherit (lib.nvim.types) anythingConcatLists; - inherit (builtins) typeOf isAttrs any head concatLists stringLength; + inherit (builtins) typeOf isAttrs any head concatLists stringLength match; in { # HACK: Does this break anything in our case? # A modified version of the nixpkgs anything type that concatenates lists @@ -58,4 +59,11 @@ in { check = value: stringLength value < 2; merge = mergeEqualOption; }; + + hexColor = mkOptionType { + name = "hex-color"; + descriptionClass = "noun"; + description = "RGB color in hex format"; + check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null; + }; } diff --git a/modules/neovim/mappings/config.nix b/modules/neovim/mappings/config.nix index 28ebf081..365e1242 100644 --- a/modules/neovim/mappings/config.nix +++ b/modules/neovim/mappings/config.nix @@ -8,45 +8,26 @@ cfg = config.vim; in { config = { - vim.maps = { - normal = mkIf cfg.disableArrows { - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; + vim.maps = mkIf cfg.disableArrows { + "" = { + mode = ["n" "i"]; + action = ""; + noremap = false; }; - - insert = mkIf cfg.disableArrows { - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; + "" = { + mode = ["n" "i"]; + action = ""; + noremap = false; + }; + "" = { + mode = ["n" "i"]; + action = ""; + noremap = false; + }; + "" = { + mode = ["n" "i"]; + action = ""; + noremap = false; }; }; }; diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index 3b1f2634..f4229916 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -1,61 +1,52 @@ {lib, ...}: let inherit (lib.options) mkOption; - inherit (lib.types) bool str attrsOf nullOr submodule; + inherit (lib.types) either str listOf attrsOf nullOr submodule bool; inherit (lib.nvim.config) mkBool; - # Most of the keybindings code is highly inspired by pta2002/nixvim. - # Thank you! + mapConfigOptions = { - silent = - mkBool false - "Whether this mapping should be silent. Equivalent to adding to a map."; - - nowait = - mkBool false - "Whether to wait for extra input on ambiguous mappings. Equivalent to adding to a map."; - - script = - mkBool false - "Equivalent to adding