nix-community.nixvim/plugins/utils/comment-nvim.nix
Alexander Nortung 3f9effc575
general: add package options (#127)
* barbar: package option

* Base16: package option

* gruvbox: package option

* nord: package option

* one: package option

* onedark: package option

* tokyonight: package option

* nvim-cmp: package option

* coq: package option

* lspkind: package option

* helpers: added package option to mkPlugin

* fugitive: package option

* gitgutter: package option

* gitsigns: package option

* neogit: package option

* ledger: package option

* nix: package option

* plantuml-syntax: package option

* treesitter-context: package option + formatting

* treesitter-refactor: package option + formatting

* treesitter: package option

* zig: package option

* null-ls: package option

* null-ls/servers: package option

* lsp-lines: package option

* lspsaga: package option

* trouble: package option

* luasnip: added description for package option

* airline: package option

* lightline: package option

* lualine: package option

* telescope: package option

* telescope/frecency: package option

* telescope/fzf-native: package option

* telescope/media-files: package option

* comment-nvim: package option

* vim-commentary: package option

* dashboard: package option

* easyescape: package option

* emmet: package option

* endwise: package option

* floaterm: package option

* goyo: package option

* intellitab: package option

* mark-radar: package option

* notify: package option

* nvim-autopairs: package option

* nvim-tree: package option

* project-nvim: package option

* specs: package option

* startify: package option

* surround: package option

* undotree: package option
2023-01-19 10:45:15 +00:00

111 lines
3.3 KiB
Nix

{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.plugins.comment-nvim;
helpers = import ../helpers.nix { inherit lib; };
in
{
options = {
plugins.comment-nvim = {
enable = mkEnableOption "Enable comment-nvim";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.comment-nvim;
description = "Plugin to use for comment-nvim";
};
padding = mkOption {
type = types.nullOr types.bool;
description = "Add a space b/w comment and the line";
default = null;
};
sticky = mkOption {
type = types.nullOr types.bool;
description = "Whether the cursor should stay at its position";
default = null;
};
ignore = mkOption {
type = types.nullOr types.str;
description = "Lines to be ignored while comment/uncomment";
default = null;
};
toggler = mkOption {
type = types.nullOr (types.submodule ({ ... }: {
options = {
line = mkOption {
type = types.str;
description = "line-comment keymap";
default = "gcc";
};
block = mkOption {
type = types.str;
description = "block-comment keymap";
default = "gbc";
};
};
}));
description = "LHS of toggle mappings in NORMAL + VISUAL mode";
default = null;
};
opleader = mkOption {
type = types.nullOr (types.submodule ({ ... }: {
options = {
line = mkOption {
type = types.str;
description = "line-comment keymap";
default = "gc";
};
block = mkOption {
type = types.str;
description = "block-comment keymap";
default = "gb";
};
};
}));
description = "LHS of operator-pending mappings in NORMAL + VISUAL mode";
default = null;
};
mappings = mkOption {
type = types.nullOr (types.submodule ({ ... }: {
options = {
basic = mkOption {
type = types.bool;
description = "operator-pending mapping. Includes 'gcc', 'gcb', 'gc[count]{motion}' and 'gb[count]{motion}'";
default = true;
};
extra = mkOption {
type = types.bool;
description = "extra mapping. Includes 'gco', 'gc0', 'gcA'";
default = true;
};
extended = mkOption {
type = types.bool;
description = "extended mapping. Includes 'g>', 'g<', 'g>[count]{motion}' and 'g<[count]{motion}'";
default = false;
};
};
}));
description = "Create basic (operator-pending) and extended mappings for NORMAL + VISUAL mode";
default = null;
};
};
};
config =
let
setupOptions = {
padding = cfg.padding;
sticky = cfg.sticky;
ignore = cfg.ignore;
toggler = cfg.toggler;
opleader = cfg.opleader;
mappings = cfg.mappings;
};
in
mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraConfigLua =
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
};
}