You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Vim plugin is inspired by [skygragon/leetcode-cli](https://github.com/skygragon/leetcode-cli).
7
+
This Vim plugin is inspired by [skygragon/leetcode-cli][leetcode-cli].
8
8
9
9
## Installation
10
10
11
-
1. Vim with Python3 support is **required**. If you are using Neovim, you probably need to install the Neovim Python API:
12
-
```
13
-
pip3 install neovim --user
14
-
```
15
-
2. To install the plugin, you only need to place the following line in your vimrc if you are using vim-plugged (or similar code for other plugin managers):
11
+
1. Vim with `+python3` feature is **required**. Install the **pynvim** package
12
+
for Neovim:
13
+
```sh
14
+
pip3 install pynvim --user
16
15
```
16
+
2. Install the plugin:
17
+
```vim
17
18
Plug 'ianding1/leetcode.vim'
18
19
```
19
20
20
21
## Quick Start
21
22
22
-
1. Run `:LeetCodeList` to browse the problems (you may need to enter username and password to sign in, see Customization if you want to skip this step).
23
-
2. Press Enter on the line of a problem to open a file to write your solution.
24
-
3. Run `:LeetCodeTest` in your solution file to test the solution with a simple test case (you may need to press `ctrl-w z` to close the result window).
25
-
4. Run `:LeetCodeSubmit` in your solution file to submit it to LeetCode and receive the result (you may need to press `ctrl-w z` to close the result window).
26
-
5. To manually sign in or switch an account, run `:LeetCodeSignIn`.
23
+
-`:LeetCodeList`: browse the problems.
24
+
-`:LeetCodeTest`: run the code with the default test case.
25
+
-`:LeetCodeSubmit`: submit the code.
26
+
-`:LeetCodeSignIn`: manually sign in.
27
27
28
-
Or you can simply put the following lines in your vimrc to bind these commands to shortcuts:
28
+
## Key mappings
29
29
30
-
```
30
+
**leetcode.vim** doesn't bind any key mappings by default. Put the following
31
+
lines to your **.vimrc** to set up the key mappings.
The language that you use to solve the problem. It can be one of the following values: `'cpp'`, `'java'`, `'python'`, `'python3'`, `'csharp'`, `'javascript'`, `'ruby'`, `'swift'`, `'golang'`, `'scala'`, `'kotlin'`, ``'rust'``.
The problem categories that you want to browse. It can be a list of the following values: `'algorithms'`, `'database'`, `'shell'`.
48
-
49
-
Default value is `['algorithms']`.
49
+
Default value is `'cpp'`.
50
50
51
-
### g:leetcode\_username
51
+
### `g:leetcode_username`
52
52
53
-
If you want to automatically login to LeetCode, put your LeetCode username here.
53
+
Set to the LeetCode username or email for auto login.
54
54
55
55
Default value is `''`.
56
56
57
-
### g:leetcode\_password
57
+
### `g:leetcode_password`
58
58
59
-
If you want to automatically login to LeetCode, put your LeetCode password here.
59
+
Set to the LeetCode password for auto login.
60
60
61
-
WARNING: the password is stored in disk in plain text. So make sure it won't be leaked.
61
+
**WARNING: the password is stored in plain text.**
62
62
63
63
Default value is `''`.
64
64
65
65
## FAQ
66
66
67
-
### [PLEASE READ THIS]Why can't I test the problem/submit the problem/list the problems?
67
+
### Why can't I test the problem/submit the problem/list the problems?
68
68
69
-
Once you sign in on your browser in LeetCode website, the LeetCode session in Vim get expired immediatelly. Then you need to sign in again in Vim before doing other things.
69
+
~~Once you sign in on your browser in LeetCode website, the LeetCode session in
70
+
Vim get expired immediatelly. Then you need to sign in again in Vim before
71
+
doing other things.~~ (No longer having this problem)
70
72
71
73
### Why can't I test and submit solutions?
72
74
73
-
According to issue [#5](https://github.com/ianding1/leetcode.vim/issues/5), **if your email address is not active, you can login and download problems, but you cannot test and submit solutions.**
75
+
According to issue [#5][#5], **if the email address is not active, then you can
76
+
only login and download problems, but cannot test and submit any code.**
74
77
75
-
Please check if your email is active if you find that you cannot test and submit.
0 commit comments