How to permanently open the Visual Studio Code with code . command in terminal

Krishna Bagale

--

  • At first, open your terminal and go to your root user directory. Something like /Users/krishnabagale
  • Type open -t .bash_profile
  • Then add the following path to .bash_profile

code () { VSCODE_CWD=”$PWD” open -n -b “com.microsoft.VSCode” — args $*

  • Save the bash profile and quit the terminal. Now you can open any file/folder to VsCode with code .

--

--

No responses yet

Write a response