forked from misc/zsh-config
ZSH Autosuggestions plugin.
This commit is contained in:
parent
4218c6b8b6
commit
858db76ad6
@ -4,6 +4,15 @@
|
||||
OS=`uname`
|
||||
OS_RELEASE=`uname -r`
|
||||
|
||||
# Distro detection.
|
||||
LSBRELEASE=$(which lsb_release)
|
||||
if [ $? -eq 0 ]; then
|
||||
DISTRO=`lsb_release -i -s`
|
||||
else
|
||||
# BSDs OS and macOS can be detected via uname.
|
||||
DISTRO=${OS}
|
||||
fi
|
||||
|
||||
# Variable forcers.
|
||||
|
||||
# If DEBUG isn't defined - force it to be 0.
|
13
zsh/05-plugins.zsh
Normal file
13
zsh/05-plugins.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
# Load enabled plugins.
|
||||
for plugin in "${ENABLED_PLUGINS[@]}"; do
|
||||
if [ ! -f "${CONFIG_PATH}/zsh/plugins/${plugin}.plugin.zsh" ]; then
|
||||
error 0 "Plugin '${plugin}' doesn't exist"
|
||||
else
|
||||
source "${CONFIG_PATH}/zsh/plugins/${plugin}.plugin.zsh"
|
||||
# chpwd injecting.
|
||||
chpwd_injector=`declare -f ${plugin}_chpwd`
|
||||
if [ $chpwd_injector ]; then
|
||||
${plugin}_chpwd
|
||||
fi
|
||||
fi
|
||||
done
|
2
zsh/defaults/03-plugins.conf
Normal file
2
zsh/defaults/03-plugins.conf
Normal file
@ -0,0 +1,2 @@
|
||||
# List of plugins to enable.
|
||||
ENABLED_PLUGINS=("autosuggestions")
|
@ -1,2 +1,2 @@
|
||||
# This is default PATHs.
|
||||
export PATH="/bin:/usr/lib:/usr/lib/colorgcc/bin:/usr/sbin:/sbin:$PATH"
|
||||
export PATH="/usr/lib/colorgcc/bin:/usr/sbin:/sbin:$PATH"
|
||||
|
13
zsh/plugins/autosuggestions.plugin.zsh
Normal file
13
zsh/plugins/autosuggestions.plugin.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
AUTOSUGGESTIONS_PATH=""
|
||||
|
||||
if [ "${DISTRO}" = "Arch" ]; then AUTOSUGGESTIONS_PATH="/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"; fi
|
||||
if [ "${DISTRO}" = "Debian" ]; then AUTOSUGGESTIONS_PATH="/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh"; fi
|
||||
if [ "${DISTRO}" = "Darwin" ]; then AUTOSUGGESTIONS_PATH="/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh"; fi
|
||||
if [ "${DISTRO}" = "VoidLinux" ]; then AUTOSUGGESTIONS_PATH="/usr/share/zsh/plugins/zsh-autosuggestions.zsh"; fi
|
||||
|
||||
if [ -f "${AUTOSUGGESTIONS_PATH}" ]; then
|
||||
source "${AUTOSUGGESTIONS_PATH}"
|
||||
export PLUGIN_ZSH_AUTOSUGGESTIONS_LOADED=1
|
||||
else
|
||||
echo "Autosuggestions plugin enabled but not installed. Please install zsh-autosuggestions as per https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user