dotfiles/emacs/.emacs.d/config/init-direnv.el
2021-04-05 10:45:54 -04:00

23 lines
712 B
EmacsLisp

;; Smooth integration with direnv
(use-package direnv
:if (executable-find "direnv")
:defer 2
:init
(add-to-list 'auto-mode-alist '("\\.env\\'" . shell-script-mode))
(add-to-list 'auto-mode-alist '("\\.env.local\\'" . shell-script-mode))
:config
(direnv-mode)
(add-hook 'eshell-mode-hook #'direnv-update-directory-environment)
(add-hook 'eshell-directory-change-hook
(lambda ()
(unless (file-remote-p default-directory)
(direnv-update-directory-environment))))
(add-hook 'vterm-directory-change-hook
(lambda ()
(unless (file-remote-p default-directory)
(direnv-update-directory-environment))))
:custom
(direnv-always-show-summary nil))
(provide 'init-direnv)