Extra Setup
UTF-8 all the things (OS X only)
If you’re using OS X, open up the command line and paste in the following commands. They will “set your default character encoding to UTF-8,” which basically means “understand worldwide characters instead of just boring U.S.A. characters.” If you’re typing instead of cutting and pasting, make sure you use >>
— two greater-than symbols — not »
. Also, be sure to hit enter after pasting in the second line.
echo 'export LC_ALL=en_US.UTF-8' >> ~/.bash_profile
echo 'export LANG=en_US.UTF-8' >> ~/.bash_profile
If you do it right, it won’t say anything (but I promise it worked!).
Customizing your text editor
You don’t have to do this stuff if you don’t want to! Your life will be nicer if you do, though.
A big big thing in Python is spaces vs. tabs. We’ll probably talk more about it on the first day of class, but spacing is very important in Python, and we like to use spaces to do it. 2 spaces, in fact. The first thing we’re going to do is set up our text editor to automatically use 2 spaces when we hit tab.
Customizing Visual Studio Code
1. Open up Preferences
Open up your Preferences menu in Visual Studio Code through selecting Code
from the top menu, then Preferences
> Settings
(OS X, Windows probably uses the File
menu).
2. Fix the spacing
Type ‘tab’ into the search box up at the top of the Settings screen.
- Editor: Insert Spaces should be checked
- Editor: Tab Size should be set to
2
3. Add a minimap
If you have a large file, it’s sometimes hard to know exactly where you’re at. Near the top? At the bottom? Somewhere in the middle? Helpfully, turning on the minimap lets you see where in your code you’re at.
Type ‘minimap’ into the search bar at the top of the Settings screen.
Editor > Minimap: Enabled should be checked
4. Don’t accept suggestions on Enter
You know how sometimes autocomplete on your phone can be good, and sometimes it can be terrible?
Sometimes when you’re typing the editor thinks it knows what you want to type, and says “if you like this idea, press enter!” But sometimes you’d like to press enter to just go to the next line, not to accept the suggestion. This clears that up!
Type ‘suggestion’ into the search bar at the top of the Settings screen.
Editor: Accept Suggestions on Enter should be set to off
. You can set it to smart
if you’re feeling especially wild.