Diff
1diff --git a/plugins/gitignore/README.md b/plugins/gitignore/README.md
2index 23c7887cfef4720e14428d6d8c0fb5f5a5fef3cd..ea991a95139290bee813f28fa451cce4183c33ce 100644
3--- a/plugins/gitignore/README.md
4+++ b/plugins/gitignore/README.md
5@@ -1,6 +1,6 @@
6 # gitignore
7
8-This plugin enables you the use of [gitignore.io](https://www.toptal.com/developers/gitignore) from the command line. You need an active internet connection.
9+This plugin enables you to use [gitignore.io](https://www.gitignore.io) from the command line. You need an active internet connection to fetch templates. The plugin uses the gitignore.io CDN endpoint to simplify access and improve reliability.
10
11 To use it, add `gitignore` to the plugins array in your zshrc file:
12
13@@ -14,4 +14,4 @@ plugins=(... gitignore)
14
15 * `gi [TEMPLATENAME]`: Show git-ignore output on the command line, e.g. `gi java` to exclude class and package files.
16
17-* `gi [TEMPLATENAME] >> .gitignore`: Appending programming language settings to your projects .gitignore.
18+* `gi [TEMPLATENAME] >> .gitignore`: Append the template rules to your project's `.gitignore` file.
19diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
20index 3271d61a99a52cb4196898c09967a71708c85b34..a9f3f645396b7871fb078143deea7e6ac52945e6 100644
21--- a/plugins/gitignore/gitignore.plugin.zsh
22+++ b/plugins/gitignore/gitignore.plugin.zsh
23@@ -1,12 +1,21 @@
24-function gi() { curl -fLw '\n' https://www.toptal.com/developers/gitignore/api/"${(j:,:)@}" }
25+# gitignore plugin for oh-my-zsh
26+# Uses gitignore.io CDN endpoint
27+function _gi_curl() {
28+ curl -sfL "https://www.gitignore.io/api/$1"
29+}
30+
31+function gi() {
32+ local query="${(j:,:)@}"
33+ _gi_curl "$query" || return 1
34+}
35
36 _gitignoreio_get_command_list() {
37- curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr "," "\n"
38+ _gi_curl "list" | tr "," "\n"
39 }
40
41 _gitignoreio () {
42 compset -P '*,'
43- compadd -S '' `_gitignoreio_get_command_list`
44+ compadd -S '' $(_gitignoreio_get_command_list)
45 }
46
47-compdef _gitignoreio gi
48+compdef _gitignoreio gi