vault backup: 2026-01-05 13:03:55

This commit is contained in:
windyboy
2026-01-05 13:03:55 +08:00
parent 21460fc35d
commit be7c6cdcc9
589 changed files with 396508 additions and 27 deletions
@@ -0,0 +1,173 @@
To set up **Oh My Posh** with **Zsh** on **Debian 12**, follow these steps to install the necessary components and configure your terminal prompt.
## Installation Steps
### 1. Download the Oh My Posh Binary
First, you need to download the Oh My Posh binary suitable for Linux. Open your terminal and run the following command:
```bash
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
```
### 2. Set Executable Permissions
Make the downloaded binary executable:
```bash
sudo chmod +x /usr/local/bin/oh-my-posh
```
### 3. Create a Directory for Themes
You need a directory to store your themes. Create it using:
```bash
mkdir -p ~/.poshthemes
```
### 4. Download Themes
You can download predefined themes from the Oh My Posh repository. For example, to download the latest themes, run:
```bash
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
```
Unzip the downloaded file:
```bash
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
```
Then, clean up by removing the zip file:
```bash
rm ~/.poshthemes/themes.zip
```
### 5. Update Your Zsh Configuration
Now, you need to configure your Zsh shell to use Oh My Posh. Open your `.zshrc` file in a text editor:
```bash
nano ~/.zshrc
```
Add the following line at the end of the file to initialize Oh My Posh with a specific theme (replace `alien` with your preferred theme name):
```bash
eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/alien.omp.json)"
```
### 6. Apply Changes
After saving and closing the `.zshrc` file, apply the changes by running:
```bash
source ~/.zshrc
```
## Additional Configuration
### Install a Nerd Font (Optional)
For better aesthetics, install a Nerd Font that supports icons used by Oh My Posh. You can download fonts like **Meslo** or **Fira Code** from their respective repositories and install them on your system.
### Set Terminal Font
Finally, ensure that your terminal emulator is configured to use the newly installed Nerd Font for optimal display of icons and symbols.
By following these steps, you will have successfully set up Oh My Posh with Zsh on Debian 12, enhancing your terminal's appearance and functionality.
Citations:
[1] https://dev.to/karleeov/wsl-arch-setup-for-oh-my-posh-51pa
[2] https://www.reddit.com/r/NixOS/comments/1ge1gwn/how_to_set_ohmyposh_settings/
[3] https://ohmyposh.dev/docs/installation/linux
[4] https://www.librebyte.net/en/cli-en/oh-my-posh-a-beatifull-prompt-for-your-shell/
[5] https://www.youtube.com/watch?v=nGHgyPLi7UM
[6] https://calebschoepp.com/blog/2021/how-to-setup-oh-my-posh-on-ubuntu/
[7] https://www.linux.org/threads/need-help-finalizing-oh-my-posh-bash-terminal.52617/
.zshrc
```
#go lang
export GOROOT=/usr/local/go
export GOPATH=/home/windy/go-lang
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/powerlevel10k_modern.omp.json)"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Zinit setup and plugin management
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
source "${ZINIT_HOME}/zinit.zsh"
# Load essential annexes (non-turbo mode for annex functionality)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
# Load Zeno plugin with keybindings
zinit ice lucid depth"1" blockf
zinit light yuki-yano/zeno.zsh
if [[ -n $ZENO_LOADED ]]; then
bindkey ' ' zeno-auto-snippet
bindkey '^m' accept-line
bindkey '^i' zeno-completion
bindkey '^g' zeno-ghq-cd
bindkey '^r' zeno-history-selection
bindkey '^x' zeno-insert-snippet
fi
# Load additional Zsh plugins
zinit ice wait"0"; zinit light zsh-users/zsh-completions
autoload -Uz compinit && compinit
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:default' menu select=1
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
# FZF configuration
zi ice from"gh-r" as"program"
zi light junegunn/fzf
# Auto-suggestions styling
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=244"
# History settings
HISTFILE=~/.zsh-history
HISTSIZE=100000
SAVEHIST=1000000
HISTDUP=erase
setopt appendhistory sharehistory hist_ignore_space hist_ignore_all_dups
setopt hist_save_no_dups hist_ignore_dups hist_find_no_dups
setopt inc_append_history share_history
# Zsh options for usability
setopt AUTO_CD
setopt AUTO_PARAM_KEYS
# Completion and FZF styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
# Load additional plugins with default keys
zinit pack"default+keys" for fzf
# Ensure Zinit autocompletion
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Consolidate PATH with deduplication
export PATH=$(echo "/run/current-system/sw/bin:/usr/local/bin:/usr/local/sbin:$PATH" | tr ':' '\n' | awk '!seen[$0]++' | tr '\n' ':' | sed 's/:$//')
```