64 lines
1.8 KiB
Bash
64 lines
1.8 KiB
Bash
#!/bin/zsh
|
|
|
|
# path -> settings -> alias -> functions -> plugins -> prompt
|
|
|
|
if [ -n "${ZSH_VERSION}" ]; then
|
|
_source="${(%):-%x}"
|
|
_path=$(dirname "$(realpath "$_source")")
|
|
unset _source
|
|
else
|
|
echo "Unsupported shell"
|
|
exit 1
|
|
fi
|
|
|
|
# Set basic path to zsh-polyjuice installation
|
|
export ZSH_POLYJUICE_PATH="$_path"
|
|
unset _path
|
|
export ZSH_PLUGINS_PATH="$ZSH_POLYJUICE_PATH/plugins"
|
|
export ZSH_ALIAS_PATH="$ZSH_POLYJUICE_PATH/alias"
|
|
export ZSH_SETTINGS_PATH="$ZSH_POLYJUICE_PATH/settings"
|
|
export ZSH_FUNCTIONS_PATH="$ZSH_POLYJUICE_PATH/functions"
|
|
export STARSHIP_CONFIG_FILE="$ZSH_POLYJUICE_PATH/../starship/starship.toml"
|
|
|
|
# Load basic settings `zsh/settings`
|
|
for _file in "$ZSH_SETTINGS_PATH"/*.sh; do
|
|
source "$_file"
|
|
done
|
|
unset _file
|
|
|
|
# Load Aliases `zsh/alias`
|
|
for _file in "$ZSH_ALIAS_PATH"/*.sh; do
|
|
source "$_file"
|
|
done
|
|
unset _file
|
|
|
|
# Load self-defined functions
|
|
for _file in "$ZSH_FUNCTIONS_PATH"/*.sh; do
|
|
source "$_file"
|
|
done
|
|
unset _file
|
|
|
|
# Load Plugins
|
|
source $ZSH_PLUGINS_PATH/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
|
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
|
bindkey '^[l' autosuggest-accept # alt-L to accept autosuggestion
|
|
source $ZSH_PLUGINS_PATH/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
|
source $ZSH_PLUGINS_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
source $ZSH_PLUGINS_PATH/fzf-tab/fzf-tab.plugin.zsh
|
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/fzf/fzf.plugin.zsh
|
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/zoxide/zoxide.plugin.zsh
|
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/python/python.plugin.zsh
|
|
|
|
|
|
function cdi() {
|
|
cd $(find . -type d | fzf)
|
|
}
|
|
|
|
# using starship as prompt
|
|
if (( $+commands[starship] )); then
|
|
eval "$(starship init zsh)"
|
|
else
|
|
echo '[starship] not found, please install it.'
|
|
fi
|