Rename options to avoid confusion with module options (#1324)

This commit is contained in:
Matt Sturgeon 2024-03-29 20:58:44 +00:00 committed by GitHub
parent acb917fbf2
commit 4f83bcf290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 33 additions and 43 deletions

View file

@ -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. `:h option-list` from within NeoVim.
All of these are configurable from within NixVim. All you have to do is set the All of these are configurable from within NixVim. All you have to do is set the
`options` attribute: `opts` attribute:
```nix ```nix
{ {
programs.nixvim = { programs.nixvim = {
options = { opts = {
number = true; # Show line numbers number = true; # Show line numbers
relativenumber = true; # Show relative 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 Please note that to, for example, disable numbers you would not set
`options.nonumber` to true, you'd set `options.number` to false. `opts.nonumber` to true, you'd set `opts.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 = {
# ...
};
};
}
```
## Key mappings ## Key mappings
It is fully possible to define key mappings from within NixVim. This is done It is fully possible to define key mappings from within NixVim. This is done

View file

@ -31,7 +31,7 @@
# There is .normal, .insert, .visual, .operator, etc! # There is .normal, .insert, .visual, .operator, etc!
# We can also set options: # We can also set options:
options = { opts = {
tabstop = 4; tabstop = 4;
shiftwidth = 4; shiftwidth = 4;
expandtab = false; expandtab = false;

View file

@ -47,7 +47,7 @@ in {
}; };
config = { config = {
options.clipboard = mkIf (cfg.register != null) cfg.register; opts.clipboard = mkIf (cfg.register != null) cfg.register;
extraPackages = extraPackages =
mapAttrsToList mapAttrsToList

View file

@ -10,7 +10,7 @@
./highlights.nix ./highlights.nix
./keymaps.nix ./keymaps.nix
./lua-loader.nix ./lua-loader.nix
./options.nix ./opts.nix
./output.nix ./output.nix
./plugins.nix ./plugins.nix
./warnings.nix ./warnings.nix

View file

@ -6,21 +6,21 @@
}: }:
with lib; let with lib; let
optionsAttrs = { optionsAttrs = {
options = { opts = {
prettyName = "options"; prettyName = "options";
luaVariableName = "options"; luaVariableName = "options";
luaApi = "opt"; luaApi = "opt";
description = "The configuration options, e.g. line numbers (`vim.opt.*`)"; description = "The configuration options, e.g. line numbers (`vim.opt.*`)";
}; };
globalOptions = { globalOpts = {
prettyName = "global options"; prettyName = "global options";
luaVariableName = "global_options"; luaVariableName = "global_options";
luaApi = "opt_global"; luaApi = "opt_global";
description = "The configuration global options (`vim.opt_global.*`)"; description = "The configuration global options (`vim.opt_global.*`)";
}; };
localOptions = { localOpts = {
prettyName = "local options"; prettyName = "local options";
luaVariableName = "local_options"; luaVariableName = "local_options";
luaApi = "opt_local"; luaApi = "opt_local";
@ -47,6 +47,16 @@ in {
) )
optionsAttrs; optionsAttrs;
# Added 2024-03-29 (do not remove)
imports =
mapAttrsToList
(old: new: mkRenamedOptionModule [old] [new])
{
options = "opts";
globalOptions = "globalOpts";
localOptions = "localOpts";
};
config = { config = {
extraConfigLuaPre = extraConfigLuaPre =
concatLines concatLines

View file

@ -347,7 +347,7 @@ in {
cfg.package cfg.package
nvim-web-devicons nvim-web-devicons
]; ];
options.termguicolors = true; opts.termguicolors = true;
extraConfigLua = '' extraConfigLua = ''
require('bufferline').setup${helpers.toLuaObject setupOptions} require('bufferline').setup${helpers.toLuaObject setupOptions}
''; '';

View file

@ -104,7 +104,7 @@ with lib;
plugins.lualine.theme = mkIf cfg.setUpBar "base16"; plugins.lualine.theme = mkIf cfg.setUpBar "base16";
plugins.lightline.colorscheme = null; plugins.lightline.colorscheme = null;
options.termguicolors = mkDefault true; opts.termguicolors = mkDefault true;
} }
(mkIf (isString cfg.colorscheme) { (mkIf (isString cfg.colorscheme) {
colorscheme = "base16-${cfg.colorscheme}"; colorscheme = "base16-${cfg.colorscheme}";

View file

@ -379,7 +379,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "catppuccin"; colorscheme = "catppuccin";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = {termguicolors = true;}; opts.termguicolors = true;
extraConfigLuaPre = let extraConfigLuaPre = let
setupOptions = with cfg; { setupOptions = with cfg; {
inherit (cfg) flavour background styles integrations; inherit (cfg) flavour background styles integrations;

View file

@ -76,8 +76,6 @@ in {
dracula_colorterm = mkIf (!cfg.colorterm) 0; dracula_colorterm = mkIf (!cfg.colorterm) 0;
}; };
options = { opts.termguicolors = mkDefault true;
termguicolors = mkDefault true;
};
}; };
} }

View file

@ -18,8 +18,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "melange"; colorscheme = "melange";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = { opts.termguicolors = mkDefault true;
termguicolors = mkDefault true;
};
}; };
} }

View file

@ -25,6 +25,6 @@ helpers.vim-plugin.mkVimPlugin config {
}; };
extraConfig = cfg: { extraConfig = cfg: {
options.termguicolors = lib.mkDefault true; opts.termguicolors = lib.mkDefault true;
}; };
} }

View file

@ -20,8 +20,6 @@ in {
colorscheme = "oxocarbon"; colorscheme = "oxocarbon";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = { opts.termguicolors = mkDefault true;
termguicolors = mkDefault true;
};
}; };
} }

View file

@ -35,7 +35,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "rose-pine"; colorscheme = "rose-pine";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = {termguicolors = true;}; opts.termguicolors = true;
extraConfigLuaPre = let extraConfigLuaPre = let
setupOptions = with cfg; { setupOptions = with cfg; {
inherit groups; inherit groups;

View file

@ -70,7 +70,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = "tokyonight"; colorscheme = "tokyonight";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = {termguicolors = true;}; opts.termguicolors = true;
extraConfigLuaPre = let extraConfigLuaPre = let
setupOptions = with cfg; { setupOptions = with cfg; {
inherit (cfg) style transparent styles sidebars; inherit (cfg) style transparent styles sidebars;

View file

@ -182,7 +182,7 @@ in {
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
options = mkIf cfg.recommendedSettings { opts = mkIf cfg.recommendedSettings {
updatetime = 100; updatetime = 100;
foldtext = "gitgutter#fold#foldtext"; foldtext = "gitgutter#fold#foldtext";
}; };

View file

@ -220,7 +220,7 @@ in {
] ]
++ optional (cfg.gccPackage != null) cfg.gccPackage; ++ optional (cfg.gccPackage != null) cfg.gccPackage;
options = mkIf cfg.folding { opts = mkIf cfg.folding {
foldmethod = "expr"; foldmethod = "expr";
foldexpr = "nvim_treesitter#foldexpr()"; foldexpr = "nvim_treesitter#foldexpr()";
}; };

View file

@ -1,7 +1,7 @@
{ {
after = { after = {
files."after/ftplugin/python.lua" = { files."after/ftplugin/python.lua" = {
localOptions.conceallevel = 1; localOpts.conceallevel = 1;
keymaps = [ keymaps = [
{ {

View file

@ -11,12 +11,12 @@
mousemodel = "extend"; # Mouse right-click extends the current selection mousemodel = "extend"; # Mouse right-click extends the current selection
}; };
localOptions = { localOpts = {
textwidth = 80; textwidth = 80;
sidescrolloff = 0; sidescrolloff = 0;
}; };
globalOptions = { globalOpts = {
textwidth = 110; textwidth = 110;
sidescrolloff = 10; sidescrolloff = 10;
}; };