A Neovim plugin enabling you to solve LeetCode problems.
Allow users to wipe buffers before running :Leet
Optional and enabled by default with config field allow_bufwipe
3 files changed, +12 -0
+4-0README.md
| @@ -160,6 +160,10 @@ To see full configuration types see [template.lua](./lua/leetcode/config/templat | ||
| 160 | 160 | |
| 161 | 161 | ---@type boolean |
| 162 | 162 | image_support = false, |
| 163 | + | |
| 164 | + ---Wipes buffers just before opening with :Leet | |
| 165 | + ---@type boolean | |
| 166 | + allow_bufwipe = true, | |
| 163 | 167 | } |
| 164 | 168 | ``` |
| 165 | 169 |
+4-0lua/leetcode/command/init.lua
| @@ -169,6 +169,10 @@ function cmd.random_question(opts) | ||
| 169 | 169 | end |
| 170 | 170 | |
| 171 | 171 | function cmd.start_with_cmd() |
| 172 | + if require("leetcode.config").user.allow_bufwipe then | |
| 173 | + vim.cmd([[silent %bd]]) | |
| 174 | + end | |
| 175 | + | |
| 172 | 176 | local leetcode = require("leetcode") |
| 173 | 177 | if leetcode.start(false) then |
| 174 | 178 | cmd.menu() |
+4-0lua/leetcode/config/template.lua
| @@ -137,6 +137,10 @@ local M = { | ||
| 137 | 137 | |
| 138 | 138 | ---@type boolean |
| 139 | 139 | image_support = false, |
| 140 | + | |
| 141 | + ---Wipes buffers just before opening with :Leet | |
| 142 | + ---@type boolean | |
| 143 | + allow_bufwipe = true, | |
| 140 | 144 | } |
| 141 | 145 | |
| 142 | 146 | return M |