From 7076d4019109df5c7be543da8edbac7f5b124cf4 Mon Sep 17 00:00:00 2001 From: lkrav Date: Fri, 26 Jun 2026 07:33:57 -0700 Subject: [PATCH] chore(shell): powerlevel10k prompt, host-aware bootstrap, drop thefuck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - zsh prompt: replace oh-my-posh with powerlevel10k via zinit, with the instant-prompt preamble near the top of .zshrc for fast startup - remove thefuck/thefk entirely: .zshrc aliases, install-thefk, home_config/thefuck, and its .stow-global-ignore entry - link-dotfiles: one-shot host-aware bootstrap — detect macOS vs Linux, install GNU stow if missing (brew / apt/dnf/pacman), then stow both trees - retire oh-my-posh: delete the bash + pwsh installers and home_config/ohmyposh (starship covers PowerShell separately) - README: document the new bootstrap and prompt setup --- README.md | 39 ++--- home_config/ohmyposh/base.yaml | 136 --------------- home_config/ohmyposh/lkraven.toml | 164 ------------------ .../__pycache__/settings.cpython-311.pyc | Bin 150 -> 0 bytes .../__pycache__/settings.cpython-313.pyc | Bin 137 -> 0 bytes home_config/thefuck/settings.py | 26 --- home_root/.stow-global-ignore | 1 - home_root/.zshrc | 18 +- link-dotfiles | 54 +++++- link-dotfiles.ps1 | 2 +- lk-installers/install-ohmyposh | 1 - lk-installers/install-ohmyposh.ps1 | 27 --- lk-installers/install-thefk | 8 - 13 files changed, 79 insertions(+), 397 deletions(-) delete mode 100644 home_config/ohmyposh/base.yaml delete mode 100644 home_config/ohmyposh/lkraven.toml delete mode 100644 home_config/thefuck/__pycache__/settings.cpython-311.pyc delete mode 100644 home_config/thefuck/__pycache__/settings.cpython-313.pyc delete mode 100644 home_config/thefuck/settings.py delete mode 100755 lk-installers/install-ohmyposh delete mode 100644 lk-installers/install-ohmyposh.ps1 delete mode 100755 lk-installers/install-thefk diff --git a/README.md b/README.md index 61413ba..0dd7024 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,22 @@ Personal dotfiles. Configs are organized by where they get linked: | Folder | Links into | Examples | | -------------- | ------------ | --------------------------------- | | `home_root` | `~` | `.zshrc`, `.wezterm.lua`, `.nanorc` | -| `home_config` | `~/.config` | `nvim`, `ohmyposh`, `zellij`, `ghostty` | +| `home_config` | `~/.config` | `nvim`, `zellij`, `ghostty`, `aerospace` | | `windows` | Windows-only | `windows-terminal/settings.json` | | `lk-installers`| n/a | helper scripts to install tooling | ## Linux / macOS (GNU stow) -Requires [`stow`](https://www.gnu.org/software/stow/). +One-shot, host-aware: ```bash ./link-dotfiles ``` -This runs `stow home_root` and `stow --target=$HOME/.config home_config`. +It detects the host (macOS vs Linux), installs [`stow`](https://www.gnu.org/software/stow/) +if missing (Homebrew on macOS; apt/dnf/pacman on Linux), then runs +`stow home_root` and `stow --target=$HOME/.config home_config`. Re-running is +safe — stow is idempotent. ## Windows (PowerShell) @@ -45,27 +48,15 @@ write straight back into this repo. The settings include the **Australis** color scheme and the **VictorMono Nerd Font Mono** profile font; install the font (see below) so glyphs render. -## Installers +## Prompt -| Script | Platform | Purpose | -| ------------------------------- | -------- | ------------------ | -| `lk-installers/install-ohmyposh` | bash | oh-my-posh (Linux/macOS) | -| `lk-installers/install-ohmyposh.ps1` | pwsh | oh-my-posh (Windows, via winget) | +**zsh uses [Powerlevel10k](https://github.com/romkatv/powerlevel10k)** — loaded +through zinit straight from `.zshrc`, with the instant-prompt preamble near the +top for fast startup. The theme config lives at `home_root/.p10k.zsh` (stowed to +`~/.p10k.zsh`); there's no separate installer — zinit fetches it on first shell +start. -```powershell -# Windows: install oh-my-posh, then link -pwsh -File .\lk-installers\install-ohmyposh.ps1 -pwsh -File .\link-dotfiles.ps1 -``` +PowerShell uses [starship](https://starship.rs/) (configured separately). -### oh-my-posh - -The prompt theme lives at `home_config/ohmyposh/lkraven.toml` and is loaded from -your shell profile, e.g. in PowerShell: - -```powershell -oh-my-posh init pwsh --config '~/.config/ohmyposh/lkraven.toml' | Invoke-Expression -``` - -It expects a Nerd Font (e.g. **VictorMono Nerd Font Mono**) to be installed and -selected in your terminal for the glyphs to render correctly. +Both expect a **Nerd Font v3** (e.g. **VictorMono Nerd Font Mono**) installed and +selected in your terminal for glyphs to render. diff --git a/home_config/ohmyposh/base.yaml b/home_config/ohmyposh/base.yaml deleted file mode 100644 index 3c4d2b0..0000000 --- a/home_config/ohmyposh/base.yaml +++ /dev/null @@ -1,136 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json - -version: 2 -final_space: true -console_title_template: "{{ .Shell }} in {{ .Folder }}" -blocks: -- type: prompt - alignment: left - segments: - - type: session - style: diamond - foreground: p:black - background: p:yellow - leading_diamond:  - trailing_diamond:  - template: " {{ if .SSHSession }}\ueba9 {{ end }}{{ .UserName }} " - - type: path - style: powerline - powerline_symbol:  - foreground: p:white - background: p:orange - template: " \uea83 {{ path .Path .Location }} " - properties: - style: folder - - type: git - style: powerline - powerline_symbol:  - foreground: p:black - foreground_templates: - - "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}" - - "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}" - - "{{ if gt .Ahead 0 }}p:white{{ end }}" - background: p:green - background_templates: - - "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}" - - "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}" - - "{{ if gt .Ahead 0 }}#49416D{{ end }}" - - "{{ if gt .Behind 0 }}#7A306C{{ end }}" - template: " {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} " - properties: - branch_max_length: 25 - fetch_status: true - fetch_upstream_icon: true - - type: root - style: powerline - powerline_symbol:  - foreground: p:white - background: p:yellow - template: " \uf0e7 " - - type: status - style: diamond - foreground: p:white - background: p:blue - background_templates: - - "{{ if gt .Code 0 }}p:red{{ end }}" - leading_diamond:  - trailing_diamond:  - template: " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} " - properties: - always_enabled: true -- type: rprompt - segments: - - type: node - style: plain - foreground: p:green - background: transparent - template: "\ue718 " - properties: - display_mode: files - fetch_package_manager: false - home_enabled: false - - type: go - style: plain - foreground: p:blue - background: transparent - template: "\ue626 " - properties: - fetch_version: false - - type: python - style: plain - foreground: p:yellow - background: transparent - template: "\ue235 " - properties: - display_mode: files - fetch_version: false - fetch_virtual_env: false - - type: shell - style: plain - foreground: p:white - background: transparent - template: "in {{ .Name }} " - - type: time - style: plain - foreground: p:white - background: transparent - template: at {{ .CurrentDate | date "15:04:05" }} -tooltips: -- type: aws - tips: - - aws - style: diamond - foreground: p:white - background: p:orange - leading_diamond:  - trailing_diamond:  - template: " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} " - properties: - display_default: true -- type: az - tips: - - az - style: diamond - foreground: p:white - background: p:blue - leading_diamond:  - trailing_diamond:  - template: " \uebd8 {{ .Name }} " - properties: - display_default: true -transient_prompt: - foreground: p:black - background: transparent - template: "\ue0b6<,p:yellow> {{ .Folder }} \ue0b0 " -secondary_prompt: - foreground: p:black - background: transparent - template: "\ue0b6<,p:yellow> > \ue0b0 " -palette: - black: "#262B44" - blue: "#4B95E9" - green: "#59C9A5" - orange: "#F07623" - red: "#D81E5B" - white: "#E0DEF4" - yellow: "#F3AE35" diff --git a/home_config/ohmyposh/lkraven.toml b/home_config/ohmyposh/lkraven.toml deleted file mode 100644 index b92eac0..0000000 --- a/home_config/ohmyposh/lkraven.toml +++ /dev/null @@ -1,164 +0,0 @@ -console_title_template = '{{if .Root}}(Admin){{end}} {{.PWD}}' -version = 3 - -[palette] - black = '#222531' - blue = '#6388D8' - bright_70 = '#9daeb6' - bright_80 = '#b3cbcf' - bright_90 = '#cce7ec' - bright_black = '#373b46' - bright_blue = '#a4c4ff' - bright_cyan = '#42dcd1' - bright_green = '#51e08a' - bright_magenta = '#d8adff' - bright_red = '#ff854f' - bright_white = '#cce7ec' - bright_yellow = '#FFE14E' - cyan = '#00b1a8' - dark_30 = '#414751' - dark_40 = '#565f69' - dark_50 = '#6e7882' - dark_60 = '#86929d' - green = '#16B866' - magenta = '#9d78ff' - red = '#ff491a' - white = '#a9bcc3' - yellow = '#e1c631' - -[secondary_prompt] - template = '❯❯ ' - foreground = 'p:bright_green' - background = 'transparent' - -[transient_prompt] - template = '❯ ' - background = 'transparent' - foreground_templates = ['{{if gt .Code 0}}p:red{{end}}', '{{if eq .Code 0}}p:bright_green{{end}}'] - -[[blocks]] - type = 'prompt' - alignment = 'left' - - [[blocks.segments]] - template = '{{.Icon}} ' - foreground = 'p:cyan' - type = 'os' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - - [[blocks.segments]] - template = '{{ .Path }} {{ if not .Writable}}󰌾 {{end}}' - foreground = 'p:dark_50' - type = 'path' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - style = 'agnoster' - -[[blocks]] - type = 'prompt' - alignment = 'left' - - [[blocks.segments]] - leading_diamond = '' - trailing_diamond = ' ' - template = '  {{ .Venv }} ' - foreground = 'p:blue' - background = 'p:bright_black' - type = 'python' - style = 'diamond' - - [blocks.segments.properties] - cache_duration = 'none' - display_default = false - - [[blocks.segments]] - leading_diamond = '' - trailing_diamond = '' - template = ' {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }} ' - foreground = 'p:bright_cyan' - background = 'p:bright_black' - type = 'git' - style = 'diamond' - - [blocks.segments.properties] - branch_icon = ' ' - cache_duration = 'none' - commit_icon = ' ' - fetch_stash_count = true - fetch_status = true - fetch_upstream_icon = true - merge_icon = ' ' - no_commits_icon = ' ' - rebase_icon = ' ' - revert_icon = ' ' - tag_icon = ' ' - -[[blocks]] - type = 'prompt' - alignment = 'right' - - [[blocks.segments]] - template = '{{ .FormattedMs }}' - foreground = 'p:green' - type = 'executiontime' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - style = 'austin' - - [[blocks.segments]] - foreground = 'p:dark_30' - type = 'time' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - time_format = '3:04:05pm' - - [[blocks.segments]] - template = '{{.UserName}}' - foreground = 'p:dark_50' - type = 'session' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - - [[blocks.segments]] - template = ' {{ if .SSHSession }}󰄙 {{ else }}@{{ end }} ' - foreground = 'p:cyan' - type = 'session' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - - [[blocks.segments]] - template = '{{.HostName}}' - foreground = 'p:blue' - type = 'session' - style = 'plain' - - [blocks.segments.properties] - cache_duration = 'none' - -[[blocks]] - type = 'prompt' - alignment = 'left' - newline = true - - [[blocks.segments]] - template = '❯ ' - background = 'transparent' - type = 'text' - style = 'plain' - foreground_templates = ['{{if gt .Code 0}}p:red{{end}}', '{{if eq .Code 0}}p:bright_green{{end}}'] - - [blocks.segments.properties] - cache_duration = 'none' diff --git a/home_config/thefuck/__pycache__/settings.cpython-311.pyc b/home_config/thefuck/__pycache__/settings.cpython-311.pyc deleted file mode 100644 index e41c17853076b0fd05e02b01bd9bbe0db9dd519e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 150 zcmZ3^%ge<81ha2!&iKm2!0;HvfdNJ+<1-tOF`XfWA(%mv(QhR~5l|t+XOQGCP5q4g z+*JLX?4rc7)I5E?gjEsy$%s>_Zs_7u| diff --git a/home_config/thefuck/settings.py b/home_config/thefuck/settings.py deleted file mode 100644 index 8478f6d..0000000 --- a/home_config/thefuck/settings.py +++ /dev/null @@ -1,26 +0,0 @@ -# The Fuck settings file -# -# The rules are defined as in the example bellow: -# -# rules = ['cd_parent', 'git_push', 'python_command', 'sudo'] -# -# The default values are as follows. Uncomment and change to fit your needs. -# See https://github.com/nvbn/thefuck#settings for more information. -# - -# rules = [] -# exclude_rules = [] -# wait_command = 3 -# require_confirmation = True -# no_colors = False -# debug = False -# priority = {} -# history_limit = None -# alter_history = True -# wait_slow_command = 15 -# slow_commands = ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'] -# repeat = False -# instant_mode = False -# num_close_matches = 3 -# env = {'LC_ALL': 'C', 'LANG': 'C', 'GIT_TRACE': '1'} -# excluded_search_path_prefixes = [] diff --git a/home_root/.stow-global-ignore b/home_root/.stow-global-ignore index 067cc2e..f1592b8 100644 --- a/home_root/.stow-global-ignore +++ b/home_root/.stow-global-ignore @@ -1,5 +1,4 @@ ~/.config/tmux/plugins -~/.config/thefuck/__pycache__ ~/.config/btop ~/.config/neofetch ~/.config/zinit diff --git a/home_root/.zshrc b/home_root/.zshrc index 05776d9..a24ecf5 100644 --- a/home_root/.zshrc +++ b/home_root/.zshrc @@ -3,9 +3,12 @@ path=(~/bin $path) path=(~/.local/bin $path) path=(~/.cache/lk-tools/fzf/bin $path) - -# Init OhMyPosh -eval "$(oh-my-posh init zsh --config https://333e8677ac54a1845fe68813017ab7e807c87ab2@gitea.phasefinal.com/vh/dotfiles/raw/branch/master/home_config/ohmyposh/lkraven.toml)" +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi # Set ZINIT Home ZINIT_HOME="${HOME}/.config/zinit/zinit.git" @@ -20,6 +23,10 @@ fi source "${ZINIT_HOME}/zinit.zsh" # add zinit +# Powerlevel10k prompt theme (replaces oh-my-posh; instant prompt = fast startup) +zinit ice depth=1 +zinit light romkatv/powerlevel10k + zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-autosuggestions @@ -67,7 +74,7 @@ alias cat='bat' alias tree='eza --tree' # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git" @@ -99,9 +106,6 @@ export BAT_THEME=Nord eval "$(zoxide init zsh)" alias cd='z' -eval $(thefuck --alias) -eval $(thefuck --alias fk) - zinit light Aloxaf/fzf-tab diff --git a/link-dotfiles b/link-dotfiles index dd39023..a27e3cb 100755 --- a/link-dotfiles +++ b/link-dotfiles @@ -1,3 +1,53 @@ -#!/bin/bash +#!/usr/bin/env bash +# One-shot, host-aware dotfile linker for Linux & macOS. +# +# home_root/* -> ~/ (e.g. ~/.zshrc) via `stow home_root` +# home_config/* -> ~/.config/ (e.g. ~/.config/nvim) via `stow home_config` +# +# Ensures GNU stow is present first (Homebrew on macOS; apt/dnf/pacman on Linux), +# so a fresh box needs nothing pre-installed. Re-running is safe — stow is +# idempotent and refuses to clobber unrelated real files. +# +# Windows / PowerShell: run ./link-dotfiles.ps1 instead (stow has no native +# Windows port; the .ps1 mirrors this with junctions + symlinks). +set -euo pipefail + +repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$repo" + +ensure_stow() { + command -v stow >/dev/null 2>&1 && return + + echo "GNU stow not found — installing it…" + case "$(uname -s)" in + Darwin) + if ! command -v brew >/dev/null 2>&1; then + echo "error: Homebrew is required on macOS. Run ./lk-installers/macinstaller first." >&2 + exit 1 + fi + brew install stow + ;; + Linux) + if command -v apt >/dev/null 2>&1; then sudo apt update && sudo apt install -y stow + elif command -v dnf >/dev/null 2>&1; then sudo dnf install -y stow + elif command -v pacman >/dev/null 2>&1; then sudo pacman -S --noconfirm stow + else + echo "error: no supported package manager (apt/dnf/pacman). Install GNU stow manually." >&2 + exit 1 + fi + ;; + *) + echo "error: unsupported OS '$(uname -s)'. On Windows run ./link-dotfiles.ps1 instead." >&2 + exit 1 + ;; + esac +} + +ensure_stow + +echo "Linking home_root -> ~" stow -v home_root -stow -v --target=$HOME/.config/ home_config +echo "Linking home_config -> ~/.config" +stow -v --target="$HOME/.config" home_config + +echo "Done." diff --git a/link-dotfiles.ps1 b/link-dotfiles.ps1 index 91d7a53..06b8fcc 100644 --- a/link-dotfiles.ps1 +++ b/link-dotfiles.ps1 @@ -6,7 +6,7 @@ .DESCRIPTION stow can't run natively on Windows, so this mirrors what it does: home_root/* -> ~\ (e.g. ~\.zshrc) - home_config/* -> ~\.config\ (e.g. ~\.config\ohmyposh) + home_config/* -> ~\.config\ (e.g. ~\.config\nvim) Directories are linked with junctions and files with symlinks/hardlinks, none of which need administrator rights (junctions and hardlinks never do; diff --git a/lk-installers/install-ohmyposh b/lk-installers/install-ohmyposh deleted file mode 100755 index fc99f28..0000000 --- a/lk-installers/install-ohmyposh +++ /dev/null @@ -1 +0,0 @@ -curl -s https://ohmyposh.dev/install.sh | bash -s diff --git a/lk-installers/install-ohmyposh.ps1 b/lk-installers/install-ohmyposh.ps1 deleted file mode 100644 index 2a8a239..0000000 --- a/lk-installers/install-ohmyposh.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env pwsh -<# -.SYNOPSIS - Install oh-my-posh on Windows (parity with ./lk-installers/install-ohmyposh). -.DESCRIPTION - Uses winget when available; otherwise falls back to the official installer. - No administrator rights are required (installs to the current user). -#> -[CmdletBinding()] -param() -$ErrorActionPreference = 'Stop' - -if (Get-Command oh-my-posh -ErrorAction SilentlyContinue) { - Write-Host "oh-my-posh already installed: $((Get-Command oh-my-posh).Source)" - return -} - -if (Get-Command winget -ErrorAction SilentlyContinue) { - Write-Host "Installing oh-my-posh via winget..." - winget install JanDeDobbeleer.OhMyPosh -s winget --accept-source-agreements --accept-package-agreements -} else { - Write-Host "winget not found; using the official installer script..." - Set-ExecutionPolicy Bypass -Scope Process -Force - Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1')) -} - -Write-Host "Done. Open a new shell so PATH refreshes, then run .\link-dotfiles.ps1" diff --git a/lk-installers/install-thefk b/lk-installers/install-thefk deleted file mode 100755 index c66aa2f..0000000 --- a/lk-installers/install-thefk +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -sudo apt update -sudo apt install python3-dev python3-pip python3-setuptools python3-venv -python3 -m venv ~/homebase -source ~/homebase/bin/activate -pip3 install thefuck -mv ~/homebase/bin/fuck ~/.local/bin/ -mv ~/homebase/bin/thefuck ~/.local/bin/