From 21aa2096e60bf5a8adf8b9427ba77e9985e64b00 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 20 Apr 2024 02:24:02 +0200 Subject: [PATCH 1/5] docs: explain setupOpts --- lib/types/plugins.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 1ac74a6..1ffb330 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -90,7 +90,7 @@ in { */ mkPluginSetupOption = pluginName: opts: mkOption { - description = "Option table to pass into the setup function of " + pluginName; + description = "Option table to pass into the setup function of " + pluginName + ". You can pass in any additional options even if they're not listed in the docs"; default = {}; type = submodule { freeformType = attrsOf anything; From 685176e94a21fefb22774019dace28c7c5da7bc1 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 20 Apr 2024 02:53:59 +0200 Subject: [PATCH 2/5] docs: crude migration guide --- docs/release-notes/rl-0.6.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/docs/release-notes/rl-0.6.md b/docs/release-notes/rl-0.6.md index 50a95cd..28a4cfd 100644 --- a/docs/release-notes/rl-0.6.md +++ b/docs/release-notes/rl-0.6.md @@ -2,6 +2,41 @@ Release notes for release 0.6 +## Breaking Changes and Migration Guide + +In v0.6 we are introducing `setupOpts`: many plugin related options are moved into their respective `setupOpts` +submodule, e.g. `nvimTree.disableNetrw` is renamed to `nvimTree.setupOpts.disable_netrw`. + +_Why?_ in short, you can now pass in anything to setupOpts and it will be passed to your `require'plugin'.setup{...}`. +No need to wait for us to support every single plugin option. + +The warnings when you rebuild your config should be enough to guide you through what you need to do, if there's an +option that was renamed but wasn't listed in the warning, please file a bug report! + +To make your migration process less annoying, here's a keybind that will help you with renaming stuff from camelCase to +snake_case (you'll be doing that a lot): + +```lua +-- paste this in a temp.lua file and load it in vim with :source /path/to/temp.lua +function camelToSnake() + -- Get the current word under the cursor + local word = vim.fn.expand("") + -- Replace each capital letter with an underscore followed by its lowercase equivalent + local snakeCase = string.gsub(word, "%u", function(match) + return "_" .. string.lower(match) + end) + -- Remove the leading underscore if present + if string.sub(snakeCase, 1, 1) == "_" then + snakeCase = string.sub(snakeCase, 2) + end + vim.fn.setreg(vim.v.register, snakeCase) + -- Select the word under the cursor and paste + vim.cmd("normal! viwP") +end + +vim.api.nvim_set_keymap('n', 'a', ':lua camelToSnake()', { noremap = true, silent = true }) +``` + ## Changelog {#sec-release-0.6-changelog} [ksonj](https://github.com/ksonj): From b68214833762f5024f70f41c953449b49bd20d63 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang <59727193+horriblename@users.noreply.github.com> Date: Sat, 20 Apr 2024 14:24:00 +0200 Subject: [PATCH 3/5] docs: format text --- lib/types/plugins.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 1ffb330..6b5612c 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -90,7 +90,13 @@ in { */ mkPluginSetupOption = pluginName: opts: mkOption { - description = "Option table to pass into the setup function of " + pluginName + ". You can pass in any additional options even if they're not listed in the docs"; + description = '' + Option table to pass into the setup function of ${pluginName} + + You can pass in any additional options even if they're + not listed in the docs + ''; + default = {}; type = submodule { freeformType = attrsOf anything; From 4ff3919f76d4742f8ba1a269b3d809e4f241566f Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 20 Apr 2024 15:17:50 +0200 Subject: [PATCH 4/5] fixup! docs: crude migration guide --- docs/release-notes/rl-0.6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.6.md b/docs/release-notes/rl-0.6.md index 28a4cfd..f75c54a 100644 --- a/docs/release-notes/rl-0.6.md +++ b/docs/release-notes/rl-0.6.md @@ -2,7 +2,7 @@ Release notes for release 0.6 -## Breaking Changes and Migration Guide +## Breaking Changes and Migration Guide {#sec-breaking-changes-and-migration-guide} In v0.6 we are introducing `setupOpts`: many plugin related options are moved into their respective `setupOpts` submodule, e.g. `nvimTree.disableNetrw` is renamed to `nvimTree.setupOpts.disable_netrw`. From 433525525d19c78d95d93af0ffa33c2685d70ef1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 20 Apr 2024 13:48:15 +0000 Subject: [PATCH 5/5] types/plugins: align `mkPluginSetupOption` description --- lib/types/plugins.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 6b5612c..e1b8259 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -91,10 +91,10 @@ in { mkPluginSetupOption = pluginName: opts: mkOption { description = '' - Option table to pass into the setup function of ${pluginName} + Option table to pass into the setup function of ${pluginName} You can pass in any additional options even if they're - not listed in the docs + not listed in the docs ''; default = {};