From 41cbb1fe7b524a302c8d24312c785d963947dc37 Mon Sep 17 00:00:00 2001 From: Alexander Graul Date: Wed, 23 Feb 2022 15:01:58 +0100 Subject: [PATCH] tweak(python): update smartparens config - Automatically close f-strings - Don't insert trailing colons in function definitions --- modules/lang/python/config.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 5e25c79af..e7c3a2908 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -79,10 +79,13 @@ (setq-local flycheck-python-flake8-executable "flake8")))) (define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens - (sp-local-pair 'python-mode "'" nil - :unless '(sp-point-before-word-p - sp-point-after-word-p - sp-point-before-same-p)) + ;; Automatically close f-strings + (sp-with-modes 'python-mode + (sp-local-pair "f\"" "\"") + (sp-local-pair "f\"\"\"" "\"\"\"") + (sp-local-pair "f'''" "'''") + (sp-local-pair "f'" "'")) + (setq sp-python-insert-colon-in-function-definitions nil) ; interferes with snippet ;; Affects pyenv and conda (when (featurep! :ui modeline)