diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md new file mode 100644 index 000000000..64216463f --- /dev/null +++ b/plugins/vscode/README.md @@ -0,0 +1,17 @@ +## Visual Studio Code + +Plugin for Visual Studio Code, a text editor for Mac OS X, Windows, and Linux + +### Requirements + + * [Visual Studio Code](https://code.visualstudio.com) + +### Usage + + * If the `code` command is called without an argument, launch VS Code + + * If `code` is passed a directory, cd to it and open it in VS Code + + * If `code` is passed a file, open it in VS Code + +*NOTE: `vscode` can be used as an alias in place of `code`* \ No newline at end of file diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh new file mode 100644 index 000000000..52d3f4583 --- /dev/null +++ b/plugins/vscode/vscode.plugin.zsh @@ -0,0 +1,17 @@ +alias vscode='code' + +# +# If the code command is called without an argument, launch VS Code +# If code is passed a directory, cd to it and open it in VS Code +# If code is passed a file, open it in VS code +# +function code { + if [[ $# = 0 ]] + then + open_command -a "Visual Studio Code" + else + local argPath="$1" + [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}" + open_command -a "Visual Studio Code" "$argPath" + fi +}