22

我刚刚发现了 oh-my-zsh,但我无法让它工作。虽然主题工作得很好,但插件却不行。我选择了一些插件,例如。macports,但我既没有完成端口命令,也没有适当的别名工作。这是我的 .zshrc:



    # Path to your oh-my-zsh configuration.
    export ZSH=$HOME/.oh-my-zsh

    # Set name of the theme to load.
    # Look in ~/.oh-my-zsh/themes/
    # Optionally, if you set this to "random", it'll load a random theme each
    # time that oh-my-zsh is loaded.
    export ZSH_THEME="steeef"

    # Set to this to use case-sensitive completion
    # export CASE_SENSITIVE="true"

    # Comment this out to disable weekly auto-update checks
    # export DISABLE_AUTO_UPDATE="true"

    # Uncomment following line if you want to disable colors in ls
    # export DISABLE_LS_COLORS="true"

    # Uncomment following line if you want to disable autosetting terminal title.
    # export DISABLE_AUTO_TITLE="true"

    # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
    # Example format: plugins=(rails git textmate ruby lighthouse)
    plugins=(git osx github macports textmate svn)

    source $ZSH/oh-my-zsh.sh

    # Customize to your needs...
    export     PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin

textmate 和 osx 插件似乎也不起作用 - zsh 只是抱怨未知命令并停止。git 和 svn 有一些基本的完成,但我不确定它是由插件完成还是只是一个普通的 zsh 完成。我必须导出一些东西才能使用这些插件吗?或者如果没有,该怎么做才能解决这个问题?

4

8 回答 8

45

确保在初始化 zsh 之前定义了 plugins 变量:

plugins=(git wd)
export ZSH=/home/<user>/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
于 2016-03-11T00:06:03.983 回答
13

我被这个咬了。

发生的事情是您进行了手动安装,而手动安装的说明没有提到您需要PATH自己设置。

所以你最终得到了默认的 PATH。自动设置代码的源代码会复制您当前的路径并将其附加到 . .zshrc,如果您依赖非标准PATH条目(例如,您在 Mac 上运行 Homebrew),这还不够。

所以修复很简单:

启动旧 shell 及其配置文件,然后将 的值复制并粘贴$PATH到文件顶部~/.zshrc

再见!

于 2011-11-22T08:57:50.547 回答
4

我刚才也有同样的问题!grml-zsh-config在我的 Archlinux 中有一个名为 installed 的软件包。我删除了这个包,oh-my-zsh主题开始工作。

于 2014-01-14T22:00:02.150 回答
1

就我而言,在 ~/.zshrc 我有重复的 plugins 变量

plugins=(git)
.
.
.
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)

检查您是否属于这种情况,因为这样只会使用您的 git 插件。

删除第一个插件变量,它应该可以工作。

于 2021-07-25T09:10:42.903 回答
0

If your .zshrc has this at the top

export ZSH="~/.oh-my-zsh"

try to changing it to:

export ZSH="$HOME/.oh-my-zsh"
于 2022-02-24T17:16:53.083 回答
0

就我而言,我忘记将自定义插件名称添加到 .zshrc 文件中:

plugins=(customPluginName)

并重新加载 .zshrc:

source ~/.zshrc
于 2020-02-24T10:40:02.803 回答
0

确保插件的文件夹位于 ~/.oh-my-zsh/custom/plugins 文件夹中。当您 git clone 插件时,我会建议您在此目录中。
其次,确保在 ~/.zshrc 文件中使用单个空格而不是逗号分隔插件列表。

.
.
.
plugin = (git zsh-syntax-highlighting)

.
.
.

所以在上面的例子中,这里添加了两个插件:git 和 zsh-syntax-highlighting。

于 2022-01-27T03:50:28.457 回答
0

我用kubectl插件遇到了这个问题。

查看内容后,~/.oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh我意识到我的内容与 github repo 上的内容不同。使用oh-my-zsh repo中的内容手动更新文件有帮助,插件开始工作。猜猜我必须更新我的 oh-my-zsh 安装以获得最新的插件内容,但这对我有用。

于 2019-08-28T16:07:14.817 回答