Skip to content

Commit b64ee08

Browse files
committed
plugins/codesnap: init
1 parent 1a46075 commit b64ee08

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

plugins/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
./utils/ccc.nix
147147
./utils/clipboard-image.nix
148148
./utils/cloak.nix
149+
./utils/codesnap.nix
149150
./utils/comment.nix
150151
./utils/commentary.nix
151152
./utils/competitest.nix

plugins/utils/codesnap.nix

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
lib,
3+
helpers,
4+
config,
5+
pkgs,
6+
...
7+
}:
8+
with lib;
9+
helpers.neovim-plugin.mkNeovimPlugin config {
10+
name = "codesnap";
11+
originalName = "codesnap.nvim";
12+
defaultPackage = pkgs.vimPlugins.codesnap-nvim;
13+
14+
maintainers = [ maintainers.GaetanLepage ];
15+
16+
settingsOptions = {
17+
save_path = helpers.defaultNullOpts.mkStr null ''
18+
The save_path must be ends with `.png`, unless when you specified a directory path, CodeSnap
19+
will append an auto-generated filename to the specified directory path.
20+
21+
For example:
22+
- `save_path = "~/Pictures";`
23+
parsed: `"~/Pictures/CodeSnap_y-m-d_at_h:m:s.png"`
24+
- `save_path = "~/Pictures/foo.png";`
25+
parsed: `"~/Pictures/foo.png"`
26+
'';
27+
28+
mac_window_bar = helpers.defaultNullOpts.mkBool true ''
29+
Whether to display the MacOS style title bar.
30+
'';
31+
32+
title = helpers.defaultNullOpts.mkStr "CodeSnap.nvim" ''
33+
The editor title.
34+
'';
35+
36+
code_font_family = helpers.defaultNullOpts.mkStr "CaskaydiaCove Nerd Font" ''
37+
Which font to use for the code.
38+
'';
39+
40+
watermark_font_family = helpers.defaultNullOpts.mkStr "Pacifico" ''
41+
Which font to use for watermarks.
42+
'';
43+
44+
watermark = helpers.defaultNullOpts.mkStr "CodeSnap.nvim" ''
45+
Wartermark of the code snapshot.
46+
'';
47+
48+
bg_theme = helpers.defaultNullOpts.mkStr "default" ''
49+
Background theme name.
50+
51+
Check the [upstream README](https://github.com/mistricky/codesnap.nvim?tab=readme-ov-file#custom-background)
52+
for available options.
53+
'';
54+
55+
bg_color = helpers.defaultNullOpts.mkStr' {
56+
pluginDefault = null;
57+
example = "#535c68";
58+
description = ''
59+
If you prefer solid color background, you can set bg_color to your preferred color.
60+
'';
61+
};
62+
63+
breadcrumbs_separator = helpers.defaultNullOpts.mkStr "/" ''
64+
Separator for breadcrumbs.
65+
The CodeSnap.nvim uses `/` as the separator of the file path by default, of course, you can
66+
specify any symbol you prefer as the custom separator.
67+
'';
68+
69+
has_breadcrumbs = helpers.defaultNullOpts.mkBool false ''
70+
Whether to display the current snapshot file path.
71+
'';
72+
73+
has_line_number = helpers.defaultNullOpts.mkBool false ''
74+
Whether to display line numbers.
75+
'';
76+
77+
show_workspace = helpers.defaultNullOpts.mkBool false ''
78+
Breadcrumbs hide the workspace name by default, if you want to display workspace in
79+
breadcrumbs, you can just set this option to `true`.
80+
'';
81+
82+
min_width = helpers.defaultNullOpts.mkUnsignedInt 0 ''
83+
Minimum width for the snapshot.
84+
'';
85+
};
86+
87+
settingsExample = {
88+
save_path = "~/Pictures/Screenshots/";
89+
mac_window_bar = true;
90+
title = "CodeSnap.nvim";
91+
watermark = "";
92+
breadcrumbs_separator = "/";
93+
has_breadcrumbs = true;
94+
has_line_number = false;
95+
};
96+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
empty = {
3+
plugins.codesnap.enable = true;
4+
};
5+
6+
defaults = {
7+
plugins.codesnap = {
8+
enable = true;
9+
10+
settings = {
11+
save_path = null;
12+
mac_window_bar = true;
13+
title = "CodeSnap.nvim";
14+
code_font_family = "CaskaydiaCove Nerd Font";
15+
watermark_font_family = "Pacifico";
16+
watermark = "CodeSnap.nvim";
17+
bg_theme = "default";
18+
bg_color = null;
19+
breadcrumbs_separator = "/";
20+
has_breadcrumbs = false;
21+
has_line_number = false;
22+
show_workspace = false;
23+
min_width = 0;
24+
};
25+
};
26+
};
27+
28+
example = {
29+
plugins.codesnap = {
30+
enable = true;
31+
32+
settings = {
33+
save_path = "~/Pictures/Screenshots/";
34+
mac_window_bar = true;
35+
title = "CodeSnap.nvim";
36+
watermark = "";
37+
breadcrumbs_separator = "/";
38+
has_breadcrumbs = true;
39+
has_line_number = false;
40+
};
41+
};
42+
};
43+
}

0 commit comments

Comments
 (0)