mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-27 02:59:00 +02:00
comment-nvim: add comment-nvim plugin
This commit is contained in:
parent
7227a5b429
commit
e781c4f540
2 changed files with 107 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
./utils/undotree.nix
|
||||
./utils/commentary.nix
|
||||
./utils/comment-nvim.nix
|
||||
./utils/startify.nix
|
||||
./utils/goyo.nix
|
||||
./utils/endwise.nix
|
||||
|
|
106
plugins/utils/comment-nvim.nix
Normal file
106
plugins/utils/comment-nvim.nix
Normal file
|
@ -0,0 +1,106 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.nixvim.plugins.comment-nvim;
|
||||
helpers = import ../helpers.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.nixvim.plugins.comment-nvim = {
|
||||
enable = mkEnableOption "Enable comment-nvim";
|
||||
padding = mkOption {
|
||||
type = types.bool;
|
||||
description = "Add a space b/w comment and the line";
|
||||
default = true;
|
||||
};
|
||||
sticky = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether the cursor should stay at its position";
|
||||
default = true;
|
||||
};
|
||||
ignore = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "Lines to be ignored while comment/uncomment";
|
||||
default = null;
|
||||
};
|
||||
toggler = mkOption {
|
||||
type = 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 = {};
|
||||
};
|
||||
opleader = mkOption {
|
||||
type = 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 = {};
|
||||
};
|
||||
mappings = mkOption {
|
||||
type = 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 = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 {
|
||||
programs.nixvim = {
|
||||
extraPlugins = [ pkgs.vimPlugins.comment-nvim ];
|
||||
extraConfigLua =
|
||||
''require("Comment").setup${helpers.toLuaObject setupOptions}'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue