Diff
1diff --git a/plugins/dotenv/README.md b/plugins/dotenv/README.md
2index cac552485ffcf1cc7884223d9b132bf4d45523b4..dbc02bf61b58fd7baf9e2298f40340a33afee809 100644
3--- a/plugins/dotenv/README.md
4+++ b/plugins/dotenv/README.md
5@@ -32,6 +32,8 @@ PORT=3001
6 ```
7 You can even mix both formats, although it's probably a bad idea.
8
9+## Plugin options
10+
11 ### ZSH_DOTENV_FILE
12
13 You can also modify the name of the file to be loaded with the variable `ZSH_DOTENV_FILE`.
14@@ -43,6 +45,10 @@ For example, this will make the plugin look for files named `.dotenv` and load t
15 ZSH_DOTENV_FILE=.dotenv
16 ```
17
18+### ZSH_DOTENV_PROMPT
19+
20+Set `ZSH_DOTENV_PROMPT=false` in your zshrc file if you don't want the confirmation message.
21+
22 ## Version Control
23
24 **It's strongly recommended to add `.env` file to `.gitignore`**, because usually it contains sensitive information such as your credentials, secret keys, passwords etc. You don't want to commit this file, it's supposed to be local only.
25diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh
26index d4a6db8f842c3856ad5424c578b4bfc4dd64dd7b..84815a416b5ca44b54d62f0fc8c1f6c627da5c9a 100644
27--- a/plugins/dotenv/dotenv.plugin.zsh
28+++ b/plugins/dotenv/dotenv.plugin.zsh
29@@ -1,10 +1,13 @@
30 source_env() {
31 if [[ -f $ZSH_DOTENV_FILE ]]; then
32- # confirm before sourcing .env file
33- local confirmation
34- echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
35- if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then
36- return
37+
38+ if [ "$ZSH_DOTENV_PROMPT" != "false" ]; then
39+ # confirm before sourcing file
40+ local confirmation
41+ echo -n "dotenv: source '$ZSH_DOTENV_FILE' file in the directory? (Y/n) "
42+ if read -k 1 confirmation && [[ $confirmation = [nN] ]]; then
43+ return
44+ fi
45 fi
46
47 # test .env syntax