Add pyvenv for python virtualenv

This commit is contained in:
Wojciech Kozlowski 2019-08-07 11:55:30 +02:00
parent c418a421fe
commit bbdd30fc3d
3 changed files with 21 additions and 1 deletions

View File

@ -26,6 +26,7 @@
;; Dockerfile
dockerfile-mode
;; Python
pyvenv
cython-mode
py-autopep8
;; Rust
@ -96,6 +97,9 @@
;; Note that this package require autopep8 to be installed.
:bind (("C-c C-f" . py-autopep8-buffer)))
(use-package pyvenv
:defer t)
;; --------------------------------------------------------------------------
;; Rust.
;; --------------------------------------------------------------------------

View File

@ -59,6 +59,17 @@
(persp-format-name (persp-name (persp-curr)))
""))
;; Display active python virtualenv.
(defface pyvenv-active-face
'((t (:inherit persp-selected-face)))
"The face used to highlight the active virtualenv on the modeline.")
(doom-modeline-def-segment pyvenv-venv
"Active Python virtualenv. Requires `pyvenv' to be enabled."
(if (bound-and-true-p pyvenv-virtual-env-name)
(propertize pyvenv-virtual-env-name 'face 'pyvenv-active-face)
""))
;; Necessary to play nice with Helm.
(add-hook 'helm-minibuffer-set-up-hook
(lambda ()
@ -70,7 +81,7 @@
;; Define custom modeline.
(doom-modeline-def-modeline 'my-line
'(bar "[" perspective-name "]" window-number matches buffer-info remote-host buffer-position selection-info)
'(lsp debug major-mode vcs checker bar))
'(lsp debug pyvenv-venv major-mode vcs checker bar))
(add-hook 'doom-modeline-mode-hook
(lambda () (doom-modeline-set-modeline 'my-line 'default))))

View File

@ -181,6 +181,11 @@
`(persp-selected-face ((t (:foreground ,*line-perspective* :weight bold))))
`(eyebrowse-mode-line-active ((t (:foreground ,*line-eyebrowse* :weight bold))))
;; ---------------------------------------------------------------------
;; Pyvenv virtualenv.
;; ---------------------------------------------------------------------
`(pyvenv-active-face ((t (:foreground ,*line-perspective* :weight bold))))
;; ---------------------------------------------------------------------
;; Header line.
;; ---------------------------------------------------------------------