Skip to content

Commit 0644475

Browse files
authored
utility/leetcode-nvim: init (#636)
* utility/leetcode-nvim: init * utility/leetcode.nvim: Clean Code Cleaned code upon PR review comments
1 parent 4196be3 commit 0644475

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

configuration.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ isMaximal: {
177177
surround.enable = isMaximal;
178178
diffview-nvim.enable = true;
179179
yanky-nvim.enable = false;
180+
leetcode-nvim.enable = isMaximal;
180181
motion = {
181182
hop.enable = true;
182183
leap.enable = true;

docs/release-notes/rl-0.8.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@
143143

144144
[ARCIII](https://github.com/ArmandoCIII):
145145

146+
[leetcode.nvim]: https://github.com/kawre/leetcode.nvim
147+
146148
- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
147149
Inspiration from `vim.languages.clang.dap` implementation.
150+
- Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`.
151+
148152

149153
[nezia1](https://github.com/nezia1)
150154

modules/plugins/utility/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
./telescope
1616
./wakatime
1717
./yanky-nvim
18+
./leetcode-nvim
1819
];
1920
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
config,
3+
lib,
4+
...
5+
}: let
6+
inherit (lib.modules) mkIf;
7+
8+
cfg = config.vim.utility.leetcode-nvim;
9+
in {
10+
config = mkIf cfg.enable {
11+
vim = {
12+
startPlugins = [
13+
"leetcode-nvim"
14+
"plenary-nvim"
15+
"fzf-lua"
16+
"nui-nvim"
17+
];
18+
19+
lazy.plugins.leetcode-nvim = {
20+
package = "leetcode-nvim";
21+
setupModule = "leetcode";
22+
inherit (cfg) setupOpts;
23+
};
24+
};
25+
};
26+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
imports = [
3+
./leetcode-nvim.nix
4+
./config.nix
5+
];
6+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{lib, ...}: let
2+
inherit (lib.options) mkOption mkEnableOption;
3+
inherit (lib.types) enum str bool;
4+
inherit (lib.generators) mkLuaInline;
5+
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
6+
in {
7+
options.vim.utility = {
8+
leetcode-nvim = {
9+
enable = mkEnableOption "complementary neovim plugin for leetcode.nvim";
10+
11+
setupOpts = mkPluginSetupOption "leetcode-nvim" {
12+
logging = mkEnableOption "logging for leetcode.nvim status notifications." // {default = true;};
13+
image_support = mkEnableOption "question description images using image.nvim (image-nvim must be enabled).";
14+
15+
lang = mkOption {
16+
type = enum [
17+
"cpp"
18+
"java"
19+
"python"
20+
"python3"
21+
"c"
22+
"csharp"
23+
"javascript"
24+
"typescript"
25+
"php"
26+
"swift"
27+
"kotlin"
28+
"dart"
29+
"golang"
30+
"ruby"
31+
"scala"
32+
"rust"
33+
"racket"
34+
"erlang"
35+
"elixir"
36+
"bash"
37+
];
38+
default = "python3";
39+
description = "Language to start your session with";
40+
};
41+
42+
arg = mkOption {
43+
type = str;
44+
default = "leetcode.nvim";
45+
description = "Argument for Neovim";
46+
};
47+
48+
cn = {
49+
enabled = mkEnableOption "leetcode.cn instead of leetcode.com";
50+
translator = mkEnableOption "translator" // {default = true;};
51+
translate_problems = mkEnableOption "translation for problem questions" // {default = true;};
52+
};
53+
54+
storage = {
55+
home = mkOption {
56+
type = luaInline;
57+
default = mkLuaInline "vim.fn.stdpath(\"data\") .. \"/leetcode\"";
58+
description = "Home storage directory";
59+
};
60+
61+
cache = mkOption {
62+
type = luaInline;
63+
default = mkLuaInline "vim.fn.stdpath(\"cache\") .. \"/leetcode\"";
64+
description = "Cache storage directory";
65+
};
66+
};
67+
68+
plugins = {
69+
non_standalone = mkEnableOption "leetcode.nvim in a non-standalone mode";
70+
};
71+
};
72+
};
73+
};
74+
}

npins/sources.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,18 @@
567567
"url": "https://github.com/ggandor/leap.nvim/archive/c6bfb191f1161fbabace1f36f578a20ac6c7642c.tar.gz",
568568
"hash": "1dmy45czi3irjd5qb74yamjam4d1lvqsgfxgh4vaj740b19gyl1w"
569569
},
570+
"leetcode-nvim": {
571+
"type": "Git",
572+
"repository": {
573+
"type": "GitHub",
574+
"owner": "kawre",
575+
"repo": "leetcode.nvim"
576+
},
577+
"branch": "master",
578+
"revision": "db7e1cd6b9191b34b4c1f2f96e4e3949cde9f951",
579+
"url": "https://github.com/kawre/leetcode.nvim/archive/db7e1cd6b9191b34b4c1f2f96e4e3949cde9f951.tar.gz",
580+
"hash": "1d3lb7625b2qdzqm74mzrac66rxqc0qgjd3mb37l4v8wqyiyv6pp"
581+
},
570582
"lsp-lines": {
571583
"type": "Git",
572584
"repository": {

0 commit comments

Comments
 (0)