migrate oh-my-zsh+sheldon to zinit #4

Open
opened 2023-09-08 11:36:05 +02:00 by wanderer · 1 comment
Owner

whyyy?

speed 🚀

zinit can load oh-my-zsh (and arbitrary local and online) scripts, better yet - asynchronously.

# whyyy? speed 🚀 [`zinit`](https://github.com/zdharma-continuum/zinit) can load `oh-my-zsh` (and arbitrary local and online) scripts, better yet - asynchronously.
wanderer added the
enhancement
label 2023-09-08 11:36:05 +02:00
wanderer self-assigned this 2023-09-08 11:36:05 +02:00
Author
Owner

example .zshrc snippet, perhaps sufficient for remote systems:

# ~/.zshrc
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
    print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
    command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
    command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
        print -P "%F{33} %F{34}Installation successful.%f%b" || \
        print -P "%F{160} The clone has failed.%f%b"
fi

source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

function load_starship() {
# Load starship theme
# line 1: `starship` binary as command, from github release
# line 2: starship setup at clone(create init.zsh, completion)
# line 3: pull behavior same as clone, source init.zsh
zinit ice as"command" from"gh-r" \
          atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \
          atpull"%atclone" src"init.zsh"
}

command starship -h >&- || load_starship
test -d ~/.local/share/zinit/plugins/starship---starship && zinit light starship/starship


zinit ice wait"2" # load after 2 seconds
zinit load zdharma-continuum/history-search-multi-word

plugins=(
  git
  gitignore
  golang
  fzf
  terraform
  systemd
  safe-paste
  colored-man-pages
)
zi snippet OMZP::git
zi snippet OMZP::gitignore
zi snippet OMZP::golang
zi snippet OMZP::fzf
zi snippet OMZP::systemd
zi snippet OMZP::terraform
zi snippet OMZP::safe-paste
zi snippet OMZP::colored-man-pages
example `.zshrc` snippet, perhaps sufficient for remote systems: ```zsh # ~/.zshrc if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit" command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \ print -P "%F{33} %F{34}Installation successful.%f%b" || \ print -P "%F{160} The clone has failed.%f%b" fi source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" autoload -Uz _zinit (( ${+_comps} )) && _comps[zinit]=_zinit function load_starship() { # Load starship theme # line 1: `starship` binary as command, from github release # line 2: starship setup at clone(create init.zsh, completion) # line 3: pull behavior same as clone, source init.zsh zinit ice as"command" from"gh-r" \ atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ atpull"%atclone" src"init.zsh" } command starship -h >&- || load_starship test -d ~/.local/share/zinit/plugins/starship---starship && zinit light starship/starship zinit ice wait"2" # load after 2 seconds zinit load zdharma-continuum/history-search-multi-word plugins=( git gitignore golang fzf terraform systemd safe-paste colored-man-pages ) zi snippet OMZP::git zi snippet OMZP::gitignore zi snippet OMZP::golang zi snippet OMZP::fzf zi snippet OMZP::systemd zi snippet OMZP::terraform zi snippet OMZP::safe-paste zi snippet OMZP::colored-man-pages ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: wanderer/dotfiles#4
No description provided.