Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command-line alias for Visual Studio Code on OS X with CSH?

The VS Code editor is nice, and I'm looking forward to using it to learn a bit more about javascript and node.js. The installation instructions describe the setup for bash-like shells, but I am a savage and would like to use it with csh. I can probably hack something together, but is there an obvious translation of

code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* }

into a csh alias?

I think this sort of works:

alias code "setenv VSCODE_CWD ${PWD} && open -n -b "com.microsoft.VSCode" --args $*"

but I think I really want a way to make VSCODE_CWD "local" to the alias, as in the bash version.

like image 496
Andrew Jaffe Avatar asked Oct 19 '22 08:10

Andrew Jaffe


1 Answers

You can also create a code script in your PATH with the contents:

#!/bin/sh
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*
like image 106
João Moreno Avatar answered Oct 22 '22 00:10

João Moreno