Can you disable some plugsin without removing them? #194
-
I guess this is probably an edge-usecase (I know for certain it is for me...) but is there a way to only enable some plugins you have listed in zsh_plugins.txt or do I have to comment them out? I'm thinking this is mainly for like prompt themes. So assume, I have powerlevel10k, omz/robbyrussel or a zsh-prompt that I've created myself in my Is this achievable without removing the prompt-themes I installed with antidote? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am probably the worst kind of person with RTFM. Apparently when it comes to prompt themes, that is why we use But I guess, this question still stands for other plugins and libraries out of people's curiosity |
Beta Was this translation helpful? Give feedback.
-
This isn't an edge case at all! It's a great question and I'm sure a lot of people would benefit from a bit more explanation of how the Zsh prompt system works, and how to use antidote with it. First off:
The answer for most plugins is, yes - the way to disable them in antidote is to comment them out in .zsh_plugins.txt.
Prompt themes are different! If you are using the built-in Zsh prompt system, you actually shouldn't be disabling those extra prompt plugins. You just need to not source them. That means you need to use antidote's Here's an example .zsh_plugins.txt: # ${ZDOTDIR:-$HOME}/.zsh_plugins.txt
### Prompt themes
# Per the Zsh docs, all prompt functions need to be in your 'fpath' prior to calling 'promptinit'.
# You can use popular Zsh prompt plugins by loading them with 'kind:fpath'. Assuming
# they are properly built to properly support the Zsh prompt system, this will make them
# available to the 'prompt' command.
sindresorhus/pure kind:fpath
romkatv/powerlevel10k kind:fpath
miekg/lean kind:fpath
# To use your own custom prompts, you can also have antidote add a directory
# (eg: $ZDOTDIR/themes) to your fpath and put your own prompt functions in it
# For example, if you like the Starship prompt, drop a function file in called
# '$ZDOTDIR/themes/prompt_starship_setup' with the following contents:
#
# (( $# )) && export STARSHIP_CONFIG="$1"
# source <(starship init zsh)
#
# Now you can load the Starship prompt by putting this in your .zshrc:
#
# autoload -Uz promptinit && prompt starship /path/to/my/starship.toml`
#
$ZDOTDIR/themes kind:fpath Then in your .zshrc: # .zshrc
setopt prompt_subst
autoload -Uz promptinit && promptinit
prompt starship Alternatively, if you source a prompt plugin ( It's also important to note that Oh-My-Zsh themes were NOT built to properly support the Zsh prompt system. (That's one of many reasons I don't really prefer Oh-My-Zsh). In order to support the Zsh prompt system, OMZ themes would have to have proper functions (eg: # contents of ${ZDOTDIR:-$HOME}/themes/prompt_omz_setup
# Be sure OMZ's requirements are set up. To do that, I recommend using the
# 'getantidote/use-omz' plugin to lazy-load whatever you need from OMZ!
# If you don't, you will need to load all the OMZ prerequisites yourself.
# Uncomment the following lines (though really, use getantidote/use-omz - it's great):
# ZSH="$(antidote path ohmyzsh/ohmyzsh)"
# source $ZSH/lib/*.zsh
# Now, load whatever OMZ theme you want.
[[ -n "$ZSH_THEME" ]] || ZSH_THEME="${1:-robbyrussell}"
source $ZSH/themes/${ZSH_THEME}.zsh-theme Now, in your .zshrc you can load any OMZ theme with the Zsh prompt system like so: # .zshrc
setopt prompt_subst
autoload -Uz promptinit && promptinit
prompt omz robbyrussell I know this was a lot - probably more than you needed - but hopefully helpful. Let me know if you have any other questions. |
Beta Was this translation helpful? Give feedback.
This isn't an edge case at all! It's a great question and I'm sure a lot of people would benefit from a bit more explanation of how the Zsh prompt system works, and how to use antidote with it.
First off:
The answer for most plugins is, yes - the way to disable them in antidote is to comment them out in .zsh_plugins.txt.
Prompt themes are different! If you are using the built-in Zsh prompt system, you actually shouldn't be disabling those extra prompt plugins. You just need to not source them. That means you need to use anti…