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 | |
| 23 | ---@alias lc.hook |
| 24 | ---| "enter" |
| 25 | ---| "question_enter" |
| 26 | ---| "leave" |
| 27 | |
| 28 | ---@alias lc.size |
| 29 | ---| string |
| 30 | ---| number |
| 31 | ---| { width: string | number, height: string | number } |
| 32 | |
| 33 | ---@alias lc.position "top" | "right" | "bottom" | "left" |
| 34 | |
| 35 | ---@alias lc.direction "col" | "row" |
| 36 | |
| 37 | ---@alias lc.inject { before?: string|string[], after?: string|string[] } |
| 38 | |
| 39 | ---@alias lc.storage table<"cache"|"home", string> |
| 40 | |
| 41 | ---@alias lc.picker { provider?: "fzf-lua" | "telescope" } |
| 42 | |
| 43 | ---@class lc.UserConfig |
| 44 | local M = { |
| 45 | ---@type string |
| 46 | arg = "leetcode.nvim", |
| 47 | |
| 48 | ---@type lc.lang |
| 49 | lang = "cpp", |
| 50 | |
| 51 | cn = { -- leetcode.cn |
| 52 | enabled = false, ---@type boolean |
| 53 | translator = true, ---@type boolean |
| 54 | translate_problems = true, ---@type boolean |
| 55 | }, |
| 56 | |
| 57 | ---@type lc.storage |
| 58 | storage = { |
| 59 | home = vim.fn.stdpath("data") .. "/leetcode", |
| 60 | cache = vim.fn.stdpath("cache") .. "/leetcode", |
| 61 | }, |
| 62 | |
| 63 | ---@type table<string, boolean> |
| 64 | plugins = { |
| 65 | non_standalone = false, |
| 66 | }, |
| 67 | |
| 68 | ---@type boolean |
| 69 | logging = true, |
| 70 | |
| 71 | injector = {}, ---@type table<lc.lang, lc.inject> |
| 72 | |
| 73 | cache = { |
| 74 | update_interval = 60 * 60 * 24 * 7, ---@type integer 7 days |
| 75 | }, |
| 76 | |
| 77 | console = { |
| 78 | open_on_runcode = true, ---@type boolean |
| 79 | |
| 80 | dir = "row", ---@type lc.direction |
| 81 | |
| 82 | size = { ---@type lc.size |
| 83 | width = "90%", |
| 84 | height = "75%", |
| 85 | }, |
| 86 | |
| 87 | result = { |
| 88 | size = "60%", ---@type lc.size |
| 89 | }, |
| 90 | |
| 91 | testcase = { |
| 92 | virt_text = true, ---@type boolean |
| 93 | |
| 94 | size = "40%", ---@type lc.size |
| 95 | }, |
| 96 | }, |
| 97 | |
| 98 | description = { |
| 99 | position = "left", ---@type lc.position |
| 100 | |
| 101 | width = "40%", ---@type lc.size |
| 102 | |
| 103 | show_stats = true, ---@type boolean |
| 104 | }, |
| 105 | |
| 106 | ---@type lc.picker |
| 107 | picker = { provider = nil }, |
| 108 | |
| 109 | hooks = { |
| 110 | ---@type fun()[] |
| 111 | ["enter"] = {}, |
| 112 | |
| 113 | ---@type fun(question: lc.ui.Question)[] |
| 114 | ["question_enter"] = {}, |
| 115 | |
| 116 | ---@type fun()[] |
| 117 | ["leave"] = {}, |
| 118 | }, |
| 119 | |
| 120 | keys = { |
| 121 | toggle = { "q" }, ---@type string|string[] |
| 122 | confirm = { "<CR>" }, ---@type string|string[] |
| 123 | |
| 124 | reset_testcases = "r", ---@type string |
| 125 | use_testcase = "U", ---@type string |
| 126 | focus_testcases = "H", ---@type string |
| 127 | focus_result = "L", ---@type string |
| 128 | }, |
| 129 | |
| 130 | ---@type lc.highlights |
| 131 | theme = {}, |
| 132 | |
| 133 | ---@type boolean |
| 134 | image_support = false, |
| 135 | } |
| 136 | |
| 137 | return M |