leetcode-emacs
leetcode-emacs copied to clipboard
an emacs plugin to write leetcode programs
- Leetcode-emacs
This is an Emacs plugin that makes it easier and faster to write leetcode programs.
** Prerequisites
- leetcode-cli
This tool is based on leetcode-cli, You can install the latest version through its [[https://github.com/skygragon/leetcode-cli][website]].
The backend leetcode-cli changed to other implement [[https://github.com/clearloop/leetcode-cli][github]]
- ctable This tool uses the emacs package =ctable= to show all leetcode issues, you can download it from [[https://github.com/kiwanami/emacs-ctable][github]] or install it using ELPA.
** Installing
-
clone the project in your own emacs configuration files directory, like: #+BEGIN_SRC sh git clone [email protected]:ginqi7/leetcode-emacs.git ~/.emacs.d/lisp/leetcode #+END_SRC
-
add the path to 'load-path' #+BEGIN_SRC emacs-lisp (add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp/leetcode")) #+END_SRC ** Configuration You can use the 'use-package', there is a configurable variable.
-
=leetcode-language= : assign the language of solutions
#+BEGIN_SRC emacs-lisp (use-package leetcode :config (setq leetcode-language "java") ) #+END_SRC
*** Change leetcode-cli config You will find leetcode-cli config in "~/.leetcode/leetcode.toml"
#+begin_src toml [code] editor = 'cat' lang = 'java' #+end_src
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. *** Configurable Variable There are some variable #+begin_src emacs-lisp leetcode-hide-no-auth-problems ;; Whether to hide topics that do not have permission, default value is t #+end_src ** Features *** login / logout
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.
*** List all questions leetcode-list-all:
#+HTML:
There will hide 🔒 problems.
If you select a problem and click or press return
will open the problem code.
#+HTML:
*** Filter questions by difficulty
You can filter problems by difficulty: #+HTML:
*** Filter questions by tag You can filter problems by tag: #+HTML:
*** Filter questions by keyword You can filter problems by keyword: #+HTML:
*** Show a specific question 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.
#+HTML:
If you solve the question in order, you can go to the next question through =leetcode-show-next=.
#+HTML:
#+HTML:
Like leetcode-submit , you can using leetcode-test function to test current buffer using some default test cases.
#+HTML:
*** Quickly jump max index problem in local 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
*** Interactively filter and select problem and open it leetcode-interactive You could filter and select and open problem interactively. #+HTML: