Plugin for Visual Studio Code

This commit is contained in:
Craig Reynolds 2015-11-29 21:16:22 +08:00
commit ec9265694f
2 changed files with 34 additions and 0 deletions

View file

@ -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 -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
open -a "Visual Studio Code" "$argPath"
fi
}