Skip to content

Commit

Permalink
Tweak python config
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvandendriessche committed Mar 18, 2014
1 parent a8c1702 commit 1b4df9d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions settings/settings-python.el
Expand Up @@ -8,6 +8,7 @@
:after (progn :after (progn
(put 'project-venv-name 'safe-local-variable 'stringp)))))) (put 'project-venv-name 'safe-local-variable 'stringp))))))


;; don't bother getting jedi running on windows
(if (not (eq system-type 'windows-nt)) (if (not (eq system-type 'windows-nt))
(setq el-get-sources (append el-get-sources (setq el-get-sources (append el-get-sources
'((:name jedi '((:name jedi
Expand All @@ -16,18 +17,26 @@
(setq jedi:install-imenu) (setq jedi:install-imenu)
(setq jedi:use-shortcuts t) (setq jedi:use-shortcuts t)
(setq jedi:complete-on-dot t))))))) (setq jedi:complete-on-dot t)))))))
;; load virtual environment if possible
(add-hook 'python-mode-hook '(lambda ()
(if project-venv-name
((hack-local-variables)
(venv-workon project-venv-name)))))


(add-hook 'python-mode-hook (lambda () ;; use projectile-mode in python projects
(if project-venv-name (add-hook 'python-mode-hook 'projectile-on)
((hack-local-variables)
(venv-workon project-venv-name)))))

(when (require 'projectile nil 'noerror)
(add-hook 'python-mode-hook 'projectile-mode))


;; be sure to `pip install flake8` for python flychecking ;; be sure to `pip install flake8` for python flychecking
(add-hook 'python-mode-hook 'flycheck-mode) (add-hook 'python-mode-hook 'flycheck-mode)


(defun ac-python-mode-setup ()
(require 'auto-complete-config)
(yas-global-mode 1)
(add-to-list 'ac-sources 'ac-source-yasnippet))

(add-hook 'python-mode-hook 'ac-python-mode-setup)

;; python debugger command
(setq gud-pdb-command-name "python -m pdb")) (setq gud-pdb-command-name "python -m pdb"))


(provide 'settings-python) (provide 'settings-python)

0 comments on commit 1b4df9d

Please sign in to comment.