A Neovim plugin enabling you to solve LeetCode problems.
| 1 | ---@alias lc.lang |
| 2 | ---| "cpp" |
| 3 | ---| "java" |
| 4 | ---| "python" |
| 5 | ---| "python3" |
| 6 | ---| "c" |
| 7 | ---| "csharp" |
| 8 | ---| "javascript" |
| 9 | ---| "typescript" |
| 10 | ---| "php" |
| 11 | ---| "swift" |
| 12 | ---| "kotlin" |
| 13 | ---| "dart" |
| 14 | ---| "golang" |
| 15 | ---| "ruby" |
| 16 | ---| "scala" |
| 17 | ---| "rust" |
| 18 | ---| "racket" |
| 19 | ---| "erlang" |
| 20 | ---| "elixir" |
| 21 | ---| "bash" |
| 22 | ---| "html" |
| 23 | ---| "pythonml" |
| 24 | ---| "react" |
| 25 | ---| "vanillajs" |
| 26 | |
| 27 | ---@alias lc.hook |
| 28 | ---| "LeetEnter" |
| 29 | ---| "LeetQuestionNew" |
| 30 | |
| 31 | ---@alias lc.size |
| 32 | ---| string |
| 33 | ---| number |
| 34 | ---| { width: string | number, height: string | number } |
| 35 | |
| 36 | ---@alias lc.position "top" | "right" | "bottom" | "left" |
| 37 | |
| 38 | ---@alias lc.direction "col" | "row" |
| 39 | |
| 40 | ---@class lc.UserConfig |
| 41 | local M = { |
| 42 | ---@type string |
| 43 | arg = "leetcode.nvim", |
| 44 | |
| 45 | ---@type lc.lang |
| 46 | lang = "cpp", |
| 47 | |
| 48 | cn = { -- leetcode.cn |
| 49 | enabled = false, ---@type boolean |
| 50 | translator = true, ---@type boolean |
| 51 | translate_problems = true, ---@type boolean |
| 52 | }, |
| 53 | |
| 54 | ---@type string |
| 55 | directory = vim.fn.stdpath("data") .. "/leetcode/", |
| 56 | |
| 57 | ---@type boolean |
| 58 | logging = true, |
| 59 | |
| 60 | cache = { |
| 61 | update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days |
| 62 | }, |
| 63 | |
| 64 | console = { |
| 65 | open_on_runcode = true, ---@type boolean |
| 66 | |
| 67 | dir = "row", ---@type lc.direction |
| 68 | |
| 69 | size = { ---@type lc.size |
| 70 | width = "90%", |
| 71 | height = "75%", |
| 72 | }, |
| 73 | |
| 74 | result = { |
| 75 | size = "60%", ---@type lc.size |
| 76 | }, |
| 77 | |
| 78 | testcase = { |
| 79 | virt_text = true, ---@type boolean |
| 80 | |
| 81 | size = "40%", ---@type lc.size |
| 82 | }, |
| 83 | }, |
| 84 | |
| 85 | description = { |
| 86 | position = "left", ---@type lc.position |
| 87 | |
| 88 | width = "40%", ---@type lc.size |
| 89 | |
| 90 | show_stats = true, ---@type boolean |
| 91 | }, |
| 92 | |
| 93 | hooks = { |
| 94 | ---@type fun()[] |
| 95 | LeetEnter = {}, |
| 96 | |
| 97 | ---@type fun(question: lc.ui.Question)[] |
| 98 | LeetQuestionNew = {}, |
| 99 | }, |
| 100 | |
| 101 | ---@type boolean |
| 102 | image_support = false, -- setting this to `true` will disable question description wrap |
| 103 | |
| 104 | keys = { |
| 105 | toggle = { "q", "<Esc>" }, ---@type string|string[] |
| 106 | confirm = { "<CR>" }, ---@type string|string[] |
| 107 | |
| 108 | reset_testcases = "r", ---@type string |
| 109 | use_testcase = "U", ---@type string |
| 110 | focus_testcases = "H", ---@type string |
| 111 | focus_result = "L", ---@type string |
| 112 | }, |
| 113 | } |
| 114 | |
| 115 | return M |