diff --git a/plugins/git/diffview.nix b/plugins/git/diffview.nix index 1ae7c2bc..22d1c735 100644 --- a/plugins/git/diffview.nix +++ b/plugins/git/diffview.nix @@ -73,7 +73,7 @@ let current window. ''; - winOpts = mkAttributeSet "{}" '' + winOpts = mkAttributeSet { } '' Table of window local options (see |vim.opt_local|). These options are applied whenever the window is opened. ''; @@ -96,11 +96,11 @@ in See ':h diffview-config-enhanced_diff_hl' ''; - gitCmd = mkNullable (types.listOf types.str) ''[ "git" ]'' '' + gitCmd = mkListOf types.str [ "git" ] '' The git executable followed by default args. ''; - hgCmd = mkNullable (types.listOf types.str) ''[ "hg" ]'' '' + hgCmd = mkListOf types.str [ "hg" ] '' The hg executable followed by default args. ''; @@ -323,7 +323,7 @@ in List only the commits in the specified revision range. ''; - pathArgs = mkNullable (types.listOf types.str) "[]" '' + pathArgs = mkListOf types.str [ ] '' Limit the target files to only the files matching the given path arguments (git pathspec is supported). ''; @@ -381,7 +381,7 @@ in Limit the number of commits. ''; - l = mkNullable (types.listOf types.str) "[]" '' + l = mkListOf types.str [ ] '' `{ (",:" | "::")... }` Trace the evolution of the line range given by ,, @@ -454,9 +454,9 @@ in commonDesc = "Default args prepended to the arg-list for the listed commands"; in { - diffviewOpen = mkNullable (types.listOf types.str) "[ ]" commonDesc; + diffviewOpen = mkListOf types.str [ ] commonDesc; - diffviewFileHistory = mkNullable (types.listOf types.str) "[ ]" commonDesc; + diffviewFileHistory = mkListOf types.str [ ] commonDesc; }; hooks = diff --git a/plugins/git/git-conflict.nix b/plugins/git/git-conflict.nix index e3c7bf71..ca1c3523 100644 --- a/plugins/git/git-conflict.nix +++ b/plugins/git/git-conflict.nix @@ -24,7 +24,7 @@ helpers.neovim-plugin.mkNeovimPlugin config { settingsOptions = { default_mappings = - helpers.defaultNullOpts.mkNullable (with types; either bool (attrsOf str)) "true" + helpers.defaultNullOpts.mkNullable (with types; either bool (attrsOf str)) true '' This plugin offers default buffer local mappings inside conflicted files. This is primarily because applying these mappings only to relevant buffers is impossible diff --git a/plugins/git/gitblame.nix b/plugins/git/gitblame.nix index 3d6aad6c..6bdd8d57 100644 --- a/plugins/git/gitblame.nix +++ b/plugins/git/gitblame.nix @@ -24,23 +24,21 @@ in highlightGroup = helpers.defaultNullOpts.mkStr "Comment" "The highlight group for virtual text."; - displayVirtualText = - helpers.defaultNullOpts.mkNullable (types.nullOr types.bool) (toString true) - "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline."; + displayVirtualText = helpers.defaultNullOpts.mkBool true "If the blame message should be displayed as virtual text. You may want to disable this if you display the blame message in statusline."; - ignoredFiletypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) (toString - [ ] - ) "A list of filetypes for which gitblame information will not be displayed."; + ignoredFiletypes = + helpers.defaultNullOpts.mkListOf types.str [ ] + "A list of filetypes for which gitblame information will not be displayed."; delay = helpers.defaultNullOpts.mkUnsignedInt 0 "The delay in milliseconds after which the blame info will be displayed."; virtualTextColumn = - helpers.defaultNullOpts.mkNullable types.ints.unsigned (toString null) + helpers.defaultNullOpts.mkNullable types.ints.unsigned null "Have the blame message start at a given column instead of EOL. If the current line is longer than the specified column value the blame message will default to being displayed at EOL."; - extmarkOptions = helpers.defaultNullOpts.mkAttributeSet (toString null) "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)"; + extmarkOptions = helpers.defaultNullOpts.mkAttributeSet null "nvim_buf_set_extmark optional parameters. (Warning: overwriting id and virt_text will break the plugin behavior)"; }; }; diff --git a/plugins/git/gitlinker.nix b/plugins/git/gitlinker.nix index da9129bd..3543317a 100644 --- a/plugins/git/gitlinker.nix +++ b/plugins/git/gitlinker.nix @@ -39,24 +39,21 @@ with lib; mappings = helpers.defaultNullOpts.mkStr "gy" "Mapping to call url generation."; callbacks = - helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua)) + helpers.defaultNullOpts.mkAttrsOf types.str + { + "github.com" = "get_github_type_url"; + "gitlab.com" = "get_gitlab_type_url"; + "try.gitea.io" = "get_gitea_type_url"; + "codeberg.org" = "get_gitea_type_url"; + "bitbucket.org" = "get_bitbucket_type_url"; + "try.gogs.io" = "get_gogs_type_url"; + "git.sr.ht" = "get_srht_type_url"; + "git.launchpad.net" = "get_launchpad_type_url"; + "repo.or.cz" = "get_repoorcz_type_url"; + "git.kernel.org" = "get_cgit_type_url"; + "git.savannah.gnu.org" = "get_cgit_type_url"; + } '' - { - "github.com" = "get_github_type_url"; - "gitlab.com" = "get_gitlab_type_url"; - "try.gitea.io" = "get_gitea_type_url"; - "codeberg.org" = "get_gitea_type_url"; - "bitbucket.org" = "get_bitbucket_type_url"; - "try.gogs.io" = "get_gogs_type_url"; - "git.sr.ht" = "get_srht_type_url"; - "git.launchpad.net" = "get_launchpad_type_url"; - "repo.or.cz" = "get_repoorcz_type_url"; - "git.kernel.org" = "get_cgit_type_url"; - "git.savannah.gnu.org" = "get_cgit_type_url"; - } - '' - '' - Each key can be - the name of a built-in callback. Example: `"get_gitlab_type_url";` is setting ```lua diff --git a/plugins/git/gitmessenger.nix b/plugins/git/gitmessenger.nix index 21892d1e..a7d63b61 100644 --- a/plugins/git/gitmessenger.nix +++ b/plugins/git/gitmessenger.nix @@ -84,7 +84,7 @@ with lib; Note: Word diff is enabled by typing "r" in a popup window. ''; - floatingWinOps = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}" '' + floatingWinOps = helpers.defaultNullOpts.mkAttrsOf types.anything { } '' Options passed to nvim_open_win() on opening a popup window. This is useful when you want to override some window options. ''; diff --git a/plugins/git/gitsigns/options.nix b/plugins/git/gitsigns/options.nix index 4c016885..ebc4e3c2 100644 --- a/plugins/git/gitsigns/options.nix +++ b/plugins/git/gitsigns/options.nix @@ -225,20 +225,18 @@ with lib; count_chars = helpers.defaultNullOpts.mkAttrsOf types.str - '' - { - "__unkeyed_1" = "1"; - "__unkeyed_2" = "2"; - "__unkeyed_3" = "3"; - "__unkeyed_4" = "4"; - "__unkeyed_5" = "5"; - "__unkeyed_6" = "6"; - "__unkeyed_7" = "7"; - "__unkeyed_8" = "8"; - "__unkeyed_9" = "9"; - "+" = ">"; - } - '' + { + "__unkeyed_1" = "1"; + "__unkeyed_2" = "2"; + "__unkeyed_3" = "3"; + "__unkeyed_4" = "4"; + "__unkeyed_5" = "5"; + "__unkeyed_6" = "6"; + "__unkeyed_7" = "7"; + "__unkeyed_8" = "8"; + "__unkeyed_9" = "9"; + "+" = ">"; + } '' The count characters used when `signs.*.show_count` is enabled. The `+` entry is used as a fallback. With the default, any count outside of 1-9 uses the `>` @@ -272,15 +270,13 @@ with lib; preview_config = helpers.defaultNullOpts.mkAttrsOf types.anything - '' - { - border = "single"; - style = "minimal"; - relative = "cursor"; - row = 0; - col = 1; - } - '' + { + border = "single"; + style = "minimal"; + relative = "cursor"; + row = 0; + col = 1; + } '' Option overrides for the Gitsigns preview window. Table is passed directly to `nvim_open_win`. diff --git a/plugins/git/lazygit.nix b/plugins/git/lazygit.nix index d0c27c7b..e2885a67 100644 --- a/plugins/git/lazygit.nix +++ b/plugins/git/lazygit.nix @@ -15,17 +15,24 @@ helpers.vim-plugin.mkVimPlugin config { maintainers = [ helpers.maintainers.AndresBermeoMarinelli ]; settingsOptions = { - floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) "0" '' + floating_window_winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0 100) 0 '' Set the transparency of the floating window. ''; floating_window_scaling_factor = - helpers.defaultNullOpts.mkNullable types.numbers.nonnegative "0.9" + helpers.defaultNullOpts.mkNullable types.numbers.nonnegative 0.9 "Set the scaling factor for floating window."; - floating_window_border_chars = - helpers.defaultNullOpts.mkListOf types.str ''["╭" "─" "╮" "│" "╯" "─" "╰" "│"]'' - "Customize lazygit popup window border characters."; + floating_window_border_chars = helpers.defaultNullOpts.mkListOf types.str [ + "╭" + "─" + "╮" + "│" + "╯" + "─" + "╰" + "│" + ] "Customize lazygit popup window border characters."; floating_window_use_plenary = helpers.defaultNullOpts.mkBool false '' Whether to use plenary.nvim to manage floating window if available. @@ -41,7 +48,7 @@ helpers.vim-plugin.mkVimPlugin config { config_file_path = helpers.defaultNullOpts.mkNullable ( with types; either str (listOf str) - ) "[]" "Custom config file path or list of custom config file paths."; + ) [ ] "Custom config file path or list of custom config file paths."; }; settingsExample = { diff --git a/plugins/git/neogit/options.nix b/plugins/git/neogit/options.nix index ebafa18c..5ce08d63 100644 --- a/plugins/git/neogit/options.nix +++ b/plugins/git/neogit/options.nix @@ -42,13 +42,11 @@ in Disables signs for sections/items/hunks. ''; - git_services = helpers.defaultNullOpts.mkAttrsOf types.str '' - { - "github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1"; - "bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1"; - "gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}"; - } - '' "Used to generate URL's for branch popup action 'pull request'."; + git_services = helpers.defaultNullOpts.mkAttrsOf types.str { + "github.com" = "https://github.com/$\{owner}/$\{repository}/compare/$\{branch_name}?expand=1"; + "bitbucket.org" = "https://bitbucket.org/$\{owner}/$\{repository}/pull-requests/new?source=$\{branch_name}&t=1"; + "gitlab.com" = "https://gitlab.com/$\{owner}/$\{repository}/merge_requests/new?merge_request[source_branch]=$\{branch_name}"; + } "Used to generate URL's for branch popup action 'pull request'."; fetch_after_checkout = helpers.defaultNullOpts.mkBool false '' Perform a fetch if the newly checked out branch has an upstream or pushRemote set. @@ -174,9 +172,14 @@ in mapAttrs ( n: v: - helpers.defaultNullOpts.mkListOf types.str ''["${v.closed}" "${v.opened}"]'' '' - The icons to use for open and closed ${n}s. - '' + helpers.defaultNullOpts.mkListOf types.str + [ + "${v.closed}" + "${v.opened}" + ] + '' + The icons to use for open and closed ${n}s. + '' ) { hunk = { @@ -284,15 +287,13 @@ in ignored_settings = helpers.defaultNullOpts.mkListOf types.str - '' - [ - "NeogitPushPopup--force-with-lease" - "NeogitPushPopup--force" - "NeogitPullPopup--rebase" - "NeogitCommitPopup--allow-empty" - "NeogitRevertPopup--no-edit" - ] - '' + [ + "NeogitPushPopup--force-with-lease" + "NeogitPushPopup--force" + "NeogitPullPopup--rebase" + "NeogitCommitPopup--allow-empty" + "NeogitRevertPopup--no-edit" + ] '' Table of settings to never persist. Uses format "Filetype--cli-value". @@ -303,127 +304,113 @@ in mkMappingOption = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])); in { - commit_editor = mkMappingOption '' - { - q = "Close"; - "" = "Submit"; - "" = "Abort"; - "" = "PrevMessage"; - "" = "NextMessage"; - "" = "ResetMessage"; - } - '' "Mappings for the commit editor."; + commit_editor = mkMappingOption { + q = "Close"; + "" = "Submit"; + "" = "Abort"; + "" = "PrevMessage"; + "" = "NextMessage"; + "" = "ResetMessage"; + } "Mappings for the commit editor."; - commit_editor_I = mkMappingOption '' - { - "" = "Submit"; - "" = "Abort"; - } - '' "Mappings for the commit editor (insert mode)"; + commit_editor_I = mkMappingOption { + "" = "Submit"; + "" = "Abort"; + } "Mappings for the commit editor (insert mode)"; - rebase_editor = mkMappingOption '' - { - p = "Pick"; - r = "Reword"; - e = "Edit"; - s = "Squash"; - f = "Fixup"; - x = "Execute"; - d = "Drop"; - b = "Break"; - q = "Close"; - "" = "OpenCommit"; - gk = "MoveUp"; - gj = "MoveDown"; - "" = "Submit"; - "" = "Abort"; - "[c" = "OpenOrScrollUp"; - "]c" = "OpenOrScrollDown"; - } - '' "Mappings for the rebase editor."; + rebase_editor = mkMappingOption { + p = "Pick"; + r = "Reword"; + e = "Edit"; + s = "Squash"; + f = "Fixup"; + x = "Execute"; + d = "Drop"; + b = "Break"; + q = "Close"; + "" = "OpenCommit"; + gk = "MoveUp"; + gj = "MoveDown"; + "" = "Submit"; + "" = "Abort"; + "[c" = "OpenOrScrollUp"; + "]c" = "OpenOrScrollDown"; + } "Mappings for the rebase editor."; - rebase_editor_I = mkMappingOption '' - { - "" = "Submit"; - "" = "Abort"; - } - '' "Mappings for the rebase editor (insert mode)."; + rebase_editor_I = mkMappingOption { + "" = "Submit"; + "" = "Abort"; + } "Mappings for the rebase editor (insert mode)."; - finder = mkMappingOption '' - { - "" = "Select"; - "" = "Close"; - "" = "Close"; - "" = "Next"; - "" = "Previous"; - "" = "Next"; - "" = "Previous"; - "" = "MultiselectToggleNext"; - "" = "MultiselectTogglePrevious"; - "" = "NOP"; - "" = "ScrollWheelDown"; - "" = "ScrollWheelUp"; - "" = "NOP"; - "" = "NOP"; - "" = "MouseClick"; - "<2-LeftMouse>" = "NOP"; - } - '' "Mappings for the finder."; + finder = mkMappingOption { + "" = "Select"; + "" = "Close"; + "" = "Close"; + "" = "Next"; + "" = "Previous"; + "" = "Next"; + "" = "Previous"; + "" = "MultiselectToggleNext"; + "" = "MultiselectTogglePrevious"; + "" = "NOP"; + "" = "ScrollWheelDown"; + "" = "ScrollWheelUp"; + "" = "NOP"; + "" = "NOP"; + "" = "MouseClick"; + "<2-LeftMouse>" = "NOP"; + } "Mappings for the finder."; - popup = mkMappingOption '' - { - "?" = "HelpPopup"; - A = "CherryPickPopup"; - d = "DiffPopup"; - M = "RemotePopup"; - P = "PushPopup"; - X = "ResetPopup"; - Z = "StashPopup"; - i = "IgnorePopup"; - t = "TagPopup"; - b = "BranchPopup"; - B = "BisectPopup"; - w = "WorktreePopup"; - c = "CommitPopup"; - f = "FetchPopup"; - l = "LogPopup"; - m = "MergePopup"; - p = "PullPopup"; - r = "RebasePopup"; - v = "RevertPopup"; - } - '' "Mappings for popups."; + popup = mkMappingOption { + "?" = "HelpPopup"; + A = "CherryPickPopup"; + d = "DiffPopup"; + M = "RemotePopup"; + P = "PushPopup"; + X = "ResetPopup"; + Z = "StashPopup"; + i = "IgnorePopup"; + t = "TagPopup"; + b = "BranchPopup"; + B = "BisectPopup"; + w = "WorktreePopup"; + c = "CommitPopup"; + f = "FetchPopup"; + l = "LogPopup"; + m = "MergePopup"; + p = "PullPopup"; + r = "RebasePopup"; + v = "RevertPopup"; + } "Mappings for popups."; - status = mkMappingOption '' - { - q = "Close"; - I = "InitRepo"; - "1" = "Depth1"; - "2" = "Depth2"; - "3" = "Depth3"; - "4" = "Depth4"; - "" = "Toggle"; - x = "Discard"; - s = "Stage"; - S = "StageUnstaged"; - "" = "StageAll"; - u = "Unstage"; - K = "Untrack"; - U = "UnstageStaged"; - y = "ShowRefs"; - "$" = "CommandHistory"; - Y = "YankSelected"; - "" = "RefreshBuffer"; - "" = "GoToFile"; - "" = "VSplitOpen"; - "" = "SplitOpen"; - "" = "TabOpen"; - "{" = "GoToPreviousHunkHeader"; - "}" = "GoToNextHunkHeader"; - "[c" = "OpenOrScrollUp"; - "]c" = "OpenOrScrollDown"; - } - '' "Mappings for status."; + status = mkMappingOption { + q = "Close"; + I = "InitRepo"; + "1" = "Depth1"; + "2" = "Depth2"; + "3" = "Depth3"; + "4" = "Depth4"; + "" = "Toggle"; + x = "Discard"; + s = "Stage"; + S = "StageUnstaged"; + "" = "StageAll"; + u = "Unstage"; + K = "Untrack"; + U = "UnstageStaged"; + y = "ShowRefs"; + "$" = "CommandHistory"; + Y = "YankSelected"; + "" = "RefreshBuffer"; + "" = "GoToFile"; + "" = "VSplitOpen"; + "" = "SplitOpen"; + "" = "TabOpen"; + "{" = "GoToPreviousHunkHeader"; + "}" = "GoToNextHunkHeader"; + "[c" = "OpenOrScrollUp"; + "]c" = "OpenOrScrollDown"; + } "Mappings for status."; }; notification_icon = helpers.defaultNullOpts.mkStr "󰊢" ''