-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify Zsh config and remove bloat #1881
base: main
Are you sure you want to change the base?
Conversation
In my [feature request](prasanthrangan#1880), I initially misstated that Powerlevel10k was unmaintained. However, recent activity shows it is still receiving updates. - Revised Zsh Configuration: Improved clarity and ease of user configuration, maintaining the same functionality. - Removed Dependencies: Eliminated the need for additional packages like Powerlevel10k and Oh My Zsh, simplifying the setup. - Plugin Management: Utilised Zinit as the plugin manager and added three previously used plugins. - Omitted Oh My Zsh: Chose not to include Oh My Zsh due to its bloat and noticeable impact on shell startup time. - Implemented Zinit Snippets: Added plugins using Zinit’s snippet functionality for installation via URL. Additional Notes: - The maintainer of these dotfiles may need to review restore_shl.sh, as I’m uncertain about what to remove to prevent potential issues.
I do agree on the bloat of ohmyzsh. This will be a breaking change maybe you can benchmark and show results between them |
Also, as an conversation: maybe to change p10k to i.e. oh-my-posh? Because p10k won't be receiving updates anymore. |
It will be receiving updates but the pace of updates will be very slow cc: romkatv/powerlevel10k#2690 (comment) . Its a matter of time , before a fork appears |
Apologies for the delayed response; I’ve been rather busy lately. Anyway, here are the benchmarks: zinit is slightly slower than some of the alternatives, but I’ve chosen to stick with zinit because it’s the most actively maintained option. It’s consistently being improved, and the load time isn’t a significant issue. That’s just my take on it. However, if you prefer to go with a different plugin manager, I’ll accommodate that. |
Yeah . Lets hold on with the PR and look for a viable option that doesnt compromise perf with ux like ohmyzsh |
I'm using $ time zsh -i -c exit
zsh -i -c exit 0.04s user 0.03s system 91% cpu 0.081 total |
@rubiin Here you go ~/.config/sheldon/plugins.toml shell = "zsh"
plugins.'zsh-users/zsh-completions'.github = 'zsh-users/zsh-completions'
plugins.'zsh-users/zsh-syntax-highlighting'.github = 'zsh-users/zsh-syntax-highlighting'
plugins.'zsh-users/zsh-history-substring-search'.github = 'zsh-users/zsh-history-substring-search'
plugins.'Aloxaf/fzf-tab'.github = 'Aloxaf/fzf-tab' ~/.config/oh-my-posh/config.toml "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
version = 2
disable_notice = true
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'path'
style = 'plain'
template = '{{ .Path }} '
foreground = 'lightGreen'
[blocks.segments.properties]
style = 'full'
[[blocks.segments]]
type = 'git'
style = 'plain'
template = '<#ffffff>on</> {{ .HEAD }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }} '
[blocks.segments.properties]
branch_icon = ''
fetch_stash_count = true
[[blocks.segments]]
type = 'python'
style = 'powerline'
template = '[ {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}] '
foreground = '#906cff'
[[blocks.segments]]
type = 'go'
style = 'powerline'
template = '[ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}] '
foreground = '#7FD5EA'
[[blocks.segments]]
type = 'node'
style = 'powerline'
template = '[ {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}] '
foreground = '#76b367'
[[blocks.segments]]
type = 'ruby'
style = 'powerline'
template = '[ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}] '
foreground = '#f44336'
[[blocks.segments]]
type = 'java'
style = 'powerline'
template = '[ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}] '
foreground = '#ea2d2e'
[[blocks.segments]]
type = 'julia'
style = 'powerline'
template = '[ {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}] '
foreground = '#4063D8'
[[blocks]]
type = 'rprompt'
overflow = 'hidden'
[[blocks.segments]]
type = 'executiontime'
style = 'plain'
template = '{{ .FormattedMs }}'
background = 'transparent'
foreground = 'yellow'
[blocks.segments.properties]
threshold = 5000.0
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
[[blocks.segments]]
type = 'text'
style = 'plain'
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
template = '❯ '
background = 'transparent'
[transient_prompt]
foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}']
template = '❯ '
background = 'transparent'
[secondary_prompt]
template = '❯❯ '
background = 'transparent'
foreground = 'magenta' ~/.zshrc #!/usr/bin/env zsh
# Environment variables
export EDITOR=vim
# If one of the VISUAL or EDITOR environment variables contain the string 'vi' when the shell starts up then it will be viins,
# otherwise it will be emacs. bindkey's -e and -v options provide a convenient way to override this default choice.
bindkey -e
eval "$(dircolors -b)"
eval "$(oh-my-posh init zsh --config ~/.config/oh-my-posh/config.toml)"
# Load zsh plugins via sheldon
eval "$(sheldon source)"
# Check for zsh plugins updates weekly
SHELDON_CONFIG="${XDG_CONFIG_HOME:-${HOME}/.config}/sheldon"
if { [ ! -f "${SHELDON_CONFIG}/update.check" ] || [[ $(find "${SHELDON_CONFIG}/update.check" -mmin +10080) ]]; }; then
sheldon lock --update
touch "${SHELDON_CONFIG}/update.check"
fi
# History
HISTSIZE=10000
SAVEHIST=$HISTSIZE
HISTFILE=~/.zsh_history
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu no
zstyle ':completion:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Load completions
autoload -Uz compinit && compinit
# Autocompletion using arrow keys (based on history)
## Arrow up
bindkey "${terminfo[kcuu1]}" history-substring-search-up
bindkey "^[[A" history-substring-search-up
## Arrow down
bindkey "${terminfo[kcud1]}" history-substring-search-down
bindkey "^[[B" history-substring-search-down
# Basic keybindings
## Home
bindkey "${terminfo[khome]}" beginning-of-line
bindkey "^[[H" beginning-of-line
## End
bindkey "${terminfo[kend]}" end-of-line
bindkey "^[[F" end-of-line
## Del
bindkey "${terminfo[kdch1]}" delete-char
bindkey "^[[3~" delete-char
# Helpful aliases
alias c='clear' # clear terminal
alias l='eza -lh --icons=auto' # long list
alias ls='eza -1 --icons=auto' # short list
alias ll='eza -lha --icons=auto --sort=name --group-directories-first' # long list all
alias ld='eza -lhD --icons=auto' # long list dirs
# Handy change dir shortcuts
alias ..='cd ..'
alias ...='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# Always mkdir a path (this doesn't inhibit functionality to make a single dir)
alias mkdir='mkdir -p' |
This is currently my ohmyzsh optimized zsh -i -c exit 0.11s user 0.06s system 112% cpu 0.150 total with sheldon zsh -i -c exit 0.08s user 0.05s system 108% cpu 0.115 total with zim zsh -i -c exit 0.05s user 0.08s system 120% cpu 0.114 total at the end , zim and sheldon seems to be kinda similar interms of speed I do like sheldons way of things as it doesnt seem to clutter zshrc |
@rubiin sheldon appears to be quite decent and impressively quick, in my view. I haven't verified whether it's still being maintained, though. Apologies for my oversight. I suppose I could switch from zinit to Sheldon and replace powerlevel10k with ohmyposh, given that it’s consistently receiving updates. This way, we won’t have to rely on someone to fork and maintain powerlevel10k. However, I'll await your response on this before making any commitments. |
@fesowowako I suppose we can do that. Since powerlevel10k is on life support |
@rubiin would you like me to add either oh-my-posh or oh-my-posh-bin to the custom_hypr.lst? I’m having a bit of trouble getting oh-my-posh to match the current powerlevel10k aesthetic. If I can’t achieve the same look, would it be acceptable to use Zeerayne's oh-my-posh configuration? It’s rather minimalistic and clean. Honestly, someone else might be better suited to make the proper adjustments than I am. However, if that's not your preference, I can simply stick with powerlevel10k for the time being, and perhaps someone else can take a crack at aligning oh-my-posh with the powerlevel10k appearance when they have the opportunity. |
lets track for powerlevel10k on another PR. I am also playing with ohmyposh myself. |
I dug around ohmyzsh and it does set some stuffs like https://github.com/ohmyzsh/ohmyzsh/blob/a72a26406ad3aa9a47c3f5227291bad23494bed0/lib/history.zsh#L42 |
I would have to disagree that zinit is the most "maintained and actively developed" ... as a matter of fact, there is so much contraversy going around zinit that it's insane, like ... the fact that the original maintainer deleted the entire zinit organization, then after lashback from community, and re-established forks, he reuploaded it as a new project, now you have multiple zinit repositories, with no clear line or sight, on which one is the official one, but either way, the newer one (one your not using) that is actually maintained by original dev, is not the one you presented in here ... althou im surprised by the benchmark results, zinit was once one of the fastest ... zimfw is very nice, but lacks vi keybinding compatibility, most plugins and enrivonment settings are tailored towards Emacs like users of shells ^^ requires tinkering if you want vi keybindings ... also, when using zimfw you need to make sure that no plugins run compinit, as it's own completion module does it at the end |
I have a custom basic .zshrc no frameworks, with a bunch of plugins, and it loads much faster then any framework, while keeps most common used settings taken from zimfw, zap-zsh, and various other .zshrc's i found on the net
want me to share it? |
@kronikpillow if you have a dotfiles repo, do share. Or maybe your zshrc |
Pull Request
Description
In my feature request, I initially misstated that Powerlevel10k was unmaintained. However, recent activity shows it is still receiving updates.
Additional Notes:
Type of change
Checklist