diff --git a/README.md b/README.md index eef8c36a..96a0e117 100644 --- a/README.md +++ b/README.md @@ -307,12 +307,12 @@ NeoVim has a lot of configuration options. You can find a list of them by doing `:h option-list` from within NeoVim. All of these are configurable from within NixVim. All you have to do is set the -`options` attribute: +`opts` attribute: ```nix { programs.nixvim = { - options = { + opts = { number = true; # Show line numbers relativenumber = true; # Show relative line numbers @@ -323,21 +323,7 @@ All of these are configurable from within NixVim. All you have to do is set the ``` Please note that to, for example, disable numbers you would not set -`options.nonumber` to true, you'd set `options.number` to false. - -### Caveats - -If you are using `makeNixvimWithModule`, then options are treated as options for a module. To get around this, just wrap the options in a `config` set. - -```nix -{ - config = { - options = { - # ... - }; - }; -} -``` +`opts.nonumber` to true, you'd set `opts.number` to false. ## Key mappings It is fully possible to define key mappings from within NixVim. This is done diff --git a/example.nix b/example.nix index 692fb50a..94039be0 100644 --- a/example.nix +++ b/example.nix @@ -31,7 +31,7 @@ # There is .normal, .insert, .visual, .operator, etc! # We can also set options: - options = { + opts = { tabstop = 4; shiftwidth = 4; expandtab = false; diff --git a/modules/clipboard.nix b/modules/clipboard.nix index 685c5125..641eaa5c 100644 --- a/modules/clipboard.nix +++ b/modules/clipboard.nix @@ -47,7 +47,7 @@ in { }; config = { - options.clipboard = mkIf (cfg.register != null) cfg.register; + opts.clipboard = mkIf (cfg.register != null) cfg.register; extraPackages = mapAttrsToList diff --git a/modules/default.nix b/modules/default.nix index 00ab30dd..073db594 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -10,7 +10,7 @@ ./highlights.nix ./keymaps.nix ./lua-loader.nix - ./options.nix + ./opts.nix ./output.nix ./plugins.nix ./warnings.nix diff --git a/modules/options.nix b/modules/opts.nix similarity index 86% rename from modules/options.nix rename to modules/opts.nix index bb6b3a68..286805f8 100644 --- a/modules/options.nix +++ b/modules/opts.nix @@ -6,21 +6,21 @@ }: with lib; let optionsAttrs = { - options = { + opts = { prettyName = "options"; luaVariableName = "options"; luaApi = "opt"; description = "The configuration options, e.g. line numbers (`vim.opt.*`)"; }; - globalOptions = { + globalOpts = { prettyName = "global options"; luaVariableName = "global_options"; luaApi = "opt_global"; description = "The configuration global options (`vim.opt_global.*`)"; }; - localOptions = { + localOpts = { prettyName = "local options"; luaVariableName = "local_options"; luaApi = "opt_local"; @@ -47,6 +47,16 @@ in { ) optionsAttrs; + # Added 2024-03-29 (do not remove) + imports = + mapAttrsToList + (old: new: mkRenamedOptionModule [old] [new]) + { + options = "opts"; + globalOptions = "globalOpts"; + localOptions = "localOpts"; + }; + config = { extraConfigLuaPre = concatLines diff --git a/plugins/bufferlines/bufferline.nix b/plugins/bufferlines/bufferline.nix index 5f114b32..270c7df5 100644 --- a/plugins/bufferlines/bufferline.nix +++ b/plugins/bufferlines/bufferline.nix @@ -347,7 +347,7 @@ in { cfg.package nvim-web-devicons ]; - options.termguicolors = true; + opts.termguicolors = true; extraConfigLua = '' require('bufferline').setup${helpers.toLuaObject setupOptions} ''; diff --git a/plugins/colorschemes/base16/default.nix b/plugins/colorschemes/base16/default.nix index 58c372f3..72527f56 100644 --- a/plugins/colorschemes/base16/default.nix +++ b/plugins/colorschemes/base16/default.nix @@ -104,7 +104,7 @@ with lib; plugins.lualine.theme = mkIf cfg.setUpBar "base16"; plugins.lightline.colorscheme = null; - options.termguicolors = mkDefault true; + opts.termguicolors = mkDefault true; } (mkIf (isString cfg.colorscheme) { colorscheme = "base16-${cfg.colorscheme}"; diff --git a/plugins/colorschemes/catppuccin.nix b/plugins/colorschemes/catppuccin.nix index 41be28ac..7e7c8b9c 100644 --- a/plugins/colorschemes/catppuccin.nix +++ b/plugins/colorschemes/catppuccin.nix @@ -379,7 +379,7 @@ in { config = mkIf cfg.enable { colorscheme = "catppuccin"; extraPlugins = [cfg.package]; - options = {termguicolors = true;}; + opts.termguicolors = true; extraConfigLuaPre = let setupOptions = with cfg; { inherit (cfg) flavour background styles integrations; diff --git a/plugins/colorschemes/dracula.nix b/plugins/colorschemes/dracula.nix index d0cfcee3..be79ac47 100644 --- a/plugins/colorschemes/dracula.nix +++ b/plugins/colorschemes/dracula.nix @@ -76,8 +76,6 @@ in { dracula_colorterm = mkIf (!cfg.colorterm) 0; }; - options = { - termguicolors = mkDefault true; - }; + opts.termguicolors = mkDefault true; }; } diff --git a/plugins/colorschemes/melange.nix b/plugins/colorschemes/melange.nix index 908dbf18..5db7f6c5 100644 --- a/plugins/colorschemes/melange.nix +++ b/plugins/colorschemes/melange.nix @@ -18,8 +18,6 @@ in { config = mkIf cfg.enable { colorscheme = "melange"; extraPlugins = [cfg.package]; - options = { - termguicolors = mkDefault true; - }; + opts.termguicolors = mkDefault true; }; } diff --git a/plugins/colorschemes/one.nix b/plugins/colorschemes/one.nix index 938985df..00dfd3fc 100644 --- a/plugins/colorschemes/one.nix +++ b/plugins/colorschemes/one.nix @@ -25,6 +25,6 @@ helpers.vim-plugin.mkVimPlugin config { }; extraConfig = cfg: { - options.termguicolors = lib.mkDefault true; + opts.termguicolors = lib.mkDefault true; }; } diff --git a/plugins/colorschemes/oxocarbon.nix b/plugins/colorschemes/oxocarbon.nix index ace813a8..4f3b4004 100644 --- a/plugins/colorschemes/oxocarbon.nix +++ b/plugins/colorschemes/oxocarbon.nix @@ -20,8 +20,6 @@ in { colorscheme = "oxocarbon"; extraPlugins = [cfg.package]; - options = { - termguicolors = mkDefault true; - }; + opts.termguicolors = mkDefault true; }; } diff --git a/plugins/colorschemes/rose-pine.nix b/plugins/colorschemes/rose-pine.nix index 7136314a..9954cac6 100644 --- a/plugins/colorschemes/rose-pine.nix +++ b/plugins/colorschemes/rose-pine.nix @@ -35,7 +35,7 @@ in { config = mkIf cfg.enable { colorscheme = "rose-pine"; extraPlugins = [cfg.package]; - options = {termguicolors = true;}; + opts.termguicolors = true; extraConfigLuaPre = let setupOptions = with cfg; { inherit groups; diff --git a/plugins/colorschemes/tokyonight.nix b/plugins/colorschemes/tokyonight.nix index ec5227a6..21e9e102 100644 --- a/plugins/colorschemes/tokyonight.nix +++ b/plugins/colorschemes/tokyonight.nix @@ -70,7 +70,7 @@ in { config = mkIf cfg.enable { colorscheme = "tokyonight"; extraPlugins = [cfg.package]; - options = {termguicolors = true;}; + opts.termguicolors = true; extraConfigLuaPre = let setupOptions = with cfg; { inherit (cfg) style transparent styles sidebars; diff --git a/plugins/git/gitgutter.nix b/plugins/git/gitgutter.nix index c0057d82..52a9ee5c 100644 --- a/plugins/git/gitgutter.nix +++ b/plugins/git/gitgutter.nix @@ -182,7 +182,7 @@ in { mkIf cfg.enable { extraPlugins = [cfg.package]; - options = mkIf cfg.recommendedSettings { + opts = mkIf cfg.recommendedSettings { updatetime = 100; foldtext = "gitgutter#fold#foldtext"; }; diff --git a/plugins/languages/treesitter/treesitter.nix b/plugins/languages/treesitter/treesitter.nix index 3cf3365b..1dfbd182 100644 --- a/plugins/languages/treesitter/treesitter.nix +++ b/plugins/languages/treesitter/treesitter.nix @@ -220,7 +220,7 @@ in { ] ++ optional (cfg.gccPackage != null) cfg.gccPackage; - options = mkIf cfg.folding { + opts = mkIf cfg.folding { foldmethod = "expr"; foldexpr = "nvim_treesitter#foldexpr()"; }; diff --git a/tests/modules/files.nix b/tests/modules/files.nix index 6ee3cbc3..74125cca 100644 --- a/tests/modules/files.nix +++ b/tests/modules/files.nix @@ -1,7 +1,7 @@ { after = { files."after/ftplugin/python.lua" = { - localOptions.conceallevel = 1; + localOpts.conceallevel = 1; keymaps = [ { diff --git a/tests/test-sources/modules/options.nix b/tests/test-sources/modules/options.nix index 9595a89a..c6eddbf8 100644 --- a/tests/test-sources/modules/options.nix +++ b/tests/test-sources/modules/options.nix @@ -11,12 +11,12 @@ mousemodel = "extend"; # Mouse right-click extends the current selection }; - localOptions = { + localOpts = { textwidth = 80; sidescrolloff = 0; }; - globalOptions = { + globalOpts = { textwidth = 110; sidescrolloff = 10; };