2021-02-21 13:40:47 +00:00
|
|
|
;; Smooth integration with direnv
|
|
|
|
(use-package direnv
|
|
|
|
:if (executable-find "direnv")
|
|
|
|
:defer 2
|
2021-03-09 15:26:04 +00:00
|
|
|
:init
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.env\\'" . shell-script-mode))
|
2021-04-05 14:45:54 +00:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.env.local\\'" . shell-script-mode))
|
2021-02-21 13:40:47 +00:00
|
|
|
:config
|
|
|
|
(direnv-mode)
|
|
|
|
(add-hook 'eshell-mode-hook #'direnv-update-directory-environment)
|
|
|
|
(add-hook 'eshell-directory-change-hook
|
2021-02-22 14:43:04 +00:00
|
|
|
(lambda ()
|
|
|
|
(unless (file-remote-p default-directory)
|
|
|
|
(direnv-update-directory-environment))))
|
|
|
|
(add-hook 'vterm-directory-change-hook
|
2021-02-21 13:40:47 +00:00
|
|
|
(lambda ()
|
|
|
|
(unless (file-remote-p default-directory)
|
2021-03-23 15:27:36 +00:00
|
|
|
(direnv-update-directory-environment))))
|
|
|
|
:custom
|
|
|
|
(direnv-always-show-summary nil))
|
2021-02-21 13:40:47 +00:00
|
|
|
|
|
|
|
(provide 'init-direnv)
|