From aa4ae9a75ef897e083856b1b3f8fba7dfaec35c7 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Tue, 5 Oct 2021 11:09:13 -0400 Subject: [PATCH] Add command to run python from root --- emacs/.emacs.d/config/init-python.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs/.emacs.d/config/init-python.el b/emacs/.emacs.d/config/init-python.el index f716ddd..18c5aa5 100644 --- a/emacs/.emacs.d/config/init-python.el +++ b/emacs/.emacs.d/config/init-python.el @@ -32,6 +32,17 @@ default-directory))) (add-to-list 'flycheck-disabled-checkers 'python-flake8)) +;; Run a python repl at the project root +(defun projectile-run-python () + (interactive) + (let ((default-directory (projectile-project-root))) + (call-interactively #'run-python))) + +(with-eval-after-load 'projectile + (general-def projectile-command-map + "s p" #'projectile-run-python + "x p" #'projectile-run-python)) + ;; pyvenv to track virtual environments (use-package pyvenv :defer 3