Skip to content
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

Make pure.zsh loadable by the prompt system. #14

Closed
wants to merge 7 commits into from
Closed

Make pure.zsh loadable by the prompt system. #14

wants to merge 7 commits into from

Conversation

pbrisbin
Copy link
Contributor

With the code structured like this, pure can be loaded like any other
zsh prompt.

Installation becomes:

  • Place pure.zsh in $fpath as prompt_pure_setup

Usage becomes:

autoload -U promptinit
promptinit

prompt pure

It can be listed and previewed too.

I also included an Arch PKGBUILD which installs the prompt. Feel free to
cherry-pick around that if you don't want it -- I can maintain it
separately.

Thanks

* Now loadable via the prompt system
* Used (( )) for numeric comparisons
@sindresorhus
Copy link
Owner

How did I not know about promptinit. Very nice :)

Place pure.zsh in $fpath as prompt_pure_setup

Can you add an example of this to the install instructions?

Usage becomes:

autoload -U promptinit
promptinit

prompt pure

It can be listed and previewed too.

Docs too ;)

I also included an Arch PKGBUILD which installs the prompt. Feel free to
cherry-pick around that if you don't want it -- I can maintain it
separately.

I'm fine with that if it makes it's easier to use. I've been wanting to support more package managers.

@@ -0,0 1,16 @@
# Author: Sindre Sorhus
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above:

# Arch package file

or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that's needed. The fact that it's named PKGBUILD is pretty intention-revealing.

What if I moved it to arch/PKGBUILD? This would lead naturally to brew/recipe.rb, debian/whatever-they-do, etc.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that it's named PKGBUILD is pretty intention-revealing.

Only to Arch users.

What if I moved it to arch/PKGBUILD?

Yes

@sindresorhus
Copy link
Owner

Side question: Do you know why many prompts include

setopt LOCAL_OPTIONS
  unsetopt XTRACE KSH_ARRAYS

in their functions?

@pbrisbin
Copy link
Contributor Author

I'm not familiar with why these options are needed in prompts. The docs are here if you're interested in some cryptic reading.

install -Dm644 pure.zsh \
"$pkgdir/usr/share/zsh/functions/Prompts/prompt_pure_setup"
}
md5sums=('673c5d65495ba6942938925ab4cff2d8')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use single quotes on everything for consistency

@sindresorhus
Copy link
Owner

Awesome, should be good to merge when the readme is updated.

For example:

```
$ sudo cp ./pure.zsh /usr/share/zsh/functions/Prompts/prompt_pure_setup
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should just rename it so people don't have to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's another change in my more modified fork. I didn't include that here b/c it would've made the PR one all-red file and one all-green file and I figured you'd want to see an actual diff instead. In retrospect, it might've been the wrong choice.

Up to you if you want to rename pre or post merging this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, i don't like how it doesn't allow you to have an extension.

@sindresorhus
Copy link
Owner

Landed. Thanks so much for these awesome changes. Do let me know if there is anything else that could be improved ;)

🍰

@pbrisbin
Copy link
Contributor Author

Awesome! Thank you for the quick feedback and incorporation. I'll continue to use the prompt and definitely PR any improvements I can make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants