jdtsmith / python-mls

Multi-line Shell Commands for Python REPLs in Emacs
GNU Affero General Public License v3.0
40 stars 3 forks source link

python-MLS: multi-line Python shell commands in Emacs

Python-MLS (multi-line shell) is an Emacs minor mode for working directly with multi-line Python commands in the REPL. It builds on and automatically extends python-mode's inferior shell capabilities.

Features:

Installation

Simply install python-MLS from this repository or MELPA, and use require or use-package to load it. To enable, arrange to have python-mls-mode called on the inferior-python-mode hook, e.g.:

(use-package python-mls
  ;; :custom
  ;; (python-mls-multiline-history-modifier '(meta shift))
  :hook
  (inferior-python-mode . python-mls-mode))

NOTE: The python-mls-setup function is no longer necessary, and was removed in v0.2.

You can start your shell however you normally do (e.g. C-c C-p in a Python buffer, or M-x run-python), and Python-MLS will activate.

Usage

Using python-MLS is simple: just enter the first of a multi-line statement at the (i)Python prompt, then editing as you would in a python buffer. Or hit C-j to "build your own" multi-line statement. Hit S-Ret or enter two final blank lines to send to python. Add shift to your up/down commands to skip through history multi-line blocks at a time.

You can disable python-MLS for future shells in one Emacs session with M-x python-mls-mode in an enabled shell buffer.

Keys

Config

A few options are available for configuration, including whether and where to save multi-line command history, whether to kill the window after the Python process quits, and which navigation commands to bring over from python-mode. To configure, use M-x customize-group [Ret] python-mls.

FAQs