init-python.el 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. ;;; init-python.el --- .Emacs Configuration -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;
  4. ;;; Code:
  5. ;;----------------------------------------------------------------------------
  6. ;; Python Mode
  7. ;;----------------------------------------------------------------------------
  8. (add-hook 'python-mode-hook
  9. (lambda ()
  10. (setq indent-tabs-mode nil)
  11. (setq python-indent-guess-indent-offset nil)
  12. (setq python-indent-offset 4)))
  13. (use-package python
  14. :mode
  15. ("\\.py" . python-mode))
  16. (use-package elpy
  17. :init
  18. (advice-add 'python-mode :before 'elpy-enable)
  19. :mode
  20. ("\\.py$" . python-mode)
  21. :config
  22. (setq elpy-rpc-backend "jedi")
  23. :bind
  24. (:map elpy-mode-map
  25. ("M-." . elpy-goto-definition)
  26. ("M-," . pop-tag-mark)))
  27. (setq auto-mode-alist
  28. (append '(("SConstruct\\'" . python-mode)
  29. ("SConscript\\'" . python-mode))
  30. auto-mode-alist))
  31. (use-package pip-requirements
  32. :hook
  33. (pip-requirements-mode-hook . pip-requirements-auto-complete-setup))
  34. (use-package py-autopep8)
  35. (use-package pyvenv)
  36. (provide 'init-python)
  37. ;; Local Variables:
  38. ;; byte-compile-warnings: (not free-vars)
  39. ;; End:
  40. ;;; init-python.el ends here