Skip to content

Instantly share code, notes, and snippets.

@rtorr
Last active February 26, 2023 20:39
  • Star 21 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rtorr/233bf6ffd81b6ecdf534 to your computer and use it in GitHub Desktop.
Visual Studio Code fish shell shortcut

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
@madsem
Copy link

madsem commented Jul 8, 2019

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

@duganchen
Copy link

duganchen commented Feb 13, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment