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 |
better to use official launcher, it resolves relative urls
code /etc/hosts code ../hosts
https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line
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.
this wont support flags like
--disable-extensions
! any solution?