zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.97k stars 126 forks source link

[maint]: improve readability of Zinit source code #238

Open vladdoster opened 2 years ago

vladdoster commented 2 years ago

Summary

Inconsistent line length & wrapping, making it hard to read, grok, and edit Zinit.

Examples:

  1. zinit-install.zsh#L4
  2. zinit-install.zsh#L995
  3. zinit-install.zsh#L1848

Proposed fix

Add the following Vim Modeline to all Zinit source code:

vim: ft=zsh et ts=2 sw=2
pschmitt commented 2 years ago

Given the overall line length, I'd consider ts=2 sw=2

vladdoster commented 2 years ago

@pschmitt agreed.

Ive attempted formatting bits here and there, but is really tedious. Additionally, we need to find a way to enforce Zsh formatting. Do you know of any formatting tools for Zsh? To seriously consider shfmt would require changing all the conditional blocks to the more traditional bash syntax.

Edit: updated vim mode-line from 4 -> 2

vladdoster commented 2 years ago

Progress

PR File
#318 share/git-process-output.zsh
#319 share/rpm2cpio.zsh
#325 share/single-line.zsh
_zinit
zinit-additional.zsh
zinit-autoload.zsh
zinit-install.zshsh
zinit.zsh