You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

88 lines
3.6 KiB

;; company-jedi funktioniert bisher erst nach . + M-x company-jedi
(use-package python
:mode ("\\.py\\'" . python-mode))
;; ##############
;; damit der EPC-Server funktioniert,
;; muss in /etc/hosts der Eintrag
;; 127.0.0.1 localhost
;; enthalten sein!
;; ##############
;; virtualenv für python muss installiert sein
;; Benutzung
;; venv-workon: virtualenv aussuchen und setzen
;; venv-deactivate: deaktiviert virtualenv
;; venv-mkvirtualenv: erstellt neue virtualenv in venv-location
;; venv-lsvirtualenv: listet alle virtualenvs auf
;; venv-cdvirtualenv: wechselt default-Verzeichnis zum momentanen virtualenv-Verzeichnis
;; venv-cpvirtualenv: erstellt neue virtualenv aus einem exisiterenden.
;; fragt nach beiden Namen
;;(use-package pyvenv
;; :ensure t
;; :init
;; (setenv "WORKON_HOME" "~/Archiv/Programmierprojekte/Python/virtualenv/")
;; (pyvenv-mode t)
;; )
(use-package virtualenvwrapper
:ensure t
:init
(venv-initialize-interactive-shells) ;;interactive shell support
(venv-initialize-eshell) ;;eshell support
(setq venv-location "~/Archiv/Programmierprojekte/Python/virtualenv/")
(setq python-environment-directory venv-location)
(add-hook 'venv-postmkvirtualenv-hook
(lambda () (shell-command "pip install epc jedi")))
;; (add-hook 'venv-postactivate-hook 'jedi:stop-server) ;;server-neustart, wenn neue virtualenv
;; (add-hook 'venv-postdeactivate-hook 'jedi:stop-server) ;;server-neustart, wenn neue virtualenv
)
;; sucht und aktiviert die virtualenv nach folgenden Aspekten:
;; .python-version im project-root (ethält absoluten Pfad zur virtualenv
;; .venv oder venv Verzeichnis im project-root
;; eine virtualenv mit dem selben Namen wie project-root
;; - project-root ist definiert als Verzeichnis, dass "auto-virtualenvwapper-project-root-files" enthält,
;; die da wären: .python-version, .dir-locals.el, .projectile, .emacs-project, .manage.py, .git
;; für mich zuverlässig funktioiert nur absoluter Pfadin .python-version
;;(use-package auto-virtualenvwrapper
;; :ensure t
;; :config
;; (add-hook 'python-mode-hook #'auto-virtualenvwrapper-activate))
;;activate on changing buffers
;; (add-hook 'window-configuration-change-hook #'auto-virtualenvwrapper-activate)
;;activate on focus in
;; (add-hook 'focus-in-hook #'auto-virtualenvwrapper-activate))
(use-package py-autopep8
:config
(add-hook 'python-mode-hook 'py-autopep8-enable-on-save))
;; benötigt pip install jedi / emerge dev-python/jedi
(use-package company-jedi ;; company-mode completion backend for python jedi
:defer t
:ensure t
:config
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(setq jedi:use-shortcuts t)
(setq jedi:get-in-function-call-delay 100)
(setq jedi:tooltip-method '(pos-tip popup))
(defun config/enable-company-jedi ()
(add-to-list 'company-backends 'company-jedi)
(setq jedi:complete-on-dot t)
)
(add-hook 'python-mode-hook 'config/enable-company-jedi))
;;(use-package jedi-core
;; :ensure t
;; :init
;; (progn
;; (setq jedi:complete-on-dot t)
;; (setq jedi:setup-keys t)
;; (add-hook 'python-mode-hook 'jedi:setup)))
(provide 'lang-python)