Skip to content

Conversation

@MavlinD
Copy link

@MavlinD MavlinD commented Jan 20, 2022

syntax highlight code for .env type files

@MavlinD MavlinD changed the title Create env.yaml Syntax highlight code for .env files Jan 20, 2022
@pbsds
Copy link
Contributor

pbsds commented Jul 17, 2022

Would it make sense to instead simply use the bash/shell highlighting?
You could also add the .envrc filename as well.

add: envrc ext file
@pbsds
Copy link
Contributor

pbsds commented Oct 24, 2022

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:

?

@taconi
Copy link
Contributor

taconi commented Mar 17, 2024

I don't see why not leave it separate.
The sh file seems to have more to it.

@pbsds
Copy link
Contributor

pbsds commented Mar 17, 2024

.env files are just sourced into shell

@taconi
Copy link
Contributor

taconi commented Mar 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants