Skip to content

Latest commit

 

History

History
1501 lines (1205 loc) · 39.4 KB

index.org

File metadata and controls

1501 lines (1205 loc) · 39.4 KB

dotfiles

A collection of literate programming dotfiles created and maintained in Emacs with Org mode. The source is available at index.org.[fn:1]

Build Configuration Files

Open this Org document in Emacs and tangle it (C-c C-v t). Configuration files, e.g., ~/.bashrc, will be generated.

Bootstrap

Change Default Shell

I prefer bash over zsh.

This should be the Homebrew installed bash not the system bash path:

eval "$(/opt/homebrew/bin/brew shellenv)" && \
    export SHELL="${HOMEBREW_PREFIX}/bin/bash" && \
    sudo dscl . -create ${HOME} UserShell ${SHELL} && \
    dscl . -read ${HOME} UserShell

Set HOSTNAME

export HOSTNAME='TODO' && \
    sudo scutil --set HostName ${HOSTNAME}

Accessibility

defaults write com.apple.Accessibility ReduceMotionEnabled -bool true

Bash

~./bash_profile

# shellcheck source=/dev/null
source "${HOME}/.bashrc"

~/.bashrc

Load all configuration:

export K20E_BASHRC_DIR="${HOME}/.bashrc.d"
for f in "${K20E_BASHRC_DIR}/"*.bash; do
    # shellcheck source=/dev/null
    source "${f}"
done
unset -v config

Configuration

Environment variables:

export LANG=en_US.UTF-8

export HISTSIZE=100000
export HISTCONTROL=ignoredups:erasedups
export HISTTIMEFORMAT='%F %T '

export TERM=xterm-256color

Shell options:

shopt -s \
      autocd \
      cdspell \
      checkjobs \
      checkwinsize \
      dirspell \
      histappend \
      no_empty_cmd_completion

Base variables that I use to organize the file system:

export K20E_CODE_HOME=${HOME}/code
export GOOGLE="${HOME}/Google Drive/My Drive"

CDPATH:

The CDPATH variable sets the search path for the cd command. If you do not specify . somewhere in the path, it is assumed to be the first component.

export CDPATH="${K20E_CODE_HOME}:${GOOGLE}"

PATH:

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}
pathmunge /usr/local/sbin
pathmunge /usr/local/bin
pathmunge "${HOME}/bin"

TODO If these modify PATH, etc., I should figure out a way to pre/post them with the rest of this setup. For instance, asdf tries to shim PATH here but then gets overwritten later by pathmunge.

Aliases:

alias ..="cd ../"
alias ...="cd ../../"
alias ....="cd ../../.."
alias dirs="dirs -v"
alias j="jobs -l"
alias tree="tree -C"
alias top="top -ocpu -Orsize"
if [ -e /opt/homebrew/bin/brew ]; then
    eval "$(/opt/homebrew/bin/brew shellenv)"

    export HOMEBREW_CASK_HOME="${HOMEBREW_PREFIX}/Caskroom"
    export HOMEBREW_CASK_OPTS=--require-sha
    export HOMEBREW_INSTALL_CLEANUP=1
    export HOMEBREW_NO_ANALYTICS=1
    export HOMEBREW_NO_ENV_HINTS=1
    export HOMEBREW_NO_INSECURE_REDIRECT=1

    command -v "${HOMEBREW_PREFIX}/bin/bash" >/dev/null 2>&1 && export SHELL="${HOMEBREW_PREFIX}/bin/bash"
fi

Completion:

# shellcheck source=/dev/null
[ -e "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ] && source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"

Homebrew Bundle

Install: brew bundle

if command -v "${HOMEBREW_PREFIX}/bin/bundle" >/dev/null 2>&1; then
    export HOMEBREW_BREWFILE="${HOME}/.Brewfile"

    alias k20e_brew_bundle_dump='brew bundle dump --force --global --verbose && pbcopy < $HOMEBREW_BREWFILE'
    alias k20e_brew_bundle_install="brew bundle --global"
fi

~/.Brewfile

tap "buo/cask-upgrade"
tap "d12frosted/emacs-plus"
tap "homebrew/aliases"
tap "homebrew/autoupdate"
tap "homebrew/bundle"
tap "homebrew/command-not-found"
tap "homebrew/services"
tap "homebrew/test-bot"
tap "jmespath/jmespath"
tap "tidbyt/tidbyt"
brew "automake"
brew "libyaml"
brew "asdf"
brew "aspell"
brew "bash"
brew "bash-completion@2"
brew "bison"
brew "chafa"
brew "cmake"
brew "dasel"
brew "diff-so-fancy"
brew "difftastic"
brew "eza"
brew "libssh"
brew "xvid"
brew "ffmpeg"
brew "flex"
brew "flyctl"
brew "gawk"
brew "gcc"
brew "gd"
brew "gflags"
brew "git"
brew "gnupg"
brew "go"
brew "gprof2dot"
brew "hunspell"
brew "shared-mime-info"
brew "imagemagick"
brew "innoextract"
brew "ispell"
brew "oniguruma"
brew "jq"
brew "kubernetes-cli"
brew "less"
brew "libdvdcss"
brew "makedepend"
brew "node"
brew "opam"
brew "parallel"
brew "perl"
brew "pkgconf"
brew "pre-commit"
brew "pstree"
brew "pv"
brew "pyenv"
brew "pyenv-virtualenv"
brew "[email protected]"
brew "repo"
brew "ripgrep"
brew "rocksdb"
brew "ruby", link: true
brew "scons"
brew "shellcheck"
brew "sk"
brew "starship"
brew "subversion"
brew "television"
brew "terminal-notifier"
brew "texi2html"
brew "tree"
brew "uv"
brew "watch"
brew "wget"
brew "yamllint"
brew "yasm"
brew "yq"
brew "d12frosted/emacs-plus/emacs-plus@29"
brew "tidbyt/tidbyt/pixlet"
cask "1password"
cask "1password-cli"
cask "alfred"
cask "alt-tab"
cask "betterdisplay"
cask "firefox"
cask "font-symbols-only-nerd-font"
cask "ghostty"
cask "google-chrome"
cask "google-drive"
cask "istat-menus"
cask "mactex-no-gui"
cask "orion"
cask "qlmarkdown"
cask "rectangle"
cask "slack"
cask "tomatobar"
cask "vanilla"
cask "vlc"
cask "wezterm"
cask "zoom"

Secrets

Define a directory to keep secret information in. Make sure that it exists in =.gitignore-global=.

export K20E_SECRET_HOME="${K20E_BASHRC_DIR}/secret"
mkdir -p "${K20E_SECRET_HOME}"

Setup environment, create & source secrets for aliases, functions, PATH and environment variables:

export K20E_SECRET_ALIASES="${K20E_SECRET_HOME}/aliases.sh" && touch -a "${K20E_SECRET_ALIASES}"
# shellcheck source=/dev/null
source "${K20E_SECRET_ALIASES}"

export K20E_SECRET_FUNCTIONS="${K20E_SECRET_HOME}/functions.sh" && touch -a "${K20E_SECRET_FUNCTIONS}"
# shellcheck source=/dev/null
source "${K20E_SECRET_FUNCTIONS}"

export K20E_SECRET_PATH="${K20E_SECRET_HOME}/path.sh" && touch -a "${K20E_SECRET_PATH}"
# shellcheck source=/dev/null
source "${K20E_SECRET_PATH}"

export K20E_SECRET_VARIABLES="${K20E_SECRET_HOME}/variables.sh" && touch -a "${K20E_SECRET_VARIABLES}"
# shellcheck source=/dev/null
source "${K20E_SECRET_VARIABLES}"

Adjust permissions.

chmod 0700 "${K20E_SECRET_HOME}"
chmod -Rf 0600 "${K20E_SECRET_HOME}"/*

Functions

Random functions.

Strip exif information out of images like geoloc data:

function k20e_exif_strip() {
    local path="$1"

    if [ ! -e "${path}" ]; then
        echo "Image at path \"${path}\" does not exist"
        return
    fi

    echo "Before:"
    echo
    identify -verbose "${path}" | rg exif

    mogrify -strip "${path}"

    echo
    echo "After:"
    echo
    identify -verbose "${path}" | rg exif
}

Use jq to reformat messy JSON files:

function k20e_jqf() {
    local path="$1"
    local tmpPath

    if [ ! -e "${path}" ]; then
        echo "File at path \"${path}\" does not exist"
        return
    fi

    tmpPath=$(mktemp)
    cp "${path}" "${tmpPath}"
    jq . "${tmpPath}" > "${path}"
    rm "${tmpPath}"
}

1Password

Generate completion script:

op completion bash > /opt/homebrew/etc/bash_completion.d/op

# shellcheck source=/dev/null
[ -e "${HOMEBREW_PREFIX}/etc/bash_completion.d/op" ] && source "${HOMEBREW_PREFIX}/etc/bash_completion.d/op"

asdf

Need to add completion for my silly Dvorak alias. Lookup existing completion function: complete -p asdf, then add it below.

alias aoeu='asdf'
# shellcheck source=/dev/null
[ -e "${HOMEBREW_PREFIX}/opt/asdf/libexec/asdf.sh" ] && source "${HOMEBREW_PREFIX}/opt/asdf/libexec/asdf.sh" && complete -o default -F _asdf aoeu

AWS CLI

export AWS_SDK_LOAD_CONFIG=1
export AWS_VAULT_KEYCHAIN_NAME=login

[ -e "${HOMEBREW_PREFIX}/bin/aws_completer" ] && complete -C "${HOMEBREW_PREFIX}/bin/aws_completer" aws
[ -e '/usr/bin/aws_completer' ] && complete -C '/usr/bin/aws_completer' aws

Emacs

[ -x "${HOMEBREW_PREFIX}/bin/emacs" ] && alias emacs='$HOMEBREW_PREFIX/bin/emacs --no-window-system'
[ -x "${HOMEBREW_PREFIX}/bin/emacsclient" ] && alias emacsclient='$HOMEBREW_PREFIX/bin/emacsclient --no-wait'

export EDITOR=emacsclient

This is a clever emacsclient hack to support opening files at a line number with the :linum suffix that I stumbled across at https://stuff-things.net/2019/07/31/opening-files-with-line-numbers-in-emacs.

function k20e_ec () {
    if [[ $1 =~ (.*):([0-9]+):(.*)$ ]]; then
        emacsclient "+${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"
    else
        emacsclient "$@"
    fi
}

alias ec=k20e_ec
if command -v eza >/dev/null 2>&1; then
    # Workaround for https://github.com/orgs/eza-community/discussions/209#discussioncomment-10801021 which is apparently still not resolved
    export EXA_COLORS="xx=''"
    export EZA_CONFIG_DIR="${HOME}/.config/eza"
    export EZA_ICON_SPACING=1
    export EZA_ICONS_AUTO=1
    alias l="eza --classify --git --git-repos --grid"
    alias ls="eza --classify --git --git-repos --grid"
    alias ll="eza --classify --git --git-repos --long --header --smart-group"
    alias lt="eza --classify --git --git-repos --tree"
    alias ltl="eza --classify --git --git-repos --tree --long --header --smart-group"
fi

Theme

See https://github.com/eza-community/eza-themes

---

Ghostty

background-opacity = 0.75
background-blur-radius = 20

# See also shell-integration-features
cursor-style = block
cursor-style-blink = true

font-family = ""
font-family = PragmataPro Mono Liga
font-feature = calt
font-size = 20

# Backward erase word
# This binds cmd+h to alt+backspace which will backward erase one word
# Remember to go change the "Hide Ghostty" menu shortcut to something else, e.g.,
# https://apple.stackexchange.com/questions/101754/os-x-disable-cmd-h-or-hide-app-command
keybind = cmd+h=text:\x1b\x7f
# Forward erase word
keybind = cmd+d=esc:d

# Backward word
keybind = cmd+b=esc:b
# Forward word
keybind = cmd+f=esc:f

# Jump to prompt
keybind = ctrl+up=jump_to_prompt:-1
keybind = ctrl+down=jump_to_prompt:1

# Quick terminal
keybind = global:ctrl+alt+cmd+t=toggle_quick_terminal

macos-option-as-alt = true
macos-titlebar-style = hidden

quit-after-last-window-closed = true

resize-overlay = never

shell-integration = bash
# This fixed an issue w/ the initial Bash cursor showing as a bar instead of a block before a command was executed
# (see cursor-style)
shell-integration-features = no-cursor

theme = light:Tomorrow,dark:Tomorrow Night Bright

window-height = 48
window-width = 110

Add completion for my muscle memory alias of g for git:

alias g="git"
__git_complete g __git_main

Diff highlighting (need to review if this is necessary now since I’ve configured difftastic below).

[ -e "$(brew --prefix git)/share/git-core/contrib/diff-highlight/" ] && pathmunge "$(brew --prefix git)/share/git-core/contrib/diff-highlight/"

~/.gitconfig

The includeIf section below allows for sticking a .gitconfig in a directory such that repositories cloned into that directory will read that config for each repository there. This is useful for setting values like email, etc., that might be different than the global value without having to set it specifically in each repository’s config. Just clone the repository into this directory and make sure that the config is set. git config --list is useful when making sure that the config values are set properly.

[user]
        name = Kris Molendyke
        email = [email protected]
        useconfigonly = true
[color]
        ui = auto
[core]
        excludesfile = ~/.gitignore-global
        whitespace = -trailing-space,-space-before-tab
        editor = emacsclient
[apply]
        whitespace = nowarn
[alias]
        diff = difftool
        stache = stash
        st = status -sb
        a = add -p
        l = log --color-moved --stat --no-merges --ext-diff
        lp = log --color-moved --patch --stat --no-merges --ext-diff
        wlp = log --color-moved --patch --stat --color-words --no-merges --ext-diff
        lo = log --color-moved --oneline --decorate --no-merges --ext-diff
        lf = log --color-moved --pretty=format: --name-only -z --max-count 1 --no-merges --ext-diff
        co = checkout
        br = branch -vv
        wdiff = diff --color-moved --color-words --ext-diff
        ds = diff --color-moved --staged --ext-diff
[advice]
        statusHints = true
[rebase]
        autosquash = true
[diff]
        algorithm = histogram
        colorMoved = zebra
        compactionHeuristic = 1
        external = difft --display=inline
        tool = difftastic
[difftool]
        prompt = false
[difftool "difftastic"]
        cmd = difft --display=inline "$LOCAL" "$REMOTE"
[help]
        autocorrect = 1
[pager]
        difftool = true
[pull]
        rebase = false
[init]
        defaultBranch = main
[credential]
        helper = cache --timeout=3600
[tag]
        sort = version:refname

# Conditional include to set some work defaults, e.g., email, GHE interal url replacement, ssh signing
# This file is stored in work 1Password Employee vault
[includeIf "gitdir/i:~/code/work/"]
        path = ~/code/work/.gitconfig

~/.gitignore-global

# -*- mode: gitignore; -*-

~/.bashrc.d/secret/

##########################################################################
# Below from:                                                            #
#                                                                        #
# https://github.com/github/gitignore/blob/master/Global/Linux.gitignore #
##########################################################################

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*


##########################################################################
# Below from:                                                            #
#                                                                        #
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore #
##########################################################################

.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


##############################################################################
# Below from:                                                                #
#                                                                            #
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore #
##############################################################################

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
.idea/modules.xml
.idea/*.iml
.idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

Go

[[ -x "${HOMEBREW_PREFIX}/bin/go" ]] && pathmunge "$("${HOMEBREW_PREFIX}/bin/go" env GOPATH)/bin"

Google Cloud SDK

Completion:

# shellcheck source=/dev/null
[ -e "${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc" ] && source "${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
# shellcheck source=/dev/null
[ -e "${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc" ] && source "${HOMEBREW_CASK_HOME}/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"

kubectl, k, kctx, kns, krew

Completion for my k alias:

alias k="kubectl"
# shellcheck source=/dev/null
[ -e "${HOMEBREW_PREFIX}/etc/bash_completion.d/kubectl" ] && source "${HOMEBREW_PREFIX}/etc/bash_completion.d/kubectl" && complete -o default -F __start_kubectl k

kubectx for wrangling contexts and namespaces:

command -v kubectx >/dev/null 2>&1 && alias kctx="kubectx"
command -v kubens >/dev/null 2>&1 && alias kns="kubens"

Change currently selected color:

KUBECTX_CURRENT_FGCOLOR=$(tput setaf 2)
export KUBECTX_CURRENT_FGCOLOR

krew

Install and configure krew.

if command -v nvm >/dev/null 2>&1; then
    export NVM_DIR="$HOME/.nvm"
    # shellcheck source=/dev/null
    [ -e "$(brew --prefix nvm)/nvm.sh" ] && source "$(brew --prefix nvm)/nvm.sh"
fi

OCaml

Modified output of opam init:

# shellcheck source=/dev/null
[ -e "${HOME}/.opam/opam-init/init.sh" ] && source "${HOME}/.opam/opam-init/init.sh"

PostgreSQL

[ -d $(brew --prefix postgresql@16) ] && pathmunge "$(brew --prefix postgresql@16)/bin"

Python

~/requirements-to-freeze.txt

Use A Better Pip Workflow™ to specify packages that I do actually want installed to the user’s packages.

# User packages
boto3
botocore
http-prompt
keyring
pipdeptree[graphviz]
pylsp-rope
python-lsp-server[all]
twine
urllib3
virtualenvwrapper

Configuration

pathmunge "$(brew --prefix python)/libexec/bin"

Add Python site.USER_BASE for user site-packages and pip install --user installations. See https://docs.python.org/3/install/index.html#inst-alt-install-user

PYTHON_USER_BASE=$(python -m site --user-base)
export PYTHON_USER_BASE
pathmunge "${PYTHON_USER_BASE}/bin"

Old function I’ve used to bootstrap a sane Python user environment:

function k20e_pip_upgrade() {
    if [[ $(which deactivate) == "deactivate: function" && -n ${VIRTUAL_ENV} ]]; then
        echo "Deactivating current virtual environment ${VIRTUAL_ENV}"
        deactivate
    fi
    pip install --break-system-packages --user --upgrade --requirement "${HOME}/requirements-to-freeze.txt"
    pip freeze > "${HOME}/requirements.txt"
}

pyenv

if command -v pyenv >/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

uv

Rancher

[ -d "${HOME}/.rd/bin" ] && pathmunge "${HOME}/.rd/bin"

ripgrep

export RIPGREP_CONFIG_PATH=${HOME}/.ripgreprc

~/.ripgreprc

See RIPGREP_CONFIG_PATH above and https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file

--sort-files

Rust

See https://github.com/rust-lang-nursery/rustfmt#tips.

if [ -d "${HOME}/.cargo" ]; then
    export CARGO_HOME=${HOME}/.cargo
    pathmunge "${CARGO_HOME}/bin"
fi

if [[ -x ${CARGO_HOME}/bin/rustc ]]; then
    DYLD_LIBRARY_PATH=$("${CARGO_HOME}"/bin/rustc --print sysroot)/lib:${DYLD_LIBRARY_PATH}
    export DYLD_LIBRARY_PATH
fi

k20e_shellcheck will run shellcheck against the result of tangling all of this configuration to the files that the shell will actually execute.

command -v shellcheck >/dev/null 2>&1 && alias k20e_shellcheck='find $HOME/.bash_profile $HOME/.bashrc $K20E_BASHRC_DIR -type f -exec shellcheck '\''{}'\'' \;'

~/.shellcheckrc

color=always
shell=bash
export SKIM_DEFAULT_COMMAND="git ls-tree -r --name-only HEAD || rg --files || find ."
export SKIM_DEFAULT_OPTIONS="--ansi --bind 'alt-a:select-all+accept,ctrl-o:execute(emacsclient --no-wait {})+accept' --prompt '❯ ' --cmd-prompt 'C❯ ' --color 'light' --multi --tiebreak=score,begin,end"

skim takes over C-t in the terminal. I live by that key binding to transpose typographical errors. Set it explicitly:

bind -r '\C-t'
bind '\C-t: transpose-chars'

SSH

Create a configuration directory:

mkdir -p ${HOME}/.ssh/config.d

On macOS, 1Password requires this to work with the Environment properly:

mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock

~/.ssh/config

ServerAliveCountMax 5
ServerAliveInterval 60

Host *
    IdentityAgent ~/.1password/agent.sock
    StrictHostKeyChecking accept-new

Include ~/.ssh/config.d/*

Personal

Splitting work & personal to allow for using multiple GitHub accounts. See https://developer.1password.com/docs/ssh/agent/advanced/#use-multiple-github-accounts.

Host personal.localhost
     HostName github.com
     User git
     IdentityFile ~/.ssh/personal.pub
     IdentitiesOnly yes
     PreferredAuthentications publickey
     PasswordAuthentication no

Work

Host work.localhost
     HostName github.com
     User git
     IdentityFile ~/.ssh/work.pub
     IdentitiesOnly yes
     PreferredAuthentications publickey
     PasswordAuthentication no

Environment

export SSH_AUTH_SOCK=~/.1password/agent.sock

Starship

if command -v starship >/dev/null 2>&1; then
    function k20e_starship_precmd_user_func() {
        # Immediately append commands to HISTFILE rather than waiting for logout
        # NB this does not affect the current session's history but it does mean that a login will have access to all
        # recent commands from any current sessions
        history -a
    }
    # See https://starship.rs/advanced-config/#custom-pre-prompt-and-pre-execution-commands-in-bash
    # shellcheck disable=SC2034
    starship_precmd_user_func='k20e_starship_precmd_user_func'

    # Only init one time, I found issues w/ this executing multiple time, e.g., via interactive `source ~/.bashrc`
    if [ ! -v STARSHIP_SHELL ]; then
        eval "$(starship init bash)"
    fi
fi

~/.config/starship.toml

This section must be first!

format = """
$aws\
$gcloud\
$kubernetes\
$docker_context\
$line_break\
$username\
$hostname\
$localip\
$shlvl\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$package\
$c\
$cmake\
$golang\
$helm\
$java\
$julia\
$kotlin\
$gradle\
$lua\
$nodejs\
$opa\
$perl\
$python\
$ruby\
$rust\
$scala\
$swift\
$terraform\
$zig\
$buf\
$memory_usage\
$env_var\
$crystal\
$custom\
$sudo\
$cmd_duration\
$line_break\
$jobs\
$battery\
$time\
$status\
$os\
$container\
$shell\
$character"""

Presets

Started with starship preset nerd-font-symbols and removed stuff I’ll never need.

[buf]
symbol = ""

[c]
symbol = ""

[hostname]
ssh_symbol = ""

[java]
symbol = ""

[lua]
symbol = ""

[memory_usage]
symbol = "󰍛 "

[nodejs]
symbol = ""

[ocaml]
symbol = ""

[os.symbols]
Alpine = ""
Amazon = ""
Android = ""
Arch = ""
CentOS = ""
Debian = ""
Linux = ""
Macos = ""
Raspbian = ""
Redhat = ""
RedHatEnterprise = ""
Ubuntu = ""
Unknown = ""

[package]
symbol = "󰏗 "

[ruby]
symbol = ""

[rust]
symbol = ""
[aws]
symbol = 'aws '
format = '[$symbol($profile )(\($region\) )(\[$duration\] )]($style)'
[battery]
disabled = true
[character]
success_symbol = '[#](bold green)'
error_symbol = '[#](bold red)'
[cmd_duration]
format = '[$duration]($style) '
[directory]
read_only = ' 󰌾'
truncation_length = 4
format ='[$path]($style)[$read_only]($read_only_style) '
[docker_context]
symbol = ''
format = '[$symbol $context]($style) '
[golang]
symbol = '󰟓 '
format = '[$symbol($version )]($style) '
[gcloud]
symbol = 'gcp '
format = '[$symbol$project(\($region\))]($style) '
detect_env_vars = [ 'GCLOUD_ACTIVE' ]

[gcloud.project_aliases]
gcp-s1-prod-scalyr = "prod"
[git_branch]
always_show_remote = false
symbol = ''
format = '[$symbol $branch(:$remote_branch)]($style) '
[git_status]
# all_status = '$conflicted$stashed$deleted$renamed$modified$staged$untracked'
format = '([$conflicted$deleted$renamed$modified$staged$untracked$ahead_behind]($style) )'
[kubernetes]
disabled = false
symbol = 'k8s '
format = '[$symbol$context( \($namespace\))]($style) '
[python]
symbol = ''
format = '[${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
command -v terminal-notifier >/dev/null 2>&1 && alias notify=terminal-notifier

Terraform

command -v terraform >/dev/null 2>&1 && complete -C terraform terraform

TERM setup https://wezfurlong.org/wezterm/config/lua/config/term.html

local wezterm = require 'wezterm'
local act = wezterm.action
local config = {}

if wezterm.config_builder then
   config = wezterm.config_builder()
end

-- term https://wezfurlong.org/wezterm/config/lua/config/term.html
config.term = "wezterm"

-- Shell
if wezterm.target_triple == 'aarch64-apple-darwin' then
   config.default_prog = {'/opt/homebrew/bin/bash'}
elseif wezterm.target_triple == 'x86_64-unknown-linux-gnu' then
   config.default_prog = {'/bin/bash'}
end

-- Font
config.font = wezterm.font('PragmataPro Liga')
config.font_size = 22

-- GUI
config.initial_rows = 48
config.initial_cols = 110
config.enable_tab_bar = false

-- Theme
function get_appearance()
   if wezterm.gui then
      return wezterm.gui.get_appearance()
   end
   return 'Dark'
end

function scheme_for_appearance(appearance)
   if appearance:find 'Dark' then
      return 'Tomorrow Night Bright'
   else
      return 'Tomorrow'
   end
end

config.color_scheme = scheme_for_appearance(get_appearance())

-- Bindings
config.keys = {
   -- macOS move forward/backward by word with ⌘-f, ⌘-b
   { key = 'b', mods = 'CMD', action = act.SendString '\x1bb' },
   { key = 'f', mods = 'CMD', action = act.SendString '\x1bf' },

   -- macOS backward erase word (see
   -- https://apple.stackexchange.com/questions/101754/os-x-disable-cmd-h-or-hide-app-command for re-mapping ⌘-h from
   -- "Hide WezTerm" to something else)
   { key = 'h', mods = 'CMD', action = act.SendString '\x1b\x7f' },

   -- macOS forward erase word
   { key = 'd', mods = 'CMD', action = act.SendString '\x1bd' },

   -- Search, rather than ⌘-f
   { key = 's', mods = 'CMD', action = act.Search 'CurrentSelectionOrEmptyString' },
}

return config

yamllint

See https://yamllint.readthedocs.io/en/stable/configuration.html and https://yamllint.readthedocs.io/en/stable/rules.html.

---

yaml-files:
  - '*.yaml'
  - '*.yml'
  - '.yamllint'

rules:
  braces:
    level: warning
  brackets: enable
  colons:
    level: warning
  commas: enable
  comments:
    level: warning
  comments-indentation:
    level: warning
  document-end: disable
  document-start:
    level: warning
  empty-lines: enable
  empty-values: disable
  float-values: disable
  hyphens: enable
  indentation: enable
  key-duplicates: enable
  key-ordering: disable
  line-length: disable
  new-line-at-end-of-file:
    level: warning
  new-lines: enable
  octal-values: disable
  quoted-strings: disable
  trailing-spaces:
    level: warning
  truthy:
    level: warning

~/.inputrc

set bell-style none
set colored-completion-prefix on
set colored-stats on
set completion-ignore-case off
set convert-meta off
set expand-tilde on
set input-meta on
set output-meta on
set show-all-if-ambiguous on
set visible-stats on

Footnotes

[fn:1] As of [2025-01-12 Sun] this document is focused on macOS only after I migrated Linux specific configuration to linux.org.