Add some smartparens keys to python-mode
This commit is contained in:
parent
ea4b5f561f
commit
cc4bdd72d7
1 changed files with 21 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue