summaryrefslogtreecommitdiff
path: root/plugins/node
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/node')
-rw-r--r--plugins/node/README.md16
-rw-r--r--plugins/node/node.plugin.zsh3
2 files changed, 18 insertions, 1 deletions
diff --git a/plugins/node/README.md b/plugins/node/README.md
new file mode 100644
index 000000000..c392dc0bf
--- /dev/null
+++ b/plugins/node/README.md
@@ -0,0 +1,16 @@
+# node plugin
+
+To use it, add `node` to the plugins array of your zshrc file:
+```zsh
+plugins=(... node)
+```
+
+This plugin adds `node-docs` function that open specific section in [Node.js](https://nodejs.org) documentation (depending on the installed version).
+For example:
+
+```zsh
+# Opens https://nodejs.org/docs/latest-v10.x/api/fs.html
+$ node-docs fs
+# Opens https://nodejs.org/docs/latest-v10.x/api/path.html
+$ node-docs path
+```
diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh
index 2463815ac..e196662c7 100644
--- a/plugins/node/node.plugin.zsh
+++ b/plugins/node/node.plugin.zsh
@@ -1,5 +1,6 @@
# Open the node api for your current version to the optional section.
# TODO: Make the section part easier to use.
function node-docs {
- open_command "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
+ local section=${1:-all}
+ open_command "https://nodejs.org/docs/$(node --version)/api/$section.html"
}