Xinqi Bao's Git

feat(nvim): add optional LeetCode plugin bundle
authorXinqi Bao <[email protected]>
Thu, 1 Oct 2026 07:24:34 +0000 (15:24 +0800)
committerXinqi Bao <[email protected]>
Thu, 1 Oct 2026 07:24:34 +0000 (15:24 +0800)
.config/nvim/init.vim
.config/nvim/lua/plugin-config/leetcode.lua [new file with mode: 0644]
.config/nvim/opt/leetcode.vim [new file with mode: 0644]

index e6cb7fd..d38c9ff 100644 (file)
@@ -98,6 +98,7 @@ call plug#begin()
     Plug 'zbirenbaum/copilot.lua'
 
     " execute 'source' fnameescape(expand('<sfile>:p:h') . '/opt/avante.vim')
+    " execute 'source' fnameescape(expand('<sfile>:p:h') . '/opt/leetcode.vim')
 
 call plug#end()
 
@@ -239,6 +240,13 @@ if has_key(plugs, 'avante.nvim')
     lua require('plugin-config/avante')
 endif
 
+"----------------------
+" leetcode.nvim setting
+"----------------------
+if has_key(plugs, 'leetcode.nvim')
+    lua require('plugin-config/leetcode')
+endif
+
 nnoremap J :tabprevious<CR>
 nnoremap K :tabnext<CR>
 nnoremap <leader>J :tabmove -1<CR>
diff --git a/.config/nvim/lua/plugin-config/leetcode.lua b/.config/nvim/lua/plugin-config/leetcode.lua
new file mode 100644 (file)
index 0000000..295c045
--- /dev/null
@@ -0,0 +1,21 @@
+require('leetcode').setup({
+    lang = "cpp",
+    injector = {
+        ["cpp"] = {
+            -- A function replaces the plugin's default C++ imports.
+            imports = function()
+                return {
+                    "#include <iostream>",
+                    "#include <string>",
+                    "#include <vector>",
+                    "using namespace std;",
+                }
+            end,
+        },
+    },
+    theme = {
+        ["normal"] = {
+            fg = "#EA4AAA",
+        },
+    },
+})
diff --git a/.config/nvim/opt/leetcode.vim b/.config/nvim/opt/leetcode.vim
new file mode 100644 (file)
index 0000000..25a9753
--- /dev/null
@@ -0,0 +1,5 @@
+" Source inside the plug#begin()/plug#end() block in init.vim.
+Plug 'nvim-telescope/telescope.nvim'
+Plug 'nvim-lua/plenary.nvim'
+Plug 'MunifTanjim/nui.nvim'
+Plug 'kawre/leetcode.nvim'