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. Feel free to skip to the next step or come back to this later.

A big big thing in Python is spaces vs. tabs. We’ll 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.

Pick the section with the text editor you chose!

Customizing Visual Studio Code (VS Code only)

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 and add a minimap

We’re going to use this to set tabs as spaces, and also 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.

Paste the following lines into the pane on the right-hand side.

// Place your settings in this file to overwrite the default settings
{
  "editor.insertSpaces": true,
  "editor.tabSize": 2,
  "editor.minimap.enabled": true
}

then select File > Save to save your changes.

Customizing Atom (Atom only!)

1. Open up Preferences

Open up your Preferences menu in Atom through either Atom > Preferences (OS X) or File > Settings (Windows).

2. Auto-fix the spacing

Click the Editor tab in Preferences, scrolllll down and update the settings for Soft Tabs (yes) and Tab Length (2).

3. Stop the enter key from autocompleting

You know how sometimes autocomplete on your phone can be good, and sometimes it can be terrible?

It’s the same with Atom. You usually use the tab key to say “yes, sure, I like your programming-thing suggestion” but by default Atom also has the enter key accept autocomplete. This is terrible when you’re just trying to go down to the next line and ignore the suggestion!

To turn it off, select the Keybindings tab, then click the link that says your keymap file. Scroll down to the bottom and paste the following in.

# Disable Enter key for confirming an autocomplete suggestion
'atom-text-editor:not(mini).autocomplete-active':
  'enter': 'editor:newline'

Be sure to save.

4. Restart Atom

Now that you’ve installed all of these awesome additions to Atom, you’ll need to restart it for everything to take effect.

Customizing Sublime Text (Sublime Text only)

1. Opening up Preferences

Find the preferences customization by selecting Sublime Text or File from the top menu, then Preferences > Settings.

2. Updating spacing options

Paste the code below in the right-hand pane.

{
  "tab_size": 2,
  "translate_tabs_to_spaces": true
}

3. Turning on the minimap

If you’re dealing with a big file, sometimes it’s good to know where in the file you are. Select View and Show Minimap. You can also turn it off just as easily!