Figure out a way to do python virtual environments
This commit is contained in:
parent
321146b0aa
commit
5a30c48953
8 changed files with 54 additions and 3 deletions
27
languages/js.el
Normal file
27
languages/js.el
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
;;; Js -- summary
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;========== Editor config =========================
|
||||
(defun editor-config-js ()
|
||||
"Editor configuration for Javascript."
|
||||
(set-indent 2)
|
||||
(set-width-80))
|
||||
|
||||
;;========== Code completion =======================
|
||||
(defun completion-config-js ()
|
||||
"Code completion and inspection for Javascript."
|
||||
(company-mode 1)
|
||||
(flycheck-mode 1)
|
||||
(flymake-mode)
|
||||
(set (make-local-variable 'company-backends)
|
||||
'((company-tern company-capf company-dabbrev-code company-yasnippet
|
||||
company-files))))
|
||||
|
||||
;;========== Hooks =================================
|
||||
(add-hook 'js-mode-hook 'editor-config-js)
|
||||
(add-hook 'js-mode-hook 'completion-config-js)
|
||||
|
||||
(provide 'js)
|
||||
;;; js.el ends here
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
;;; Code:
|
||||
(require 'elpy)
|
||||
(require 'pyenv-mode)
|
||||
(require 'company-jedi)
|
||||
|
||||
;;========== Editor config =========================
|
||||
(defun editor-config-python ()
|
||||
"Setup editor for Python."
|
||||
|
|
@ -12,7 +14,18 @@
|
|||
(setq python-indent-guess-indent-offset 4)
|
||||
(setq python-indent-offset 4))
|
||||
|
||||
;;========== Code completion
|
||||
;;========== Helper for pyenv ======================
|
||||
(defun ssbb-pyenv-hook ()
|
||||
"Automatically activates pyenv version if .python-version file exists."
|
||||
(f-traverse-upwards
|
||||
(lambda (path)
|
||||
(let ((pyenv-version-path (f-expand ".python-version" path)))
|
||||
(if (f-exists? pyenv-version-path)
|
||||
(pyenv-mode-set (s-trim (f-read-text pyenv-version-path 'utf-8))))))))
|
||||
|
||||
(add-hook 'find-file-hook 'ssbb-pyenv-hook)
|
||||
|
||||
;;========== Code completion =======================
|
||||
(defun completion-config-python ()
|
||||
"Code completion and inspection for Python."
|
||||
(elpy-mode 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue