![如何将彩色手册页插件添加到我的 zsh 配置文件中(使用 oh-my-zsh)?](https://linux22.com/image/103324/%E5%A6%82%E4%BD%95%E5%B0%86%E5%BD%A9%E8%89%B2%E6%89%8B%E5%86%8C%E9%A1%B5%E6%8F%92%E4%BB%B6%E6%B7%BB%E5%8A%A0%E5%88%B0%E6%88%91%E7%9A%84%20zsh%20%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E4%B8%AD%EF%BC%88%E4%BD%BF%E7%94%A8%20oh-my-zsh%EF%BC%89%EF%BC%9F.png)
我正在使用 oh-my-zsh,在 oh-my-zsh 的列表中有一个名为 colord-manpages 的插件 -
┌─[shirish@debian] - [~/.oh-my-zsh/plugins] - [10199]
└─[$] ll | grep colored
drwxr-xr-x 2 shirish shirish 4096 2015-12-30 14:27 colored-man-pages
这是 .zshrc 的输出 -
─[$] grep -Ev '#' .zshrc
export ZSH=/home/shirish/.oh-my-zsh
ZSH_THEME="duellj"
plugins=(last-working-dir)
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/lib:/usr/local/include/SDL2"
source $ZSH/oh-my-zsh.sh
这是 ~/.oh-my-zsh/oh-my-zsh.sh 脚本的输出 -
[$] grep -v '#' oh-my-zsh.sh
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
fi
fpath=($ZSH/functions $ZSH/completions $fpath)
autoload -U compaudit compinit
: ${ZSH_DISABLE_COMPFIX:=true}
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
for config_file ($ZSH/lib/*.zsh); do
custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
[ -f "${custom_config_file}" ] && config_file=${custom_config_file}
source $config_file
done
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
}
for plugin ($plugins); do
if is_plugin $ZSH_CUSTOM $plugin; then
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
elif is_plugin $ZSH $plugin; then
fpath=($ZSH/plugins/$plugin $fpath)
fi
done
if [[ "$OSTYPE" = darwin* ]]; then
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
else
SHORT_HOST=${HOST/.*/}
fi
if [ -z "$ZSH_COMPDUMP" ]; then
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
if ! compaudit &>/dev/null; then
handle_completion_insecurities
else
compinit -d "${ZSH_COMPDUMP}"
fi
else
compinit -i -d "${ZSH_COMPDUMP}"
fi
for plugin ($plugins); do
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
fi
done
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
source $config_file
done
unset config_file
if [ "$ZSH_THEME" = "random" ]; then
themes=($ZSH/themes/*zsh-theme)
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
else
if [ ! "$ZSH_THEME" = "" ]; then
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
else
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
fi
fi
fi
任何人都可以告诉/分享我应该做什么,以便彩色手册页在我使用 zsh 作为我的 xterm 时起作用吗?
我尝试谷歌搜索但找不到任何东西:(
答案1
只需将插件添加到以下plugins
定义中即可.zshrc
:
plugins=(last-working-dir colored-man-pages)
然后启动一个新的 shell,您将看到插件已激活。