UTF-8 all the things

If you’re using OS X, open up your shell and run the following commands to “set your default character encoding to UTF-8,” which basically means “understand worldwide characters instead of just ones from the boring U.S.A.” If you’re typing instead of cutting and pasting, make sure you’re using >> - two greater-than symbols - not ».

echo 'export LC_ALL=en_US.UTF-8' >> ~/.bash_profile
echo 'export LANG=en_US.UTF-8' >> ~/.bash_profile

Customizing your text editor

IDE’s are great (in theory) because they do things like notice typos and help you along with your coding. We need to give our text editor a little nudge to make sure it does what we want, though.

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 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. Install minimap and autocomplete-python

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, minimap lets you see where in your code you’re at. You can install minimap by going back to the Install section of Preferences and searching for minimap (be sure you pick the one with the plain name minimap, not any of the minimap-plus-other-things plugins).

Do the same with autocomplete-python.

5. 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 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.

3. Adding Python support

Visual Studio Code can also give us a hand when we’re working on Python files.

Select View > Extensions from the top menu, then type Python. Click ‘Install’ for the first result (by Don Jayamanne), wait a few seconds, then click ‘Reload’.

When you create a new Python file, it might ask if you want to do crazy things like “install a linter” - just agree!

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!

4. Installing Python support

Maybe you’ll have more luck than me installing the most popular Python add-on ever, but you can find it along with installation instructions here. It’s called anaconda, but don’t get it confused with the Python installer that’s also called Anaconda. Snake jokes, ‘eh?