Major mode for .envrc files
leungbk opened this issue · 4 comments
leungbk commented
The direnv.el
package has the following:
;;;###autoload
(define-derived-mode direnv-envrc-mode
sh-mode "envrc"
"Major mode for .envrc files as used by direnv.
Since .envrc files are shell scripts, this mode inherits from sh-mode.
\\{direnv-envrc-mode-map}")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.envrc\\'" . direnv-envrc-mode))
I feel like this package should include a major mode for .envrc
files as well.
purcell commented
Yep, probably so.
manuel-uberti commented
Could this benefit of some extra font locking as well? I am doing it like this at the moment:
(defvar mu-direnv-keywords
'("MANPATH_add" "PATH_add" "direnv_layout_dir" "direnv_load" "dotenv"
"expand_path" "find_up" "has" "join_args" "layout" "load_prefix"
"log_error" "log_status" "path_add" "rvm" "source_env" "source_up"
"use" "use_guix" "use_nix" "user_rel_path" "watch_file")
"Useful direnv keywords to be highlighted.")
(define-derived-mode mu-direnv-rc-mode sh-mode "envrc"
"Major mode for .envrc files."
(font-lock-add-keywords
nil `((,(regexp-opt mu-direnv-keywords 'symbols)
(0 font-lock-keyword-face)))))
Edit: sorry, this is for direnv-mode
, but still something like this for envrc-file-mode
could be useful I guess. :)
purcell commented
Done, thanks @manuel-uberti !
manuel-uberti commented
Awesome. :)