Skip to content
Permalink
Browse files
added info on opening editor from terminal
  • Loading branch information
aa7401 committed Jul 10, 2017
1 parent 1f402a4 commit 7b0a6efe3a32ca9e600c8daef75cd52fc785e5e5
Showing 1 changed file with 8 additions and 6 deletions.
@@ -105,13 +105,15 @@ Note that you may need to update the configuration database before Visual Studio
sudo apt-get update && sudo apt-get install libgconf2-4
```

### Launching a code editor from the Terminal
### Launching Visual Studio Code 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.
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.

- `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_.

If you are using Ubuntu this works 'out of the box' but if you are using MacOS you will need to edit 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 Visual Studio Code using the same commands as Ubuntu.

0 comments on commit 7b0a6ef

Please sign in to comment.