Skip to content

Commit

Permalink
plugins/comment-box-nvim: init
Browse files Browse the repository at this point in the history
  • Loading branch information
elythh committed Aug 26, 2024
1 parent 45bb663 commit aa1f5a7
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
name = "Daniel Laing";
keys = [ { fingerprint = "0821 8B96 DC73 85E5 BB7C A535 D264 3BD2 13BC 0FA8"; } ];
};
elythh = {
email = "gwen@omg.lol";
github = "elythh";
githubId = 50964650;
name = "gwen";
};
GGORG = {
email = "GGORG0@protonmail.com";
matrix = "@ggorg:matrix.org";
Expand Down
1 change: 1 addition & 0 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
./utils/cloak.nix
./utils/codesnap.nix
./utils/comment.nix
./utils/comment-box.nix
./utils/commentary.nix
./utils/competitest.nix
./utils/conjure.nix
Expand Down
139 changes: 139 additions & 0 deletions plugins/utils/comment-box.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib.nixvim) defaultNullOpts;
in
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
name = "comment-box";
originalName = "comment-box.nvim";
defaultPackage = pkgs.vimPlugins.comment-box-nvim;
description = ''
Clarify and beautify your comments and plain text files using boxes and lines.
'';

maintainers = [ lib.maintainers.elythh ];

settingsOptions = {
comment_style =
defaultNullOpts.mkEnum
[
"line"
"block"
"auto"
]
"line"
''
Select the type of comments.
'';

doc_width = defaultNullOpts.mkInt 80 ''
Width of the document.
'';
box_width = defaultNullOpts.mkInt 60 ''
Width of the boxes.
'';

borders = {
top = defaultNullOpts.mkStr "─" ''
Symbol used to draw the top border of a box.
'';

bottom = defaultNullOpts.mkStr "─" ''
Symbol used to draw the bottom border of a box.
'';

left = defaultNullOpts.mkStr "│" ''
Symbol used to draw the left border of a box.
'';

right = defaultNullOpts.mkStr "│" ''
Symbol used to draw the right border of a box.
'';

top_left = defaultNullOpts.mkStr "╭" ''
Symbol used to draw the top left corner of a box.
'';

top_right = defaultNullOpts.mkStr "╮" ''
Symbol used to draw the top right corner of a box.
'';

bottom_left = defaultNullOpts.mkStr "╰" ''
Symbol used to draw the bottom left corner of a box.
'';

bottom_right = defaultNullOpts.mkStr "╯" ''
Symbol used to draw the bottom right corner of a box.
'';

};

line_width = defaultNullOpts.mkInt 70 ''
Width of the lines.
'';

lines = {
line = defaultNullOpts.mkStr "─" ''
Symbol used to draw a line.
'';

line_start = defaultNullOpts.mkStr "─" ''
Symbol used to draw the start of a line.
'';

line_end = defaultNullOpts.mkStr "─" ''
Symbol used to draw the end of a line.
'';

title_left = defaultNullOpts.mkStr "─" ''
Symbol used to draw the left border of the title.
'';

title_right = defaultNullOpts.mkStr "─" ''
Symbol used to draw the right border of the title.
'';

outer_blank_lines_above = defaultNullOpts.mkBool false ''
Insert a blank line above the box.
'';

outer_blank_lines_below = defaultNullOpts.mkBool false ''
Insert a blank line below the box.
'';

inner_blank_lines = defaultNullOpts.mkBool false ''
Insert a blank line above and below the text.
'';

line_blank_line_above = defaultNullOpts.mkBool false ''
Insert a blank line above the line.
'';

line_blank_line_below = defaultNullOpts.mkBool false ''
Insert a blank line below the line.
'';
};
};

settingsExample = {
comment_style = "block";
doc_width = 100;
box_width = 120;
borders = {
top_left = "X";
top_right = "X";
bottom_left = "X";
bottom_right = "X";
};
line_width = 40;
lines = {
line = "*";
};
outer_blank_lines_below = true;
inner_blank_lines = true;
};
}
40 changes: 40 additions & 0 deletions tests/test-sources/plugins/utils/comment-box.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
_: {
empty = {
plugins.comment-box.enable = true;
};

defaults = {
plugins.comment-box = {
enable = true;

settings = {
comment_style = "line";
doc_width = 80;
box_width = 60;
borders = {
top = "─";
bottom = "─";
left = "│";
right = "│";
top_left = "╭";
top_right = "╮";
bottom_left = "╰";
bottom_right = "╯";
};
line_width = 70;
lines = {
line = "─";
line_start = "─";
line_end = "─";
title_left = "─";
title_right = "─";
};
outer_blank_lines_above = false;
outer_blank_lines_below = false;
inner_blank_lines = false;
line_blank_line_above = false;
line_blank_line_below = false;
};
};
};
}

0 comments on commit aa1f5a7

Please sign in to comment.