|
| 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 | +} |
0 commit comments