I generated new .env
file with copy .env.example .env
command in PhpStorm terminal. Then created .env file then but I can't edit in PhpStorm. When I double clicked it's open external editor (Notepad++).
Asked
Active
Viewed 6,696 times
1
-
1This is really strange. I open thos file normally in PhpStorm without any problems. – Marcin Nabiałek Jun 04 '16 at 11:30
3 Answers
16
Settings/Preferences | Editor | File Types
- Find
Files Opened in Associated Application
entry in the top list - Remove associated entry for
.env
files from the bottom list (Registered Patterns). - Re-associate such pattern with another (more appropriate) File Type (e.g. "Text Files" .. or whatever other format that would be)
P.S. There is .env files support plugin that adds file icon & syntax coloring for .env
files and code completion helper in certain languages (PHP in particular):
https://plugins.jetbrains.com/plugin/9525--env-files-support
Features:
- Environment variables completion based on .env, Dockerfile and docker-compose.yml files.
- Go to declaration (in .env file) and usages(in code), by Ctrl / Cmd + Click or hot key (Ctrl / Cmd + B, etc.)
- .env file syntax highlighter
UPDATE: 2022-01-13
For the modern IDE versions (v2020.3.x and newer) check the following StackOverflow answer. The IDE now has more options that can affect the way how IDE treats specific file: https://stackoverflow.com/a/65701638/783119

LazyOne
- 158,824
- 45
- 388
- 391
1
There is a plugin for .env files. It also helps by autocompleting env() and getenv() functions. https://plugins.jetbrains.com/plugin/9525--env-files-support

Adelf
- 706
- 4
- 12
1
Go to file -> settings -> Editor -> File Types -> Recognized file types and select the "Text" -> add some patterns
.evn
*.env
.evn.*
*.env.*

Najathi
- 2,529
- 24
- 23