From 66ac7ff0c2deb184882455ee9ccf6e1f99da915e Mon Sep 17 00:00:00 2001 From: gajanangitte Date: Thu, 22 Oct 2020 23:16:22 +0530 Subject: [PATCH] Node plugin completely revamped. Added aliases. --- plugins/node/README.md | 34 +++++++++++++++++++++++++++------- plugins/node/node.plugin.zsh | 17 +++++++++++++++++ 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/plugins/node/README.md b/plugins/node/README.md index 911b6693b..f5be674b1 100644 --- a/plugins/node/README.md +++ b/plugins/node/README.md @@ -1,15 +1,25 @@ # node plugin -This plugin adds `node-docs` function that opens specific section in [Node.js](https://nodejs.org) -documentation (depending on the installed version). +This plugin provides many a aliases and a few `node-docs` functions. -To use it, add `node` to the plugins array of your zshrc file: +## Aliases -```zsh -plugins=(... node) -``` +| Alias | Command | +|:---------------------|:-------------------------------------------------------------------------------| +| nd | node | +| ndc | node --check | +| nde | node --eval "script" | +| ndh | node --help | +| ndi | git --interactive | +| ndr | git --require module | +|----------------------|--------------------------------------------------------------------------------| +| ndnd | node --no-depreciation | +| ndnw | node --no-warnings | +| ndtw | node --trace-warnings | +| ndv8 | node --V8-options | +|----------------------|--------------------------------------------------------------------------------| -## Usage +## Functions ```zsh # Opens https://nodejs.org/docs/latest-v10.x/api/fs.html @@ -17,3 +27,13 @@ $ node-docs fs # Opens https://nodejs.org/docs/latest-v10.x/api/path.html $ node-docs path ``` + +This plugin adds `node-docs` function that opens specific section in [Node.js](https://nodejs.org) +documentation (depending on the installed version). + +## Add plugin +To use it, add `node` to the plugins array of your zshrc file: + +```zsh +plugins=(... node) +``` \ No newline at end of file diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index e196662c7..be26f7df8 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -4,3 +4,20 @@ function node-docs { local section=${1:-all} open_command "https://nodejs.org/docs/$(node --version)/api/$section.html" } + +# initialise node +alias nd='node' + +# Checkout the README.md for +# detailed explanation +alias ndv='node --version' +alias ndc='node -c' +alias nde='node -e' +alias ndh='node -h' +alias ndi='node -i' +alias ndr='node -r' + +alias ndnd='node --no-depreciation' +alias ndnw='node --no-warnings' +alias ndtw='node --trace-warnings' +alias ndv8='node --V8-options' \ No newline at end of file