Giter VIP home page Giter VIP logo

zephyr's Introduction

🌬️ Zephyr

A Zsh framework as nice as a cool summer breeze

Zsh is a wonderful shell, but out-of-the-box it needs a bit of a boost. That's where Zephyr comes in.

Zephyr combines some of the best functionality from Prezto, sprinkles in a bit from Oh-My-Zsh, and removes bloat, extra dependencies, and prioritizes speed and simplicity.

Zephyr can be thought of as a fast, lightweight set of independent Zsh plugins.

Combine Zephyr with a plugin manager and some awesome plugins and you'll have a powerful Zsh setup that rivals anything out there.

Project goals

Zephyr allows you to take an a la carte approach to building your ideal Zsh configuration. Other Zsh frameworks are meant to be used wholesale and are not truly modular. Zephyr is different - each of its plugins works completely independently, and works well with modern Zsh plugin managers. Zephyr can be used in whole or in part, and works well with other popular plugins. Zephyr brings together core Zsh functionality - many not available elsewhere as standalone plugins - while favoring a build-your-own composable Zsh config through plugins.

Prompt

Zephyr comes with an (optional) Starship prompt config.

Zephyr Prompt

Install

Using a Plugin manager

If your plugin manager supports using sub-plugins, you can load Zephyr that way as well.

Antidote is one such plugin manager. You can load only the parts of Zephyr you need like so:

# .zsh_plugins.txt
# pick only the plugins you want and remove the rest
mattmc3/zephyr path:plugins/color
mattmc3/zephyr path:plugins/completion
mattmc3/zephyr path:plugins/confd
mattmc3/zephyr path:plugins/directory
mattmc3/zephyr path:plugins/editor
mattmc3/zephyr path:plugins/environment
mattmc3/zephyr path:plugins/history
mattmc3/zephyr path:plugins/homebrew
mattmc3/zephyr path:plugins/macos
mattmc3/zephyr path:plugins/prompt
mattmc3/zephyr path:plugins/utility
mattmc3/zephyr path:plugins/zfunctions

Manually

Add the following snippet to your .zshrc:

# Clone Zephyr.
[[ -d ${ZDOTDIR:-~}/.zephyr ]] ||
  git clone --depth=1 https://github.com/mattmc3/zephyr ${ZDOTDIR:-~}/.zephyr

# Use zstyle to specify which plugins you want. Order matters.
zephyr_plugins=(
  zfunctions
  directory
  editor
  history
)
zstyle ':zephyr:load' plugins $zephyr_plugins

# Source Zephyr.
source ${ZDOTDIR:-~}/.zephyr/zephyr.zsh

Plugins

  • color - Make terminal things more colorful
  • completion - Load and initialize the built-in zsh completion system
  • confd - Source conf.d like Fish
  • directory - Set options and aliases related to the dirstack and filesystem
  • editor - Override and fill in the gaps of the default keybinds
  • environment - Define common environment variables
  • history - Load and initilize the built-in zsh history system
  • homebrew - Functionality for users of Homebrew
  • macos - Functionality for macOS users
  • prompt - Load and initialize the build-in zsh prompt system
  • utility - Common shell utilities, aimed at making cross platform work less painful
  • zfunctions - Lazy load functions dir like Fish

Why don't you include...

Q: Why don't you include programming language plugins (eg: Python, Ruby)? A: These kinds of plugins can be very opinionated, and are in need of lots of upkeep from maintainers that use those languages. Language plugins are already available via Oh-My-Zsh and Prezto, and can always be installed with a plugin manager that supports subplugins.

Q: Why don't you also include popular plugins the way Prezto does (eg: zsh-autosuggestions, zsh-completions)? A: These kinds of utilities are already available as standalone plugins. Zephyr aims to include only core Zsh functionality that you can't already easily get via a plugin manager, with a few exceptions for convenience. I have experimented with including submodules similar to Prezto, but was not happy with the result. Simpler is better.

Credits

Zephyr is a derivative work of the following great projects:

zephyr's People

Contributors

ced0ps avatar janvhs avatar javs avatar mattmc3 avatar seruman avatar spirarel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zephyr's Issues

zfunctions plugin does not read from ZFUNCDIR.

Setting ZFUNCDIR saves to the correct directory (funcsave) but it will not autoload. The default directory works fine but I don’t want to save it in ~/.config/zsh/functions.

Also, the readme makes no mention of fishcmds which is needed to use funcsave and funced.

Awesome project! Thanks for your time.

completion not working correctly, returning unknown filename

See below video. Tabbing to complete the filename "alias.cmd" somehow returns "alias.D" instead. The only plugin installed in antidote is mattmc3/zephyr path:plugins/completion. Happens in both current antidote versions from mattmc3 and getantidote.

https://github.com/mattmc3/zephyr @ c6c001d
antidote version 1.9.5 (90deef1) & antidote version 1.9.1 (0e21ff3)
zsh version: zsh 5.9 (x86_64-pc-msys)
OS: Microsoft Windows 10 Pro 10.0.19045
Terminal: Windows Terminal Preview 1.20.10572.0

.zshrc
# Zsh options
setopt extended_glob

# clone antidote if necessary
[[ -d ${ZDOTDIR:-~}/.antidote ]] || git clone https://github.com/mattmc3/antidote ${ZDOTDIR:-~}/.antidote # https://github.com/getantidote/antidote is stable
# change antidote home directory - default on windows is %LocalAppData%/antidote
export ANTIDOTE_HOME=${ZDOTDIR:-~}/.antidote_home

# set the name of the static .zsh plugins file antidote will generate
zsh_plugins=${ZDOTDIR:-~}/.antidote.zsh_plugins.zsh
# ensure you have a $zsh_plugins_list file where you can add plugins
zsh_plugins_list=${zsh_plugins:r}_list.zsh
[[ -f ${zsh_plugins_list} ]] || touch ${zsh_plugins_list}
# source zstyles you might use with antidote
[[ -e ${ZDOTDIR:-~}/.antidote.zstyles.zsh ]] && source ${ZDOTDIR:-~}/.antidote.zstyles.zsh
# lazy-load antidote
fpath+=(${ZDOTDIR:-~}/.antidote)
autoload -Uz $fpath[-1]/antidote
# generate static file in a subshell when $zsh_plugins_list is updated
alias al="antidote bundle <${zsh_plugins_list} >|$zsh_plugins"
if [[ ! $zsh_plugins -nt ${zsh_plugins_list} ]]; then
  (al)
fi
# source your static plugins file
source $zsh_plugins

PS1='%~ %% '
.zsh_plugins.txt.zsh
mattmc3/zephyr path:plugins/completion
.zstyles
# friendly plugin directories - no 'https-COLON--SLASH--SLASH-github.com-SLASH-'
zstyle ':antidote:bundle' use-friendly-names 'yes'
# change default zsh_plugins.txt name
zstyle ':antidote:bundle' file ${zsh_plugins:r}.txt.zsh
complete_error.mp4

Disable vim select mode on opt/alt + left/right

Hi there 👋🏻

Great project. Loving using it so far.

Just wondering if there is a simple way to disable the terminal from shifting into a vim-style select mode when I option+arrow to jump around the current text in the command.

Keymaps question, history undefined behavior?

Hey there! I'm enjoying antidote. This repo has made adoption much less painful coming from OMZ.

I have two questions I wonder if you could answer,

  1. I noticed that like omz, ctrl+p brings up the last command executed, ctrl+o doesn't seem to do anything though, where in omz it runs the command. I think this behavior is from emacs, but I'm not sure. Would I just tack this onto my zshrc as a keybinding or is there a better place to put that?

  2. Because you look for XDG_DATA_HOME in the history plugin, on mac this creates a history file for each directory you navigate to in the shell, since this is not exported by default. I can't imagine that's intentional. Is there any benefit to the history plugin when mac generates .zsh_sessions?

functions/man: Mixing `env` and `command` doesn't work

Man command doesn't work presently:

env: ‘command’: No such file or directory

The reason is commit df3bf52, which does env ... command man. But command is a shell built-in, and env can't use it. Better to use /usr/bin/man which should be the right path everywhere, I guess.

`plugins/environment` breaking `code (VS Code CLI)

macOS 12.3 Terminal.app, using default supplied ZSH.

~/.zshrc:

source ~/.zsh_plugins.zsh

~/.zsh_plugins.txt:

mattmc3/zephyr path:plugins/environment

Antidote installed with brew install antidote

After running:

source /opt/homebrew/opt/antidote/share/antidote/antidote.zsh
antidote bundle <~/.zsh_plugins.txt >~/.zsh_plugins.zsh

... ~/.zsh_plugins.zsh contains:

fpath+=( /Users/foo/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-zephyr/plugins/environment )
source /Users/foo/Library/Caches/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-zephyr/plugins/environment/environment.plugin.zsh

In a new Terminal session, attempting to use code to open a file, e.g. code ~/.zshrc launches a new instance of VS Code (instead of reusing the existing one, as it typically would), which shows the following error:

Unable to write program user data.

A system error occurred (listen EACCES: permission denied /.xdg/vscode-352c82aa-1.72.2-main.sock)

Please make sure the following directories are writeable:

~/Library/Application Support/Code
~/.vscode/extensions
~/.xdg

https://github.com/mattmc3/zephyr/blob/11a376d/plugins/environment/environment.plugin.zsh sets XDG_RUNTIME_DIR, which is used by VS Code. The VS Code usage that appears in the error seems to be coming from here: https://github.com/microsoft/vscode/blob/3e40752/src/vs/base/parts/ipc/node/ipc.net.ts#L751-L773

Hmm, this looks like something that should be fixed in VS Code... 🤔

How to change cursor style

Hey there 👋🏻

Just wondering how I can configure the cursor style. It seems that this plugin sets it to a block style which overrides the emulator's style. Is there a way to configure it back to a line instead of a block?

Thanks for this great plugin and everything around it.

[color] command not found: is-macos

On startup of a new shell, I get an error saying that zsh can't find the is-macos command in the color plugin. However, when I try to run is-macos in the prompt, it does work as expected.

/home/justin/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-zephyr/plugins/color/color.plugin.zsh:61: command not found: is-macos

~/.config/zsh
❯ is-macos

❯

zsh 5.9
antidote 1.9.6

"No such keymap `menuselect" error

Just switched to antidote from zplug and thought I'd try out zephyr along with it. I have all the plugins except for the MacOS ones in my .zsh_plugins.txt file. When I source my .zshrc, I get this error: /home/justin/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-zephyr/plugins/editor/editor.plugin.zsh:bindkey:42: no such keymap `menuselect'. I've attached some snippets from my .zshrc below, but I'm not exactly sure what's causing this.

  • Arch Linux (kernel 6.7.3-arch1-1)
  • zsh 5.9
  • antidote v 1.9.4

.zshrc

source '/usr/share/zsh-antidote/antidote.zsh'
antidote load

.zsh_plugins.txt

zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-completions

mattmc3/zephyr path:plugins/color
mattmc3/zephyr path:plugins/completion
mattmc3/zephyr path:plugins/confd
mattmc3/zephyr path:plugins/directory
mattmc3/zephyr path:plugins/editor
mattmc3/zephyr path:plugins/environment
mattmc3/zephyr path:plugins/history
mattmc3/zephyr path:plugins/prompt
mattmc3/zephyr path:plugins/utility
mattmc3/zephyr path:plugins/zfunctions

bootstrap.zsh seems to override variables

It's quite possibly user error, but if so, I can't figure out what I'm doing wrong.

I have the following:

# .zprofile
...
export __zsh_config_dir=${ZDOTDIR:-$HOME}/.dotfiles/zsh

# .zsh_plugins.txt
...
mattmc3/zephyr path:plugins/confd

When I open a new terminal, __zsh_config_dir is updated to /Users/jason/.config/zsh
If I comment out the plugin, and reopen the terminal, __zsh_config_dir remains unchanged.

It seems like it's happening here
My goal is to get the confd plugin to look for configs in a different folder.

Editor plugin emacs-pound-insert issue

Right now, when the editor plugin is loaded, the following error message shows:

zsh-syntax-highlighting: unhandled ZLE widget 'emacs-pound-insert'
zsh-syntax-highlighting: (This is sometimes caused by doing bindkey <keys> emacs-pound-insert without creating the 'emacs-pound-insert' widget with zle -N or zle -C.)

I think this is caused by commit acdc0455164940b84693fd95703454a8d6dfeafb changing the name of the function pound-toggle to emacs-pound-insert without changing the line (102) zle -N pound-toggle in zephyr/blob/main/plugins/editor/editor.plugin.zsh to zle -N emacs-pound-insert. I have confirmed that doing so solves the issue.

How to properly init completions?

Hi.

big fan of antidote here so I wanted to give your completions a try too. I have a few questions here

  1. If I use mattmc3/zephyr path:plugins/completion, do I still need to call, the following?
autoload -Uz compinit
compinit

I'm asking this because antidote autocompletion docs suggest: "run autoload+compinit manually or use plugin". I understood it as, if I use plugin, I don't need to run compinit myself anymore. Would that be correct? nb: if I don't run compinit in my zshrc, some autocompletion won't work (like the ones from /usr/local/share/zsh/site-functions).

  1. If I use mattmc3/zephyr path:plugins/completion, I don't (shouldn't) have to use zsh-users/zsh-completions, right?
  2. If I comment out zsh-users/zsh-completions, I get odd errors like (eval):1: _nano: function definition file not found (I've deleted ~/.zcompdump just in case) -- do you an idea why could that be?

How to setup p10k as a prompt and have the instaprompt?

Hi, first of all, thank you so much for an amazing project. I'm learning a lot of stuff with your repositories :)

I'm wondering what is the best way to use Zephyr to setup the p10k prompt with instaprompt as I don't use starship.

I was trying to follow the way on how you do it in your ZDOTDIR repo but I'm a little confused.

Some things I would like to do is:

  • Have different themes for my prompt like "lean" and "pure"
  • Use instaprompt (I don't get this part)
  • Be able to change it with the "prompt p10k pure/lean"

Thank you!

Completion files from local paths are not picked up

Local completion files are not loaded after compinit. I tried to load completion for poetry by putting it in a completion directory but that did not work.

The steps to reproduce below walk through poetry completion but I think it should work for any local ZSH completion script.

System information

zsh --version # zsh 5.9 (x86_64-pc-linux-gnu)
antidote --version # antidote version 1.9.6 (3a30f36)
uname -a # Linux archlinux 6.7.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 08 Mar 2024 01:59:01 +0000 x86_64 GNU/Linux

Steps to reproduce

  1. Create following files in any directory (later referred as <path-to-zshrc-dir>).
.zshrc
# Where to put antidote files?
ANTIDOTE_HOME=$ZDOTDIR/plugins/.external

# Get antidote if not already present
[[ -e $ZDOTDIR/.antidote ]] ||
  git clone --depth=1 https://github.com/mattmc3/antidote.git $ZDOTDIR/.antidote

# Set the name of the static .zsh plugins file antidote will generate.
ZSH_PLUGINS_FILE=${ZDOTDIR:-~}/.zplugins.zsh

# Ensure you have a .zplugins.txt file where you can add plugins.
[[ -f ${ZSH_PLUGINS_FILE:r}.txt ]] || touch ${ZSH_PLUGINS_FILE:r}.txt

# Lazy-load antidote.
fpath+=(${ZDOTDIR:-~}/.antidote/functions)
autoload -Uz $fpath[-1]/antidote

# Install all plugins there are if not already done
[[ -e $ZDOTDIR/plugins/.external ]] || antidote load $ZDOTDIR/.zplugins.txt

# Generate static file in a subshell when .zsh_plugins.txt is updated.
if [[ ! $ZSH_PLUGINS_FILE -nt ${ZSH_PLUGINS_FILE:r}.txt ]] || [[ ! -s $ZSH_PLUGINS_FILE ]]; then
  source $ZDOTDIR/.antidote/antidote.zsh
  (envsubst < ${ZSH_PLUGINS_FILE:r}.txt | antidote bundle >| $ZSH_PLUGINS_FILE)
fi

# Source your static plugins file.
source $ZSH_PLUGINS_FILE

# vim: ft=zsh sw=2 ts=2 et
.zplugins.txt
$ZDOTDIR/completions kind:fpath

# belak/zsh-utils path:completion
mattmc3/zephyr path:plugins/completion

# vim: ft=zsh sw=2 ts=2 et
  1. Install poetry and install it's completion script to <path-to-zshrc-dir>/completions/_poetry using poetry completions zsh > <path-to-zshrc-dir>/completions/_poetry. (docs). This can be replaced with any completion, but this is the one I am trying to get to work.
  2. Run ZDOTDIR=<path-to-zshrc-dir> zsh.
  3. In the launched shell, running poetry <TAB> should show completions but it does not.

What works?

  • If you run compinit after step 3, and then do poetry <TAB>, you get completions.
  • Or, if you replace zephyr completions with zsh-utils' completion plugin, it works.

Thanks for your amazing work on this and for sharing your dotfiles. They helped me a lot to get my zsh in order ❤️

Is it valid to load a part of Zephyr?

Hello:-)

I recently tried using Antidote and Zephyr referencing your dotfile. And there are two points that confused me.

First, is it valid to load only a certain part of Zephyr? For example, I just need zephyr path:plugins/autosuggestions.
Since the directory functions is not in fpath, will the following line be invalid?

source $ZEPHYR_HOME/.external/zsh-autosuggestions/zsh-autosuggestions.zsh

Another thing, when I used the plugin fancy-ctrl-z, I found that its bindkey did not work. I tried to search
bindkey by $ bindkey | grep fancy, but no results. Here is the related information:

# zsh --version
# zsh 5.9 (x86_64-apple-darwin20.6.0)

# .zsh_plugins.txt
ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z

# .zsh_plugins.zsh
fpath+=( /Users/me/.cache/antidote/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z )
source /Users/me/.cache/antidote/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh

BTW, If I source fancy-ctrl-z.plugin.zsh manually, it works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.