@@ -254,26 +254,26 @@ logging = true
254
254
255
255
Inject code before or after your solution, injected code won't be submitted or run.
256
256
257
- #### default imports
258
-
259
- You can also pass ` before = true ` to inject default imports for the language.
260
- Supported languages are ` python ` , ` python3 ` , ` java `
261
-
262
- Access default imports via ` require("leetcode.config.imports") `
257
+ Imports will be injected at the top of the buffer, automatically
258
+ folded by default.
263
259
264
260
``` lua
265
261
injector = { --- @type table<lc.lang , lc.inject>
266
262
[" python3" ] = {
267
- before = true
263
+ imports = function (default_imports )
264
+ vim .list_extend (default_imports , { " from .leetcode import *" })
265
+ return default_imports
266
+ end ,
267
+ after = { " def test():" , " print('test')" },
268
268
},
269
269
[" cpp" ] = {
270
- before = { " #include <bits/stdc++.h>" , " using namespace std;" },
270
+ imports = function ()
271
+ -- return a different list to omit default imports
272
+ return { " #include <bits/stdc++.h>" , " using namespace std;" }
273
+ end ,
271
274
after = " int main() {}" ,
272
275
},
273
- [" java" ] = {
274
- before = " import java.util.*;" ,
275
- },
276
- }
276
+ },
277
277
```
278
278
279
279
### picker
@@ -354,7 +354,7 @@ image_support = false,
354
354
355
355
- ` tabs ` opens a picker with all currently opened question tabs
356
356
357
- - ` yank ` yanks the current question solution
357
+ - ` yank ` yanks the code section
358
358
359
359
- ` lang ` opens a picker to change the language of the current question
360
360
@@ -366,25 +366,27 @@ image_support = false,
366
366
367
367
- ` random ` opens a random question
368
368
369
- - ` daily ` opens the question of today
369
+ - ` daily ` opens the question of today problem
370
370
371
- - ` list ` opens a problem list picker
371
+ - ` list ` opens a picker with all available leetcode problems
372
372
373
373
- ` open ` opens the current question in a default browser
374
374
375
- - ` reset ` reset current question to default code definition
375
+ - ` restore ` try to restore default question layout
376
376
377
- - ` last_submit ` retrieve last submitted code for the current question
377
+ - ` last_submit ` tries to replace the editor code section with the latest submitted code
378
378
379
- - ` restore ` try to restore default question layout
379
+ - ` reset ` resets editor code section to the default snippet
380
380
381
- - ` inject ` re-inject code for the current question
381
+ - ` inject ` re-injects editor code, keeping the code section intact
382
382
383
- - ` session `
384
- - ` create ` create a new session
385
- - ` change ` change the current session
383
+ - ` fold ` applies folding to the current question imports section
386
384
387
- - ` update ` update the current session in case it went out of sync
385
+ <!-- - `session` -->
386
+ <!-- - `create` create a new session -->
387
+ <!-- - `change` change the current session -->
388
+ <!-- -->
389
+ <!-- - `update` update the current session in case it went out of sync -->
388
390
389
391
- ` desc ` toggle question description
390
392
- ` toggle ` same as ` Leet desc `
@@ -394,10 +396,10 @@ image_support = false,
394
396
- ` cookie `
395
397
- ` update ` opens a prompt to enter a new cookie
396
398
397
- - ` delete ` sign- out
399
+ - ` delete ` deletes stored cookie and logs out of [ leetcode.nvim ]
398
400
399
401
- ` cache `
400
- - ` update ` updates cache
402
+ - ` update ` fetches all available problems and updates the local cache of [ leetcode.nvim ]
401
403
402
404
#### Some commands can take optional arguments. To stack argument values separate them by a ` , `
403
405
@@ -424,9 +426,10 @@ This plugin can be initiated in two ways:
424
426
nvim leetcode.nvim
425
427
```
426
428
427
- - _ ** (Experimental) ** _ Alternatively, you can use ` :Leet ` command to open [ leetcode.nvim]
429
+ - Use ` :Leet ` command to open [ leetcode.nvim]
428
430
within your preferred dashboard plugin. The only requirement is that [ Neovim]
429
431
must not have any listed buffers open.
432
+ To bypass this requirement use [ ` non_standalone ` ] ( #non-standalone-mode ) plugin.
430
433
431
434
### Switching between questions
432
435
0 commit comments