summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-05-15 15:59:45 +0200
committerGravatar Tom Willemse2013-05-15 15:59:45 +0200
commitcc4bdd72d712c325670da67c2533f0e2af765e1d (patch)
tree70ca06a6c7e400a948721178b3ded0bffd190598
parentea4b5f561fb31fb38c834e441e53dacc783e8aa5 (diff)
downloaddotfiles-cc4bdd72d712c325670da67c2533f0e2af765e1d.tar.gz
dotfiles-cc4bdd72d712c325670da67c2533f0e2af765e1d.zip
Add some smartparens keys to python-mode
-rw-r--r--emacs/init.org21
1 files changed, 21 insertions, 0 deletions
diff --git a/emacs/init.org b/emacs/init.org
index 7af08ae..53eef49 100644
--- a/emacs/init.org
+++ b/emacs/init.org
@@ -1334,6 +1334,27 @@
(emms-mode-line 1)))
#+END_SRC
+* Enable some smartparen keybindings in python :smartparens:python:
+
+ Since, for example, HTML mode uses the same keys for similar
+ functions from the ~tagedit~ package, these keys should only be
+ enabled for (for the moment) python mode.
+
+ This should be set before the =smartparens-mode= function is added
+ to the =python-mode-hook= so that the hook will run when smartparens
+ is turned on.
+
+ #+BEGIN_SRC emacs-lisp
+ (defun oni:set-smartparens-keys ()
+ (local-set-key (kbd "<C-left>") 'sp-forward-barf-sexp)
+ (local-set-key (kbd "<C-right>") 'sp-forward-slurp-sexp))
+
+ (defun oni:local-set-smartparens-hook ()
+ (add-hook 'smartparens-mode-hook 'oni:set-smartparens-keys nil t))
+
+ (add-hook 'python-mode-hook 'oni:local-set-smartparens-hook)
+ #+END_SRC
+
* All the rest
This still needs to be sorted out and documented, haven't had time