Put this in your config.fish
run
code path/to/project
| function code | |
| set location "$PWD/$argv" | |
| open -n -b "com.microsoft.VSCode" --args $location | |
| end |
if you already have an alias named 'code', like I do, I think this is a great alternative. I don't find any option to use the official launcher under a different alias
This would be closer to the way it works in BASH and ZSH:
function code --wraps='/Applications/Visual Studio Code 2.app/Contents/Resources/app/bin/code' --description 'alias code /Applications/Visual Studio Code 2.app/Contents/Resources/app/bin/code'
/Applications/Visual\ Studio\ Code\ 2.app/Contents/Resources/app/bin/code $argv;
end
I used FISH's "alias" command to generate the function, and then I edited the function to add the escape characters for the spaces in the path.
Visual code has a new way to add code into your PATH env, if you're not already using code as a command for other thing ....
⌘ + SHIFT + P (mac) or ALT+SHIFT+P (windows/linux);ENTER;This should add code command into your PATH
better to use official launcher, it resolves relative urls
code /etc/hosts code ../hostshttps://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line