Guest User

Untitled

a guest
Jan 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ; Electric Pairs
  2. (add-hook 'python-mode-hook
  3. (lambda ()
  4. (define-key python-mode-map "\"" 'electric-pair)
  5. (define-key python-mode-map "\'" 'electric-pair)
  6. (define-key python-mode-map "(" 'electric-pair)
  7. (define-key python-mode-map "[" 'electric-pair)
  8. (define-key python-mode-map "{" 'electric-pair)))
  9.  
  10. (defun electric-pair ()
  11. "Insert character pair without surrounding spaces"
  12. (interactive)
  13. (let (parens-require-spaces)
  14. (insert-pair)))
  15.  
  16. ; bind RET to py-newline-and-indent
  17. (add-hook 'python-mode-hook
  18. (lambda ()
  19. (define-key python-mode-map "\C-m" 'newline-and-indent)
  20. (setq-default indent-tabs-mode nil)
  21. (setq-default tab-width 4)))
Add Comment
Please, Sign In to add comment