Skip to content

Commit cd479ec

Browse files
PerchunPakMattSturgeon
authored andcommitted
plugins/otter: init
1 parent d823c14 commit cd479ec

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

plugins/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
./languages/nix.nix
7272
./languages/nvim-jdtls.nix
7373
./languages/openscad.nix
74+
./languages/otter.nix
7475
./languages/parinfer-rust.nix
7576
./languages/plantuml-syntax.nix
7677
./languages/python/jupytext.nix

plugins/languages/otter.nix

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
lib,
3+
helpers,
4+
config,
5+
pkgs,
6+
...
7+
}:
8+
helpers.neovim-plugin.mkNeovimPlugin config {
9+
name = "otter";
10+
originalName = "otter.nvim";
11+
defaultPackage = pkgs.vimPlugins.otter-nvim;
12+
13+
maintainers = [ lib.maintainers.perchun ];
14+
15+
settingsOptions = {
16+
lsp = {
17+
hover = {
18+
border = helpers.defaultNullOpts.mkListOf lib.types.str [
19+
"╭"
20+
"─"
21+
"╮"
22+
"│"
23+
"╯"
24+
"─"
25+
"╰"
26+
"│"
27+
] "";
28+
};
29+
30+
diagnostic_update_events = helpers.defaultNullOpts.mkListOf' {
31+
type = lib.types.str;
32+
pluginDefault = [ "BufWritePost" ];
33+
description = ''
34+
`:h events` that cause the diagnostics to update.
35+
36+
See example for less performant but more instant diagnostic updates.
37+
'';
38+
example = [
39+
"BufWritePost"
40+
"InsertLeave"
41+
"TextChanged"
42+
];
43+
};
44+
};
45+
46+
buffers = {
47+
set_filetype = helpers.defaultNullOpts.mkBool false ''
48+
If set to true, the filetype of the otterbuffers will be set.
49+
Otherwise only the autocommand of lspconfig that attaches
50+
the language server will be executed without setting the filetype.
51+
'';
52+
53+
write_to_disk = helpers.defaultNullOpts.mkBool false ''
54+
Write `<path>.otter.<embedded language extension>` files
55+
to disk on save of main buffer.
56+
Useful for some linters that require actual files,
57+
otter files are deleted on quit or main buffer close.
58+
'';
59+
};
60+
61+
strip_wrapping_quote_characters = helpers.defaultNullOpts.mkListOf lib.types.str [
62+
"'"
63+
"\""
64+
"\`"
65+
] "";
66+
67+
handle_leading_whitespace = helpers.defaultNullOpts.mkBool false ''
68+
Otter may not work the way you expect when entire code blocks are indented (eg. in Org files).
69+
When true, otter handles these cases fully. This is a (minor) performance hit.
70+
'';
71+
};
72+
73+
extraOptions = {
74+
addCmpSources = lib.mkOption {
75+
type = lib.types.bool;
76+
default = true;
77+
description = ''
78+
Automatically add otter to cmp sources, as it is required for some functionality.
79+
'';
80+
};
81+
};
82+
83+
extraConfig = cfg: {
84+
plugins.cmp.settings.sources = lib.mkIf cfg.addCmpSources [ { name = "otter"; } ];
85+
};
86+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
empty = {
3+
plugins.otter.enable = true;
4+
};
5+
6+
defaults = {
7+
plugins.otter = {
8+
enable = true;
9+
10+
settings = {
11+
lsp = {
12+
hover = {
13+
border = [
14+
"╭"
15+
"─"
16+
"╮"
17+
"│"
18+
"╯"
19+
"─"
20+
"╰"
21+
"│"
22+
];
23+
};
24+
diagnostic_update_events = [ "BufWritePost" ];
25+
};
26+
buffers = {
27+
set_filetype = false;
28+
write_to_disk = false;
29+
};
30+
strip_wrapping_quote_characters = [
31+
"'"
32+
"\""
33+
"\`"
34+
];
35+
handle_leading_whitespace = false;
36+
};
37+
};
38+
};
39+
}

0 commit comments

Comments
 (0)