Skip to content

Latest commit

 

History

History
1319 lines (1028 loc) · 33.9 KB

README.org

File metadata and controls

1319 lines (1028 loc) · 33.9 KB

dotfiles

A collection of literate programming dotfiles created and maintained in Emacs with Org mode.

Prerequisites

mkdir -p ~/.bashrc.d/secret
touch ~/.bashrc.d/secret/variables.sh
# TODO: fix the fact that something below this needs a file to exist in the secrets dir
mkdir -p ~/.ssh/config
mkdir -p ~/.config/yamllint

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.

OS

OS specific configuration is currently split out into the following distinct files:

  • linux.org
  • macos.org

Tangling of those files must be done manually on the correct system.

Shell

Change Default Shell

For macOS this should be the Homebrew installed bash not the system bash path.

chsh -s /opt/homebrew/bin/bash
export SHELL=/opt/homebrew/bin/bash
echo ${SHELL}

On macOS:

sudo dscl . -create ${HOME} UserShell ${SHELL}
dscl . -read ${HOME} UserShell

Make the Bash configuration directory:

mkdir -p "${HOME}/.bashrc.d"

.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

.bash_profile

source "${HOME}/.bashrc"

.bashrc

Load all configuration:

for f in "${HOME}/.bashrc.d/"*.bash; do
    source "${f}"
done
unset -v config

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.

Custom

Interactive shell options.

Secret Information

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

export K20E_SECRET_HOME=${HOME}/.bashrc.d/secret

Create it if necessary.

mkdir -p ${K20E_SECRET_HOME}

Adjust permissions.

chmod 0700 ${K20E_SECRET_HOME}
chmod -Rf 0600 ${K20E_SECRET_HOME}/*.sh

Define files to source in the following sections.

export K20E_SECRET_VARIABLES=${K20E_SECRET_HOME}/variables.sh
export K20E_SECRET_ALIASES=${K20E_SECRET_HOME}/aliases.sh
export K20E_SECRET_PATH=${K20E_SECRET_HOME}/path.sh
export K20E_SECRET_FUNCTIONS=${K20E_SECRET_HOME}/functions.sh

Options

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

Variables

Bash variables.

LANG=en_US.UTF-8

HISTSIZE=100000
HISTCONTROL=erasedups
HISTTIMEFORMAT='%F %T '

Base variables that I use to organize the file system.

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

File system variables.

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

# https://github.com/rust-lang-nursery/rustfmt#tips
if [[ -x ${CARGO_HOME}/bin/rustc ]]; then
    export DYLD_LIBRARY_PATH=$(${CARGO_HOME}/bin/rustc --print sysroot)/lib:${DYLD_LIBRARY_PATH}
fi

if [[ "$OSTYPE" == darwin* ]]; then
    export HOMEBREW_CASK_HOME=/opt/homebrew/Caskroom
    export HOMEBREW_CELLAR=$(/opt/homebrew/bin/brew --cellar)
    export HOMEBREW_INSTALL_CLEANUP=1
    export HOMEBREW_NO_ENV_HINTS=1
fi

if [[ -x jenv ]]; then
    export JENV_HOME=${HOME}/.jenv
fi

Non file system variables.

export EDITOR=emacsclient
export LANG=en_US.UTF-8
export TERM=xterm-256color

… use the -u/--unquoted option to specify that any result that is a string will be printed without quotes. … If this is a common enough occurance for you, you can set the JP_UNQUOTED environment variable to make this the default behavior

https://github.com/jmespath/jp

export JP_UNQUOTED=true
if [ -f ${K20E_SECRET_VARIABLES} ]; then
    source ${K20E_SECRET_VARIABLES}
fi

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

export RIPGREP_CONFIG_PATH=${HOME}/.ripgreprc

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="${CODE_HOME}:${GOOGLE}"

PATH

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}
if [ -v ${JENV_HOME} ]; then
    pathmunge "${JENV_HOME}/bin"
fi

pathmunge /usr/local/sbin
pathmunge /usr/local/bin
pathmunge "${HOME}/bin"

if [ -v ${CARGO_HOME} ]; then
    pathmunge "${CARGO_HOME}/bin"
fi

if [ -v ${VLC_HOME} ]; then
    pathmunge "${VLC_HOME}"
fi

if [[ "$OSTYPE" == darwin* ]]; then
    pathmunge /opt/homebrew/bin
    pathmunge /opt/homebrew/sbin
    pathmunge /usr/local/opt/python/libexec/bin
    pathmunge "$(/opt/homebrew/bin/brew --prefix git)/share/git-core/contrib/diff-highlight"
    pathmunge "$(/opt/homebrew/bin/brew --prefix)/opt/python/libexec/bin"
fi

if [[ -x /usr/share/doc/git/contrib/diff-highlight ]]; then
    pathmunge /usr/share/doc/git/contrib/diff-highlight
fi

if [[ -x /bin/go ]]; then
    pathmunge /bin/go/bin
    pathmunge "$(/bin/go env GOPATH)/bin"
fi

if [[ -x /opt/homebrew/bin/go ]]; then
    pathmunge "$(/opt/homebrew/bin/go env GOPATH)/bin"
fi

# Rancher Desktop instead of Docker as of 3/18/24
pathmunge "${HOME}/.rd/bin"
if [ -f ${K20E_SECRET_PATH} ]; then
    source ${K20E_SECRET_PATH}
fi

.dir_colors

https://www.nordtheme.com/docs/ports/dircolors

[ -e "${HOME}/.dir_colors" ] && eval $(dircolors "${HOME}/.dir_colors")

1Password CLI

Generate completion script:

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

[ -e /opt/homebrew/etc/bash_completion.d/op ] && source /opt/homebrew/etc/bash_completion.d/op

jEnv

For managing multiple Java installations.

if [[ -x jenv ]]; then
    eval "$(jenv init -)"
fi
[ -x /usr/bin/nomad ] && complete -C /usr/bin/nomad nomad

For managing multiple … Node installations. Installed from AUR.

export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"  # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"

PYTHON_USER_BASE

Add Python site.USER_BASE for user site-packages and pip install --user installations.

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

Aliases

alias ..="cd ../"
alias ...="cd ../../"
alias ....="cd ../../.."
alias dirs="dirs -v"
alias emacs="/usr/bin/emacs --no-window-system"
alias emacsclient="/usr/bin/emacsclient --no-wait"
alias ec="emacsclient"
alias g="git"
alias j="jobs -l"
alias k="kubectl"
alias l.l='ls -1A | grep "^\." | xargs ls -lhGF'
alias ll="ls --color=always -lhF"
alias lll="ll --color=always"
alias ls="ls --color=always -GF"
alias l="ls --color=always"
alias tree="tree -C"

if [[ "$OSTYPE" == darwin* ]]; then
    alias brewdump="brew bundle dump --force --global --verbose && pbcopy < ${HOME}/.Brewfile"
    alias emacsclient="$(/opt/homebrew/bin/brew --prefix)/bin/emacsclient --no-wait"
    alias top="top -ocpu -Orsize"
fi
if [ -f ${K20E_SECRET_ALIASES} ]; then
    source ${K20E_SECRET_ALIASES}
fi

Completions

[2020-09-05 Sat]

For Arch need to update to https://wiki.archlinux.org/index.php/Bash#Tab_completion.

[ -e /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion
[ -e /etc/bash_completion ] && source /etc/bash_completion

kubectl, k, kctx, kns, krew

Using MicroK8s in Ubuntu at the moment.

Instead of snap below, maybe microk8s.status --yaml parsing?

macOS completion with completion for my k alias:

[ -e /opt/homebrew/etc/bash_completion.d/kubectl ] && source /opt/homebrew/etc/bash_completion.d/kubectl && complete -o default -F __start_kubectl k

Install kubectx (via =${HOME}/.Brewfile=), completion for helper tools kctx, kns:

[ -e /usr/share/bash-completion/completions/kubectx ] && source /usr/share/bash-completion/completions/kubectx && alias kctx="kubectx"
[ -e /usr/share/bash-completion/completions/kubens ] && source /usr/share/bash-completion/completions/kubens && alias kns="kubens"

[ -e /opt/homebrew/etc/bash_completion.d/kubectx ] && source /opt/homebrew/etc/bash_completion.d/kubectx && alias kctx="kubectx"
[ -e /opt/homebrew/etc/bash_completion.d/kubens ] && source /opt/homebrew/etc/bash_completion.d/kubens && alias kns="kubens"

Linux kubectx install manually, completion to pkg-config --variable=completionsdir bash-completion dir.

Change currently selected color:

export KUBECTX_CURRENT_FGCOLOR=$(tput setaf 2)

Install krew via Homebrew.

pathmunge "${HOME}/.krew/bin"

Git

[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"

[ -e /usr/local/etc/bash_completion.d/git-completion.bash ] && source /usr/local/etc/bash_completion.d/git-completion.bash
[ -e /usr/share/bash-completion/completions/git ] && source /usr/share/bash-completion/completions/git

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

__git_complete g __git_main

systemd

[ -e /usr/share/bash-completion/completions/systemctl ] && source /usr/share/bash-completion/completions/systemctl

Functions

if [ -f ${K20E_SECRET_FUNCTIONS} ]; then
    source ${K20E_SECRET_FUNCTIONS}
fi

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
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
}
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}"
}

AWS CLI

export AWS_SDK_LOAD_CONFIG=1
export AWS_VAULT_KEYCHAIN_NAME=login


if [[ "$OSTYPE" == darwin* ]]; then
    complete -C '/opt/homebrew/bin/aws_completer' aws
else
    complete -C '/usr/bin/aws_completer' aws
fi

Google Cloud SDK

Completion:

[ -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
[ -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

Python

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
}
if [ -e "/Applications/terminal-notifier.app" ]; then
    alias notify="/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
fi

Terraform

if command -v terraform 1>/dev/null 2>&1; then
    complete -C terraform terraform
fi

wezterm

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

.config

yamllint/config

Create a configuration directory: mkdir -p ${HOME}/.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

asdf

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

alias aoeu='asdf'
[ -e /opt/homebrew/opt/asdf/libexec/asdf.sh ] && source /opt/homebrew/opt/asdf/libexec/asdf.sh && complete -o default -F _asdf aoeu
if command -v eza 1>/dev/null 2>&1; then
    alias l="EZA_ICON_SPACING=2 eza --classify --icons=always --git --git-repos --grid"
    alias ls="EZA_ICON_SPACING=2 eza --classify --icons=always --git --git-repos --grid"
    alias ll="EZA_ICON_SPACING=2 eza --classify --icons=always --git --git-repos --long"
    alias lt="EZA_ICON_SPACING=2 eza --classify --icons=always --git --git-repos --tree"
    alias ltl="EZA_ICON_SPACING=2 eza --classify --icons=always --git --git-repos --tree --long"
fi

.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
[includeIf "gitdir/i:~/code/work/"]
        path = ~/code/work/.gitconfig

.gitignore-global

# -*- mode: gitignore; -*-

##########################################################################
# 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

Python

See also Python functions.

pyenv

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

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

ripgrep

See RIPGREP_CONFIG_PATH above.

--sort-files
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,enter:execute(emacsclient --no-wait {})+accept' --prompt '❯ ' --cmd-prompt 'C❯ ' --color 'light' --multi"

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

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

Host prod-*
    User krismolendyke

Host prodeu-*
    User krismolendyke

Environment

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

Starship

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

Config

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 = ""

[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
[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)'