From b28f38d4c0bad766a37de8724878c9aec3363e66 Mon Sep 17 00:00:00 2001 From: reachableceo Date: Tue, 1 Sep 2026 11:40:44 -0500 Subject: [PATCH] chezmoi v2: omz + p10k + fzf + vi-mode zsh, tmux, per-account gitconfig (#612) Rewrote the Aug-1 sandbox-era source into a full workstation setup for both ultix-streaming accounts: oh-my-zsh with autosuggestions/ syntax-highlighting/completions + powerlevel10k (pinned externals), fzf wiring, vi mode, tmux conf, aliases under ~/.config/zsh, gitconfig template that keeps hooksPath/tea for reachableceo only. Detail + verification: https://projects.knownelement.com/issues/612#note-3335 --- .chezmoiexternal.toml | 37 ++++ .gitignore | 1 + README.md | 37 ++++ dot_gitconfig => dot_gitconfig.tmpl | 26 +-- dot_p10k.zsh | 17 ++ dot_tmux.conf | 33 ++++ dot_zshrc | 183 ++++++++---------- private_dot_config/crush/crush.json | 15 +- .../zsh/aliases.sh | 69 +++---- .../zsh/variables.sh | 7 +- 10 files changed, 260 insertions(+), 165 deletions(-) create mode 100644 .chezmoiexternal.toml create mode 100644 .gitignore create mode 100644 README.md rename dot_gitconfig => dot_gitconfig.tmpl (52%) create mode 100644 dot_p10k.zsh create mode 100644 dot_tmux.conf rename zshconf/reachableceo-zshrc-aliases.sh => private_dot_config/zsh/aliases.sh (63%) rename zshconf/reachableceo-zshrc-variables.sh => private_dot_config/zsh/variables.sh (73%) diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml new file mode 100644 index 0000000..fd5cd18 --- /dev/null +++ b/.chezmoiexternal.toml @@ -0,0 +1,37 @@ +# oh-my-zsh + custom plugins/themes, fetched at apply time. +# Tag archives = pinned; branch archives re-check per refreshPeriod. +# NOTE: no "exact" on .oh-my-zsh so custom/ additions survive refresh. + +[".oh-my-zsh"] + type = "archive" + url = "https://github.com/ohmyzsh/ohmyzsh/archive/refs/heads/master.tar.gz" + stripComponents = 1 + refreshPeriod = "720h" + +[".oh-my-zsh/custom/plugins/zsh-autosuggestions"] + type = "archive" + url = "https://github.com/zsh-users/zsh-autosuggestions/archive/refs/tags/v0.7.1.tar.gz" + stripComponents = 1 + exact = true + refreshPeriod = "720h" + +[".oh-my-zsh/custom/plugins/zsh-syntax-highlighting"] + type = "archive" + url = "https://github.com/zsh-users/zsh-syntax-highlighting/archive/refs/heads/master.tar.gz" + stripComponents = 1 + exact = true + refreshPeriod = "720h" + +[".oh-my-zsh/custom/plugins/zsh-completions"] + type = "archive" + url = "https://github.com/zsh-users/zsh-completions/archive/refs/heads/master.tar.gz" + stripComponents = 1 + exact = true + refreshPeriod = "720h" + +[".oh-my-zsh/custom/themes/powerlevel10k"] + type = "archive" + url = "https://github.com/romkatv/powerlevel10k/archive/refs/heads/master.tar.gz" + stripComponents = 1 + exact = true + refreshPeriod = "720h" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e494a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.crush/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e3fad99 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# dotfiles + +Chezmoi-managed dotfiles for the ultix-streaming (VM 5111) human +accounts: `reachableceo` and `reachableceo-offstage`. + +- Redmine work item: https://projects.knownelement.com/issues/612 +- Discourse doc (design + rationale): + https://community.turnsys.com/t/314 + +## What's managed + +- `~/.zshrc` — oh-my-zsh + powerlevel10k + autosuggestions / + syntax-highlighting / completions, vi mode, fzf, history prefs +- `~/.config/zsh/` — aliases.sh, variables.sh (personal snippets) +- `~/.p10k.zsh` — lean theme, compatible glyphs (run `p10k configure` + on a nerd-font terminal to upgrade) +- `~/.tmux.conf` — Ctrl-a prefix, mouse, vi copy mode +- `~/.vimrc`, `~/.gitconfig` (template: hooksPath + tea helper render + only for `reachableceo`) +- `~/.config/crush/crush.json` + +oh-my-zsh, plugins, and powerlevel10k come from pinned archives via +`.chezmoiexternal.toml` (chezmoi fetches them at apply time). + +## Usage + + chezmoi apply # apply changes (source: ~/projects/dotfiles) + chezmoi edit # edit a managed file in the source + chezmoi re-add # refresh source from live state + +Edit source -> `chezmoi apply` -> commit -> push. + +`reachableceo-offstage` applies from a local clone (no gitea creds on +that account); refresh it as root: + + sudo cp -r ~reachableceo/projects/dotfiles ~reachableceo-offstage/projects/ + sudo chown -R reachableceo-offstage:reachableceo-offstage ~reachableceo-offstage/projects/dotfiles diff --git a/dot_gitconfig b/dot_gitconfig.tmpl similarity index 52% rename from dot_gitconfig rename to dot_gitconfig.tmpl index 7ba3588..a4bfe2f 100644 --- a/dot_gitconfig +++ b/dot_gitconfig.tmpl @@ -1,22 +1,14 @@ [user] - email = reachableceo@turnsys.com - name = Charles N Wyble -[filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - required = true -[credential "https://reachableceo.com"] - provider = generic -[credential "https://handbook.turnsys.com"] - provider = generic -[credential "https://shopbook.startinglineproductions.com"] - provider = generic + name = reachableceo + email = charles@turnsys.com +{{ if eq .chezmoi.username "reachableceo" -}} +[credential "https://git.knownelement.com"] + helper = + helper = !tea login helper +[core] + hooksPath = /home/reachableceo/projects/ukrrs/TSYSGroupAIOS/hooks/global +{{- end }} [alias] lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all lg = !"git lg1" -[http] - sslVerify = false -[oh-my-zsh] - hide-status = 1 diff --git a/dot_p10k.zsh b/dot_p10k.zsh new file mode 100644 index 0000000..6d5ad15 --- /dev/null +++ b/dot_p10k.zsh @@ -0,0 +1,17 @@ +# p10k — lean, compatible glyphs (no nerd font required on fresh hosts). +# Run `p10k configure` on a nerd-font terminal for the full treatment; +# it will rewrite this file. + +typeset -g POWERLEVEL9K_MODE=compatible + +typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) +typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs time) + +typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false +typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=3 +typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique +typeset -g POWERLEVEL9K_VCS_SHORTEN_STRATEGY=truncate_to_unique +typeset -g POWERLEVEL9K_VCS_SHORTEN_MAX_LENGTH=40 +typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 +typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M}' +typeset -g POWERLEVEL9K_STATUS_VERBOSE=false diff --git a/dot_tmux.conf b/dot_tmux.conf new file mode 100644 index 0000000..fa17ec6 --- /dev/null +++ b/dot_tmux.conf @@ -0,0 +1,33 @@ +# ~/.tmux.conf — chezmoi-managed. Ctrl-a prefix, mouse, vi copy mode. + +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +set -g mouse on +set -g history-limit 100000 +set -g default-terminal "tmux-256color" +set -ga terminal-overrides ",xterm-256color:RGB" +set -sg escape-time 10 +set -g focus-events on +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on + +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" + +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +setw -g mode-keys vi +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send -X copy-selection-and-cancel + +set -g status-style "bg=default,fg=default" +set -g status-left "#[fg=cyan,bold][#S] " +set -g status-right "#[fg=cyan]%H %Y-%m-%d %H:%M " +set -g status-right-length 50 diff --git a/dot_zshrc b/dot_zshrc index a79bda7..bbecfcc 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -1,132 +1,115 @@ -#CNW Customized zshrc - -# Last updated 2025-01-14 - -# This is running on ultix-sandbox. That is my peramment home/base of operations. -# I try to minimize interactive shell use on other systems and do everything via gitops or termix - -# This files merges : -# - my own creature comforts/wants -# along with stuff from -# - oh-my-zsh installer -# - powerline -# - powerlevl10k - - -# Oh-my-zsh +# CNW zshrc — chezmoi-managed (dotfiles repo, Redmine #612) +# Home base: ultix-streaming (VM 5111). Minimal interactive footprint +# anywhere else; heavy lifting happens in containers. +# +# Layers: oh-my-zsh + powerlevel10k, fzf, vi mode, ~/.config/zsh/* snippets. +##################################################################### +# oh-my-zsh +##################################################################### export ZSH="$HOME/.oh-my-zsh" -ZSH_THEME="robbyrussell" +ZSH_THEME="powerlevel10k/powerlevel10k" + +# externals in .chezmoiexternal.toml own updates +zstyle ':omz:update' mode disabled + ENABLE_CORRECTION="true" DISABLE_UNTRACKED_FILES_DIRTY="true" HIST_STAMPS="yyyy-mm-dd" -plugins=(git) + +plugins=( + git + sudo + z + extract + copypath + colored-man-pages + command-not-found + zsh-completions + zsh-autosuggestions + zsh-syntax-highlighting +) + source $ZSH/oh-my-zsh.sh +# powerlevel10k (run `p10k configure` any time for the fancy wizard) +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +##################################################################### +# Creature comforts +##################################################################### - - - - - - -################################################################################################################################### -# CNW configuration from here -################################################################################################################################### - - -############################# -############################# -# Creature comforts -############################# -############################# - -######### -#VIM MODE -######### - -#vi 24x7 yo, this isn't a holiday inn (ti was last night, it isn't now) -bindkey -v # vi key bindings +# vi mode, 24x7 — this isn't a holiday inn +bindkey -v +export KEYTIMEOUT=1 set -o vi +export EDITOR='vim' +export VISUAL='vim' +export PAGER='less' +export LESS='-R' -if [[ -n $SSH_CONNECTION ]]; then - export EDITOR='vim' -else - export EDITOR='vim' -fi +# Debian's fd-find ships fdfind; make it fd +command -v fdfind >/dev/null 2>&1 && alias fd='fdfind' +# Debian's bat ships batcat +command -v batcat >/dev/null 2>&1 && alias bat='batcat' -################################### -################################### -# History configurations -################################### -################################### +##################################################################### +# History +##################################################################### HISTFILE=~/.zsh_history HISTSIZE=10000 -SAVEHIST=50000000 #Number of history entries to save to disk -HIST_STAMPS="mm/dd/yyyy" -setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE -setopt hist_ignore_dups # ignore duplicated commands history list -HISTDUP=erase #Erase duplicates in the history file -setopt hist_verify # show command with history expansion to user before running it -setopt appendhistory #Append history to the history file (no overwriting) -setopt incappendhistory #Immediately append to the history file, not just when a term is killed +SAVEHIST=50000 +setopt hist_expire_dups_first +setopt hist_ignore_dups +setopt hist_verify +setopt appendhistory +setopt incappendhistory +HISTDUP=erase +alias history="history 0" -alias history="history 0" # force zsh to show the complete history - -#DO NOT Share history across terminals +# DO NOT share history across terminals setopt no_share_history -unsetopt sharehistory +unsetopt sharehistory -TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P' # configure `time` format +TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P' +##################################################################### +# fzf (Debian package paths) +##################################################################### -################################### -################################### -# SSH related things -################################### -################################### +if [[ -r /usr/share/doc/fzf/examples/key-bindings.zsh ]]; then + source /usr/share/doc/fzf/examples/key-bindings.zsh +fi +if [[ -r /usr/share/doc/fzf/examples/completion.zsh ]]; then + source /usr/share/doc/fzf/examples/completion.zsh +fi +export FZF_DEFAULT_COMMAND='fdfind --type f --hidden --follow --exclude .git 2>/dev/null || rg --files --hidden --glob "!.git" 2>/dev/null' +command -v fdfind >/dev/null 2>&1 && _fzf_compgen_path() { fdfind --hidden --follow --exclude .git . "$1" 2>/dev/null; } -###################### -# Bitwarden SSH Agent -###################### +##################################################################### +# SSH agent — bitwarden agent socket if present (path per-host) +##################################################################### -export SSH_AUTH_SOCK=/home/charles/.bitwarden-ssh-agent.sock +if [[ -S "$HOME/.bitwarden-ssh-agent.sock" ]]; then + export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock" +fi +##################################################################### +# Paths and loaders (conditional — hosts without these skip) +##################################################################### -################################### -################################### -# Paths and loaders -################################### -################################### - -####### -# Rust -####### - -. "$HOME/.cargo/env" - -####### -# MISE -####### +[[ -r "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env" if command -v mise &> /dev/null; then eval "$(mise activate zsh)" fi +##################################################################### +# Personal snippets (also chezmoi-managed) +##################################################################### -################################### -################################### -#Aliases... -################################### -################################### - -source ~/Projects/ReachableCEO/dotfiles/zsh-configs/reachableceo-zshrc-aliases.sh - - - - - +[[ -r "$HOME/.config/zsh/variables.sh" ]] && source "$HOME/.config/zsh/variables.sh" +[[ -r "$HOME/.config/zsh/aliases.sh" ]] && source "$HOME/.config/zsh/aliases.sh" diff --git a/private_dot_config/crush/crush.json b/private_dot_config/crush/crush.json index a770a7d..7495667 100644 --- a/private_dot_config/crush/crush.json +++ b/private_dot_config/crush/crush.json @@ -1,8 +1,11 @@ { - "$schema": "https://charm.land/crush.json", - "options": { - "attribution": { - "trailer_style": "none" - } + "hooks": { + "PreToolUse": [ + { + "matcher": "^(bash|edit|write|multiedit|lsp_replace_symbol|lsp_rename)$", + "command": "/home/reachableceo/projects/ukrrs/TSYSGroupAIOS/hooks/global/ticket-gate.sh", + "timeout": 5 + } + ] } -} \ No newline at end of file +} diff --git a/zshconf/reachableceo-zshrc-aliases.sh b/private_dot_config/zsh/aliases.sh similarity index 63% rename from zshconf/reachableceo-zshrc-aliases.sh rename to private_dot_config/zsh/aliases.sh index ac298ec..0d0df14 100644 --- a/zshconf/reachableceo-zshrc-aliases.sh +++ b/private_dot_config/zsh/aliases.sh @@ -1,4 +1,6 @@ - +################################### +# ~/.config/zsh/aliases.sh — chezmoi-managed +################################### ################################### #Marp @@ -17,7 +19,6 @@ alias marp-serve='docker run --rm --init -v $PWD:/home/marp/app -e LANG=$LANG -p alias cloudron='mise exec node@22 -- cloudron login' - ################################################### # SSH shortcuts ################################################### @@ -30,52 +31,33 @@ alias hearth-bds='ssh charles@hearth-bds.thefnf.net' alias hearth-uds='ssh charles@hearth-uds.thefnf.net' ##################################################### -#PFV HOSTS ##################################################### -#Bare metal systems (in band access) - Production +#PFV HOSTS +##################################################### +#Bare metal systems (in band access) - Production #Upstairs, production alias ausprod-core-ap01='telnet ausprod-core-ap01.turnsys.net' alias ausprod-core-sw01='telnet ausprod-core-sw01.turnsys.net' -#alias netbox='ssh -i $PATH_TO_KEY $LABUSER@netbox.dev.thefnf.net' #gns3 with ios/juniper/comware/extreme os/tinycore/openflow (ALL THE NETWORK THINGS) -#alias cudasys='ssh -i $PATH_TO_KEY $LABUSER@cudasys.dev.thefnf.net' #cuda awesomeness - ########################################################### -#Inband access (ssh/telnet) # -########################################################### -#alias rr-con-sw4='ssh $RRLABUSER:7003@ausprod.consrv.turnsys.net' -#alias rr-con-r7='ssh $RRLABUSER:7021@ausprod-consrv.turnsys.net' -#TBDalias rr-con-r8='ssh $RRLABUSER:7021@ausprod-consrv.turnsys.net' -#TBDalias rr-con-r10='ssh $RRLABUSER:7021@ausprod-consrv.turnsys.net' +# Project context aliases (StartProject.sh when present) ########################################################### +alias context-docs-techops='StartProject.sh $HOME/code/techops/docs-techops' +alias context-notes-public='StartProject.sh $HOME/notes-public' +alias context-docs-subo='StartProject.sh $HOME/code/RD/docs-suborbital' +alias context-docs-rr='StartProject.sh $HOME/code/RD/docs-rackrental' +alias context-dotfiles='StartProject.sh $HOME/projects/dotfiles' +alias context-tsys-dev='StartProject.sh $HOME/code/techops/tsys-dev' -########################################################### -# Project context aliases -########################################################### +alias context-rd-MorseFlyer='StartProject.sh $HOME/RD/Morse/Internal/' -### Documentaton -alias context-docs-techops='StartProject.sh ~/charles/code/techops/docs-techops' -alias context-notes-public='StartProject.sh ~/charles/notes-public' -alias context-docs-subo='StartProject.sh ~/charles/code/RD/docs-suborbital' -alias context-docs-rr='StartProject.sh ~/charles/code/RD/docs-rackrental' - -### Configs -alias context-dotfiles='StartProject.sh ~/charles/dotfiles-git' -alias context-tsys-dev='StartProject.sh ~/charles/code/techops/tsys-dev' - -### Code - internal -alias context-rd-MorseFlyer='StartProject.sh ~/charles/RD/Morse/Internal/' - -### Code - BizOps/TechOps -alias context-services-bizops='StartProject.sh ~/charles/code/techops/ITBackOfficeFLOStack' +alias context-services-bizops='StartProject.sh $HOME/code/techops/ITBackOfficeFLOStack' ############################################################## #Docker / k8s aliases, cause i'm a docker/kubefarm fanboi now ############################################################## -## Most docker/k8s use is via vscode now, but somtimes you wanna drop to a shell and do some stuff... - alias dc='docker-compose' alias dcu='docker compose up' alias dcd='docker compose down' @@ -97,7 +79,6 @@ alias k0-dqu-gp='export KUBECONFIG=~/.kube/custom-contexts/context-dqu-config.ym alias k0-prod-gn='export KUBECONFIG=~/.kube/custom-contexts/context-prod-config.yml ; kgn' alias k0-prod-gp='export KUBECONFIG=~/.kube/custom-contexts/context-prod-config.yml ; kgp' - ############################################################# # Command aliases... ############################################################# @@ -110,14 +91,22 @@ alias vi='vim' alias id0='sudo -i' -alias ls='ls --color' -alias grep='rg --color auto' -alias wget='wget --no-check-certificate' -alias curl='curl --insecure' +alias ls='ls --color=auto' +alias grep='grep --color=auto' alias cls='clear ; ls' +# eza comforts (ll/la/tree-ish) when present +if command -v eza >/dev/null 2>&1; then + alias ll='eza -l --git --group-directories-first' + alias la='eza -la --git --group-directories-first' + alias lt='eza --tree --level=2 --group-directories-first' +fi + +# ripgrep +alias rgi='rg -i' + #Git / git stuff alias gup='git pull' alias lpom='git add -A :/ ; git commit -va' -alias gpom=' git push --tags origin master' -alias tesla='gup;lpom;gpom' \ No newline at end of file +alias gpom='git push --tags origin master' +alias tesla='gup;lpom;gpom' diff --git a/zshconf/reachableceo-zshrc-variables.sh b/private_dot_config/zsh/variables.sh similarity index 73% rename from zshconf/reachableceo-zshrc-variables.sh rename to private_dot_config/zsh/variables.sh index 9820617..e3b7272 100644 --- a/zshconf/reachableceo-zshrc-variables.sh +++ b/private_dot_config/zsh/variables.sh @@ -1,3 +1,7 @@ +################################### +# ~/.config/zsh/variables.sh — chezmoi-managed +################################### + ##################################################### #Personal host variables ##################################################### @@ -10,5 +14,4 @@ PERSONAL_OOB_USER="root" PERSONAL_INBAND_USER="root" ##################################################### -export ATUIN_SYNC_ADDRESS=http://charlesdevserver.knel.net:2003 -export LANG=en_US.UTF-8 \ No newline at end of file +export LANG=en_US.UTF-8