Skip to content
Permalink
Browse files
added notes
running visual studio code from terminal
  • Loading branch information
aa7401 committed Jun 23, 2017
1 parent 2893cf7 commit ebeca078f8e9e425888e4d94a8df926d621f0b28
Showing 1 changed file with 12 additions and 1 deletion.
@@ -103,4 +103,15 @@ There are plenty of choices when it comes to editors. The examples in this book
Note that you may need to update the configuration database before Visual Studio Code will install.
```
sudo apt-get update && sudo apt-get install libgconf2-4
```
```

### Launching a code editor from the Terminal

You will be spending a lot of time in the terminal so here is a useful tip. If you have visual studio code installed you can launch it with the contents of a specified directory. Start by editing your `.bash_profile` file located in your home directory. Since this is hidden by default you can open it in **nano** using `nano ~/.bash_profile`. Now add the following line, save the changes and exit.
```
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
```
Close the terminal and re-launch. Now you can open any directory.

- `code ~/Documents/bookshop/` opens Visual Studio Code with the contents of the directory specified.
- `code .` opens Visual Studio Code with the contents of the _current directory_.

0 comments on commit ebeca07

Please sign in to comment.