|
1 | 1 | {
|
2 |
| - lazy-load-plugin = |
| 2 | + lazy-load-neovim-plugin = |
3 | 3 | { config, ... }:
|
4 | 4 | {
|
5 | 5 | plugins = {
|
| 6 | + lz-n = { |
| 7 | + enable = true; |
| 8 | + }; |
| 9 | + |
| 10 | + neotest = { |
| 11 | + enable = true; |
| 12 | + lazyLoad = { |
| 13 | + enable = true; |
| 14 | + keys = [ |
| 15 | + { |
| 16 | + __unkeyed-1 = "<leader>nt"; |
| 17 | + __unkeyed-3 = "<CMD>Neotest summary<CR>"; |
| 18 | + desc = "Summary toggle"; |
| 19 | + } |
| 20 | + ]; |
| 21 | + }; |
| 22 | + }; |
| 23 | + }; |
| 24 | + |
| 25 | + assertions = [ |
| 26 | + { |
| 27 | + assertion = (builtins.length config.plugins.lz-n.plugins) == 1; |
| 28 | + message = "`lz-n.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
| 29 | + } |
| 30 | + { |
| 31 | + assertion = |
| 32 | + let |
| 33 | + plugin = builtins.head config.plugins.lz-n.plugins; |
| 34 | + keys = if builtins.isList plugin.keys then plugin.keys else [ ]; |
| 35 | + in |
| 36 | + (builtins.length keys) == 1; |
| 37 | + message = "`lz-n.plugins[0].keys` should have contained a configuration."; |
| 38 | + } |
| 39 | + ]; |
| 40 | + }; |
| 41 | + |
| 42 | + lazy-load-lz-n = |
| 43 | + { config, ... }: |
| 44 | + { |
| 45 | + plugins = { |
| 46 | + codesnap = { |
| 47 | + enable = true; |
| 48 | + lazyLoad.enable = true; |
| 49 | + }; |
6 | 50 | lz-n = {
|
7 | 51 | enable = true;
|
8 | 52 | plugins = [
|
9 | 53 | {
|
10 |
| - __unkeyed-1 = "neotest"; |
| 54 | + __unkeyed-1 = "codesnap"; |
11 | 55 | after.__raw = ''
|
12 | 56 | function()
|
13 |
| - ${config.plugins.neotest.luaConfig.content} |
| 57 | + ${config.plugins.codesnap.luaConfig.content} |
14 | 58 | end
|
15 | 59 | '';
|
| 60 | + cmd = [ |
| 61 | + "CodeSnap" |
| 62 | + "CodeSnapSave" |
| 63 | + "CodeSnapHighlight" |
| 64 | + "CodeSnapSaveHighlight" |
| 65 | + ]; |
16 | 66 | keys = [
|
17 | 67 | {
|
18 |
| - __unkeyed-1 = "<leader>nt"; |
19 |
| - __unkeyed-3 = "<CMD>Neotest summary<CR>"; |
20 |
| - desc = "Summary toggle"; |
| 68 | + __unkeyed-1 = "<leader>cc"; |
| 69 | + __unkeyed-3 = "<cmd>CodeSnap<CR>"; |
| 70 | + desc = "Copy"; |
| 71 | + mode = "v"; |
| 72 | + } |
| 73 | + { |
| 74 | + __unkeyed-1 = "<leader>cs"; |
| 75 | + __unkeyed-3 = "<cmd>CodeSnapSave<CR>"; |
| 76 | + desc = "Save"; |
| 77 | + mode = "v"; |
| 78 | + } |
| 79 | + { |
| 80 | + __unkeyed-1 = "<leader>ch"; |
| 81 | + __unkeyed-3 = "<cmd>CodeSnapHighlight<CR>"; |
| 82 | + desc = "Highlight"; |
| 83 | + mode = "v"; |
| 84 | + } |
| 85 | + { |
| 86 | + __unkeyed-1 = "<leader>cH"; |
| 87 | + __unkeyed-3 = "<cmd>CodeSnapSaveHighlight<CR>"; |
| 88 | + desc = "Save Highlight"; |
| 89 | + mode = "v"; |
21 | 90 | }
|
22 | 91 | ];
|
23 |
| - |
24 | 92 | }
|
25 | 93 | ];
|
26 | 94 | };
|
27 |
| - |
28 |
| - neotest = { |
29 |
| - enable = true; |
30 |
| - lazyLoad.enable = true; |
31 |
| - }; |
32 | 95 | };
|
| 96 | + assertions = [ |
| 97 | + { |
| 98 | + assertion = (builtins.length config.plugins.lz-n.plugins) == 1; |
| 99 | + message = "`lz-n.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
| 100 | + } |
| 101 | + { |
| 102 | + assertion = |
| 103 | + let |
| 104 | + plugin = builtins.head config.plugins.lz-n.plugins; |
| 105 | + keys = if builtins.isList plugin.keys then plugin.keys else [ ]; |
| 106 | + in |
| 107 | + (builtins.length keys) == 4; |
| 108 | + message = |
| 109 | + let |
| 110 | + plugin = builtins.head config.plugins.lz-n.plugins; |
| 111 | + in |
| 112 | + "`lz-n.plugins[0].keys` should have contained 4 key configurations, but contained ${builtins.toJSON (plugin.keys)}"; |
| 113 | + } |
| 114 | + { |
| 115 | + assertion = |
| 116 | + let |
| 117 | + plugin = builtins.head config.plugins.lz-n.plugins; |
| 118 | + cmd = if builtins.isList plugin.cmd then plugin.cmd else [ ]; |
| 119 | + in |
| 120 | + (builtins.length cmd) == 4; |
| 121 | + message = |
| 122 | + let |
| 123 | + plugin = builtins.head config.plugins.lz-n.plugins; |
| 124 | + in |
| 125 | + "`lz-n.plugins[0].cmd` should have contained 4 cmd configurations, but contained ${builtins.toJSON (plugin.cmd)}"; |
| 126 | + } |
| 127 | + ]; |
33 | 128 | };
|
34 | 129 | }
|
0 commit comments