Usage with Antibody
johnletey opened this issue · comments
Is your feature request related to a problem? Please describe.
I have a list of all my Zsh plugins (including typewritten
):
# ~/.dotfiles/zsh/plugins.txt
zsh-users/zsh-autosuggestions branch:develop
zsh-users/zsh-syntax-highlighting
#mafredri/zsh-async
#sindresorhus/pure
reobin/typewritten
In my Zsh config, I have the following:
# ~/.zshrc
source <(antibody init)
antibody bundle < ~/.dotfiles/zsh/plugins.txt
source ~/.dotfiles/zsh/env.zsh
source ~/.dotfiles/zsh/alias.zsh
However, I get the following (an unstyled prompt):
Describe the solution you'd like
I would like to be able to use typewritten
with Antibody.
Describe alternatives you've considered
I guess I could switch my entire setup over to oh-my-zsh, but I don't want to do that just for a prompt theme.
Additional context
N/A
Hi @jletey !
Thank you for the suggestion.
I have not heard of antibody but making typewritten standalone (no zsh or oh-my-zsh) is something I have had in mind for a while.
From what I understand, your request would remove oh-my-zsh as a dependency, and it is a step in the right direction for me.
Could you link to some themes that do support antibody?
Hey @jletey !
So I researched a little with my limited time, and this will have to be a pretty big change. Any help on this would be appreciated. 😅
Essentially, we need to turn this into an independent zsh bundle which could be consumed by any zsh package manager like Antibody, or Antigen.
Spaceship and Pure are good examples we could follow.
If you have a little time, you could help me identify the steps we need to take to make this a zsh bundle independent of oh-my-zsh.
Cheers!
@reobin More than happy to take a look at this! I'll let you know what I find :)
So I created a branch called feat/zsh-bundle, where I created a file typewritten.zsh
which is still WIP (missing features), but works without oh-my-zsh.
Only thing missing for this new file to work with a package manager is the typewritten.plugin.zsh
file which is also a symlink to the theme. Shouldn't be a problem whatsoever.
I added the manual instructions for now to install the oh-my-zsh
less theme. I think we can start building on that to add the features missing. I don't have more time for today to work on it but this is what is missing:
- colors
- git status indicator
- maybe export each feature in its own file to keep the main file cleaner
Tell me if what you find makes sense with what I've done so far. And maybe help me run some tests with antibody, as I don't use it 😅 (after adding the typewritten.plugin.zsh
symlink file)
Later!
So I couldn't help myself, and kept working 😅 It wasn't that much work actually!
Got to implement all the features old typewritten had. And now it doesn't need oh-my-zsh, which is great.
As I said, I added the instructions on how to manually install the theme.. I'd like to have another opinion on this, and a check if it actually works.
Also, I'll need some help writing the instructions on how to install it with a package manager, if it works. If it doesn't, we can identify what is wrong.
I'd like to have another opinion on this, and a check if it actually works.
@reobin Thx so much for working on this 🙏
The only thing that is missing is the directory 🤔
Other than that it works amazing 😍
If it doesn't, we can identify what is wrong.
@reobin When using the latest code with Antibody, it unfortunately doesn't work :/
# ~/.dotfiles/zsh/plugins.txt
zsh-users/zsh-autosuggestions branch:develop
zsh-users/zsh-syntax-highlighting
#mafredri/zsh-async
#sindresorhus/pure
reobin/typewritten branch:feat/zsh-bundle
I don't rlly know what's the problem, it seems like it loads? Because the cursor is changed 🤔
Now that I think of it the cursor has always been changed 🤔
Hmm, I'll take a look as the current directory display works fine on my end.
About antibody, did you create the symlink file called typewritten.plugin.zsh
?
Hmm, I'll take a look as the current directory display works fine on my end.
Alright, thx again for working on this :)
About antibody, did you create the symlink file called
typewritten.plugin.zsh
?
I'll try that, IMO, I think it's worthwhile to push the symlink to the branch.
Current directory part was a dumb mistake 😅 You can pull and it should work.
I now also pushed the symlink plugin file, tell me how that works for you. I'll do some tests too.
Maybe I end up liking antibody.
Got it to work with these lines in my .zshrc
:
source <(antibody init)
antibody bundle reobin/typewritten branch:feat/zsh-bundle
Struggled a little bit at first because I has pulled the master branch, and just specifying another branch later didn't update the local repo pulled by antibody.
and just specifying another branch later didn't update the local repo pulled by antibody.
Haha yep just realised that 😅 I now have it working with Antibody 🎉 I can help submit a PR to add instructions on how to install.
Also, seems as tho there is a hick-up with git rn:
When I'm in the ~/Desktop/release
dir, the git status shows fine. However when I'm inside ~/Desktop/release/app
, it errors, even tho I'm still in the same git repo.
So one of the way the prompt checks for a git repository is to check if the .git
repository exists.
I will remove this check and just keep the git rev-parse
command.
Could you pull and test again?
Wow ahah
Are you sure everything is up to date? No check should be done for the .git
directory.
The code for the typewritten_is_git_repository
function looks like this:
typewritten_is_git_repository() {
if $(command git rev-parse --git-dir 2> /dev/null); then
echo true
else
echo false
fi
}
That is weird. Could you try on another repo?
or run this: command git rev-parse --git-dir 2> /dev/null
in your repo and see what pops up?
Basically, command git rev-parse --git-dir 2> /dev/null
returns the path of the .git
directory if you are in a git repo, and returns nothing if not.
I updated the condition, maybe it runs better now.
Run antibody update
. If not, I am puzzled as it works perfectly on my side 🤔
maybe it runs better now.
Wuhuu!!! It works!!! 🎉 Thx for debugging this!
Run
antibody update
.
Ah I feel stupid 😅 Thx for the tip
Good news!
Next steps:
I'll update the readme, so it's more readable.
When you got a little bit of spacetime, could you come up with the docs on how to install it with various package managers?
I'm thinking of antigen and antibody, but maybe more if it actually works.
I think common ways to install a prompt theme are:
- prezto
- zim
- antigen
- antibody
- zgen
- zplug
You could try a couple, write the docs, and make a PR with the target branch to be feat/zsh-bundle
.
When we merge, you would show up as a contributor.
I'll help with some package managers, but I want you to show up in the contributor list! 🎉
could you come up with the docs on how to install it with various package managers?
I'd be more than happy too!
but I want you to show up in the contributor list! 🎉
🤗