micro
micro copied to clipboard
Syntax highlight code for .env files
syntax highlight code for .env type files
Would it make sense to instead simply use the bash/shell highlighting?
You could also add the .envrc
filename as well.
diff --git a/runtime/syntax/sh.yaml b/runtime/syntax/sh.yaml
index 329b1014..c87c243c 100644
--- a/runtime/syntax/sh.yaml
+++ b/runtime/syntax/sh.yaml
@@ -8,11 +8,12 @@ filetype: shell
#
# Special filenames:
# * .bashrc, .bash_aliases, .bash_functions .bash_profile
+# * .env, .envrc (dotenv and direnv)
# * profile, .profile (/etc/profile or ~/.profile)
# * Pkgfile
# * pkgmk.conf
@@ -23,7 +24,7 @@ filetype: shell
# Fix command (fc) files:
# * bash-fc. (followed by a random string)
detect:
- filename: '(\.(sh|bash|ash|ebuild)$|(\.bash(rc|_aliases|_functions|_profile)|\.?profile|Pkgfile|pkgmk\.conf|rc\.conf|PKGBUILD|APKBUILD)$|bash-fc\.)'
+ filename: '(\.(sh|bash|ash|ebuild)$|(\.bash(rc|_aliases|_functions|_profile)|\.env(rc)?|\.?profile|Pkgfile|pkgmk\.conf|rc\.conf|PKGBUILD|APKBUILD)$|bash-fc\.)'
header: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)"
rules:
?
I don't see why not leave it separate. The sh file seems to have more to it.
.env
files are just source
d into shell
diff --git a/runtime/syntax/sh.yaml b/runtime/syntax/sh.yaml index 329b1014..c87c243c 100644 --- a/runtime/syntax/sh.yaml +++ b/runtime/syntax/sh.yaml @@ -8,11 +8,12 @@ filetype: shell # # Special filenames: # * .bashrc, .bash_aliases, .bash_functions .bash_profile +# * .env, .envrc (dotenv and direnv) # * profile, .profile (/etc/profile or ~/.profile) # * Pkgfile # * pkgmk.conf @@ -23,7 +24,7 @@ filetype: shell # Fix command (fc) files: # * bash-fc. (followed by a random string) detect: - filename: '(\.(sh|bash|ash|ebuild)$|(\.bash(rc|_aliases|_functions|_profile)|\.?profile|Pkgfile|pkgmk\.conf|rc\.conf|PKGBUILD|APKBUILD)$|bash-fc\.)' + filename: '(\.(sh|bash|ash|ebuild)$|(\.bash(rc|_aliases|_functions|_profile)|\.env(rc)?|\.?profile|Pkgfile|pkgmk\.conf|rc\.conf|PKGBUILD|APKBUILD)$|bash-fc\.)' header: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)" rules:
?
@MavlinD What do you think? To me it makes sense and would be one less file. Would you just add \.env(rc)?
| in the detect.filename
of the sh.yaml file.