Skip to content
/ FigTree Public template

A command line configuration utility to ensure a consistent experience across every terminal.

Notifications You must be signed in to change notification settings

imyourmanzi/FigTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fig Tree

A command line configuration utility to ensure a consistent experience across every terminal.

Installation and Usage

  1. git clone https://github.com/imyourmanzi/FigTree.git ~/.fig

  2. (Optional) Exclude certain seeds: cp ~/.fig/default.noseed ~/.fig/.noseed and then uncomment the ones to exclude

  3. ~/.fig/plant

    1. FIG_DEBUG=true ~/.fig/plant for debugging detail
    2. FIG_TRACE=true ~/.fig/plant for even more detail
  4. Start a new shell to see it work

    1. Running fig will take you to your installation of Fig Tree
  5. Run fig update to pull latest changes from your upstream

  6. Run fig repot to rerun plant on an existing installation

Environment Variables

Fig Tree defines these custom (and potentially useful) environment variables in your shell's environment.

  • FIG_HOME: where Fig Tree was planted (including where the plant script lives)

Included Functionality

bat

If available, use bat instead of cat.

exit

Simple alias of x to exit current shell session. Ctrl-D might be faster for some but I've always liked single letter aliases.

Golang

Set your Golang install location to be $HOME/.go, which I found helped with things, particularly on macOS.

Homebrew

Set up conveniences for Homebrew that you probably want anyway (e.g. update $PATH, tab completion).

ip

My preferred defaults for the ip command (there was a time when I was using this a lot).

ls or eza

If available, use eza and alias to ls/etc. to it.

Otherwise, just provide some of my preferred defaults for vanilla ls.

Memes

Enjoy some silly SFW aliases.

  • kk
  • imdone

nvm

Improvements I made to nvm. Get the full details here.

For your .zshrc file:

# use this string to change the Node version placeholder for pre-nvm init
# (note: escape sequences may not be supported by your theme)
#DEFAULT_NVM_CURRENT=""
# use this array to add to the default list of commands that require Node
#INIT_NVM_COMMANDS=('mynospacecommand')

Oh My Zsh

Play nicely with Oh My Zsh.

In .zshrc, all Oh My Zsh configuration variables should be set before the source ... line for Fig Tree.

Themes

Use OMZ_THEME_RANDOM_CANDIDATES for the ZSH_THEME_RANDOM_CANDIDATES variable.

Plugins

By default, these plugins are enabled:

  • git
  • fzf (used for history and recursive search)

Use OMZ_PLUGINS in the same way you'd define the plugins variable to override the defaults.

persist

If you need to keep your macOS system from sleeping/idling, now you'll be able to do that with infinite more cool-factor, and you can avoid burn-in.

pwd

My preferred defaults for pwd.

pyenv

My preferred default configuration for pyenv.

Rust

Set your Rust install location to be $HOME/.go, which I found helped with things, particularly on macOS.

Shell History

My preferred configuration defaults for shell history (Bash only).

Shell Prompt

My preferred default shell prompt (Bash only).

show-files

macOS alias to quickly show or hide hidden files in Finder.

Swift

My preferred configuration defaults for Swift developments.

up

Shortcut for cd ..[/..[/..[ ... ]]].

Usage: up or up <n> (e.g. up 2 to go up two directories instead of the default 1).

Vim

My preferred defaults for using Vim.

Word Jump

Allow Opt–Left/Opt-Right navigation around words in your current command.

Special Case: Grown Perennials

Perennials that are "grown" are ones that copy in an existing configuration file (if present) and modify it. Then, they link that final (grown) version back to where it needs to be.

The only way to update a grown perennial with changes from an upstream repository (i.e. with changes that were not directly made to the .grown file) is to re-run the plant script.

APT

Will prompt you for input and ask for root permissions to run apt install.

If Homebrew is installed, that will be the preferred package manager and this perennial will not run.

Packages installed:

  • cmatrix
  • eza (aliased to ls)
  • bat (may be batcat, aliased to cat)
  • ripgrep (rg)
  • fd-find (fdfind)
  • fzf

Homebrew

Will prompt you for input if Homebrew is installed.

This is the favored package manager. Even if your system has multiple installed/available, only Homebrew will be used.

Packages installed:

  • cmatrix
  • eza (aliased to ls)
  • bat (aliased to cat)
  • btop
  • ripgrep (rg)
  • fd
  • fzf

macOS

Make Bash on macOS work more like a Linux shell and ensure that .bash_profile calls the .bashrc.

Fonts

Install Nerd Fonts so you can have fancy icons/etc., needed for various Oh My Zsh themes.

[grown] Git

My preferred Git configurations.

May prompt you for input.

iTerm2

A few iTerm2 profiles that might be handy and look cool.

  • Fig Tree (Double Line): simple profile with some preselected Oh My Zsh themes, light & dark mode colors from Monokai Pro, and macOS-style keybindings that have two-line prompts (shortcut: Ctrl-Cmd-W)
  • Fig Tree (Node): simple profile with some preselected Oh My Zsh themes, light & dark mode colors from Monokai Pro, and macOS-style keybindings that are handy for Node.js development (shortcut: Ctrl-Cmd-N)
  • Fig Tree (Single Line): simple profile with some preselected Oh My Zsh themes, light & dark mode colors from Monokai Pro, and macOS-style keybindings that have one-line prompts (shortcut: Ctrl-Cmd-S)

Rectangle

Requires manual steps.

My preferred defaults for Rectangle.

SSH

Default to using an ED25519 SSH key for github.com.

Terminal (macOS)

Simple dark theme profile for the built-in macOS Terminal application.

Vim

My preferred defaults for using Vim.

Xcode

A variety of Xcode themes.

  • cHAoS: exactly how it sounds—give it a try!
  • mz (Dark): simple dark theme
  • mz (Light): simple light theme
  • mz Presentation (Dark): simple dark theme with large fonts
  • mz Presentation (Light): simple light theme with large fonts
  • mzDefault: my default Xcode theme
  • Quiet Light: mimicking the VS Code built-in theme "Quiet Light"
  • Red: mimicking the VS Code built-in theme "Red"

Project Structure & Organization

Warning

Lots of extended analogies!

Where Configurations Live (Garden)

The garden is a shell-specific file that is used to load mix-ins (see below) which is the central file that is called to load in pluggable configurations.

The entire point of the garden is to be the construct that metaphorically holds the shell environment (soil) together.

Shell Environment (Soil)

The shell session's environment is the soil that exists to hold the annual and perennial seeds (configurations). Although shell sessions are removed and recreated, the analogy assumes that the soil is never actually removed.

Configurations (Seeds)

There are different kinds of configurations that Fig Tree needs to support.

  • Perennials — Configurations that only need to be installed (i.e. planted) once and, while installed, will reference a resource in the .fig directory.
    • The roots of perennial plants that survive in the earth throughout winter are akin to the configuration files that live in the .fig directory and get called upon when there is a link to them in the proper location for that configuration (usually somewhere in the user’s home directory). Also in this way, these configurations do not need to be re-instantiated by the shell every login.
    • Each perennial includes a provided.sh file that accompanies it, which handles tasks like linking the perennial to its target directory and filename or otherwise handling the installation of the perennial.
      • Perennial installation scripts are all written in bash, since they are only run during the plant script.
    • To plant perennials, run the plant script, which will determine which perennials have already been planted and which still need to be planted.
    • Example: .vimrc is a configuration file that vim reads from the user's $HOME directory. As a perennial, the file in the user's $HOME is actually a symbolic link to the actual .vimrc (the roots) in the .fig/perennials/vim directory.
  • Annuals — Configurations that live only within an actively logged in shell (must be an interactive shell instance) and thus need to have shell startup scripts that set them for each session.
    • The seeds that annuals rely on dropping before winter to bloom in spring are similar to the shell commands run at the startup to guarantee the current session but do not make any assumptions about future sessions.
    • Example: the ll alias is set in a .bashrc file that needs to run every time a new bash shell starts, otherwise the alias will not exist for that shell.
    • Any pluggable feature that can be added to a shell configuration should live in an amendments directory that the garden.*rc file looks inside. Once in that directory, the garden.*rc can load those amendments, thus enriching the garden and benefiting the seeds in it.

.noseed File

The plant script can also read from a .noseed configuration file (ignore-style) that is a simple text file containing all of the seeds that should not be planted.

The bed.sh file for perennials does not need to be ignored with the .noseed file because they are not treated as seeds.

Supported file matching is that of bash glob pattern matching, for example:

ohmyzsh
dir/ripgrep
#vimrc <-- commented out, so it still gets planted

Every seed in the perennials and annuals will be planted unless it's in the .noseed file (and not commented out).

About

A command line configuration utility to ensure a consistent experience across every terminal.

Topics

Resources

Stars

Watchers

Forks