diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 0d607f9..51e05c9 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -4,6 +4,8 @@ Release notes for release 0.7 ## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide-0-7} +### `vim.configRC` removed {#sec-vim-configrc-removed} + In v0.7 we are removing `vim.configRC` in favor of making `vim.luaConfigRC` the top-level DAG, and thereby making the entire configuration Lua based. This change introduces a few breaking changes: @@ -24,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"; + ... +}; +``` + ## Changelog {#sec-release-0.7-changelog} [ItsSorae](https://github.com/ItsSorae): @@ -114,6 +138,8 @@ configuration formats. 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 diff --git a/modules/neovim/mappings/config.nix b/modules/neovim/mappings/config.nix index 28ebf08..365e124 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 3b1f263..522079e 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -1,41 +1,48 @@ {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