Skip to content

Instantly share code, notes, and snippets.

@ResidentMario
Last active August 11, 2023 02:56
Show Gist options
  • Save ResidentMario/0895eed3f82a151c7e4d98a8b85f75af to your computer and use it in GitHub Desktop.
Save ResidentMario/0895eed3f82a151c7e4d98a8b85f75af to your computer and use it in GitHub Desktop.
Shell settings

This gist contains my development environment settings. The idea is that I should be able to reproduce my development environment from scratch.

  1. Download and install iTerm2.

  2. Download and install Oh My Zsh: http://ohmyz.sh/.

  3. Install Powerline fonts: https://github.com/powerline/fonts.

  4. Download and unzip the theme pack: https://github.com/mbadolato/iTerm2-Color-Schemes/zipball/master.

  5. In the iTerm2 settings go to Preferences > Profile > Colors > Color Presets > Import, and select the correct theme from the theme pack. It will be in the schemes folder.

  6. Remove the machine name from the prompt by running cd ~/.oh-my-zsh/themes/; sed -i -e 's/@%m//g' agnoster.zsh-theme.

    The machine name seems to be derived from the machine name set by the kernel, but modifying this in settings did not get rid of the overlong Alex-MacBook prompt. This does.

    Note that this counts as an edit to a git-tracked repository, causing it to diverge from the cloned master. This may or may not cause problems should you ever want to upgrade oh-my-zsh. If it does, just remove the changes and rerun the command after updating.

  7. Set theme to "agnoster" in the Oh My Zsh config.

  8. Set "font" in iTerm to Hack.

  9. Copy the rest of the config (e.g. conda configuration) to ~/.zshrc.

  10. Append conda deactivate to ~/.zshrc to get rid of that (base) initialization.

  11. Set window size to 120x36 in the iTerm settings.

  12. Set my plugins in Oh My Zsh: plugins=(git pip brew docker kubectl npm pylint python web-search).

  13. Install htop: brew install htop.

  14. Install the GitHub CLI tool: brew install github/gh/gh.

  15. Turn off the less pager for git (go back to dumb cat output): git config --global pager.branch false.

  16. The zsh shell font will not work in VS Code fully correctly for reasons. To fix this, install the Menlo for Powerline font, and switch to that in Font Settings. Instructions for Linux here; only difference on macOS is that it's easiest to open the font (double click) and install it using the Font Book app.

  17. In the VS Code keyboard shortcuts editor, swap the ^ + # (which control editor selection) shortcuts with Command + # shortcuts (which control something else I don't use or care about). Every other tool I use (Firefox and ZSH) binds opening tabs by number to Command, VS Code is the exception in this regard so I edit it to use my preferred bindings.

  18. Install f.lux and enable "Inherit Dark Mode from System" (or similar) on all of my locally installed applications. Note: I have f.lux set to 9:00 AM rise time.

  19. Create a "Dark Mode" profile in iTerm2 using default Dark Theme colors.

  20. Add the following aliases the ~/.zshrc:

    alias settestcommit="git stash && (git branch -D test-commit-branch || true) && git checkout -B test-commit-branch && git stash pop && git commit -a -m 'Apply testing commit.' && git checkout @{-1}"
    alias applytestcommit="git log -n 1 test-commit-branch --pretty=format:'%H' | xargs git cherry-pick"

    This sets the current set of changes as a test commit on a special branch and makes it easy to apply this specific commit to the current branch later on. Very useful for testing purposes, as you don't need to remember what switches you need to flip to toggle a codebase to or from a test state.

  21. In VSCode settings find window.AutoDetectColorScheme and enable it. This tells VSCode to inherit the color scheme (light mode / dark mode) from the OS. Also need to do this in Slack.

  22. Install my suite of VSCode extensions: Python (publisher: Microsoft), Pylance (Microsoft), Jupyter Notebook Renderers (Microsoft), Jupyter Keymap (Microsoft), Jupyter (Microsoft), Docker (Microsoft), Back and Forward buttons (grimmer), GitLens (GitKraken), Go (Go Team at Google), Live Preview (Microsoft), markdownlint (David Anson).

  23. Follow the instructions here to turn on Pylint (pip install pylint first) and set it up to use the Black rule-set. See also the Black docs for some justification for these otherwise magical strings. Note that the blog post author was wrong to insert spaces around the equals (=) on the liens that have it, this breaks things—remove these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment