This is an Emacs plugin that makes it easier and faster to write leetcode programs.
- leetcode-cli
This tool is based on leetcode-cli, You can install the latest version through its website.
The backend leetcode-cli changed to other implement github
- ctable
This tool uses the emacs package ctable
to show all leetcode issues,
you can download it from github or install it using ELPA.
- clone the project in your own emacs configuration files directory, like:
git clone [email protected]:ginqi7/leetcode-emacs.git ~/.emacs.d/lisp/leetcode
- add the path to ‘load-path’
(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp/leetcode"))
You can use the ‘use-package’, there is a configurable variable.
leetcode-language
: assign the language of solutions
(use-package leetcode
:config
(setq leetcode-language "java")
)
You will find leetcode-cli config in “~/.leetcode/leetcode.toml”
[code]
editor = 'cat'
lang = 'java'
You should change editor to ‘cat’, let leetcode-cli don’t open a editor to edit the anwser file.
You can change the answer languary using ‘lang’ item.
There are some variable
leetcode-hide-no-auth-problems ;; Whether to hide topics that do not have permission, default value is t
New leetcode-cli not provides command to login / logout. You just need login/logout leetcode in Chrome, the leetcode-cli will use the Chrome cookie to access leetcode website.
leetcode-list-all:
There will hide 🔒 problems.
If you select a problem and click or press `return` will open the problem code.
You can filter problems by difficulty:
You can filter problems by tag:
You can filter problems by keyword:
leetcode-show n: show a description and generate a code’s template of a specific question. The parameter of function is the question’s index number.
leetcode-show-next:
If you solve the question in order, you can go to the next question through leetcode-show-next
.
leetcode-submit:
leetcode-test:
Like leetcode-submit , you can using leetcode-test function to test current buffer using some default test cases.
leetcode-show-local-max-problem
Use this function, you can quickly jump the max index problem in your local file. You needn’t go to your leetcode directory to find last file you handled
leetcode-interactive You could filter and select and open problem interactively.