summaryrefslogtreecommitdiff
path: root/evil-collection-python.el
diff options
context:
space:
mode:
authorJames Nguyen <james@jojojames.com>2017-12-12 19:45:14 -0800
committerJames Nguyen <james@jojojames.com>2017-12-12 19:45:14 -0800
commit701dae45ad021e03714f9dc38fd8b1faf5ec2125 (patch)
tree85828296e5727f6fa05c705addfaa7bd72ebb1b1 /evil-collection-python.el
parent77e6377f560a39bb393a7a1438ef4e9a6f9d4fbe (diff)
Python: Use a hook to set evil-shift-width locally
It was being set globally before.
Diffstat (limited to 'evil-collection-python.el')
-rw-r--r--evil-collection-python.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/evil-collection-python.el b/evil-collection-python.el
index 0b8e7d0..5f87dfb 100644
--- a/evil-collection-python.el
+++ b/evil-collection-python.el
@@ -30,9 +30,13 @@
(require 'evil)
(require 'python)
+(defun evil-collection-python-set-evil-shift-width ()
+ "Set `evil-shift-width' according to `python-indent-offset'."
+ (setq evil-shift-width python-indent-offset))
+
(defun evil-collection-python-setup ()
"Set up `evil' bindings for `python'."
- (setq evil-shift-width python-indent-offset)
+ (add-hook 'python-mode-hook #'evil-collection-python-set-evil-shift-width)
(evil-define-key 'normal python-mode-map
"gz" 'python-shell-switch-to-shell))