关于zshrc:oh-my-zsh插件不起作用

oh-my-zsh plugins not working

我刚刚发现了oh-my-zsh,但无法正常工作。 尽管主题可以完美地发挥作用,但插件却不能。 我选择了一些插件,例如。 macports,但是我既没有获得端口命令的完成,也没有获得适当的别名。 这是我的.zshrc:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    # 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完成。 我必须导出某些内容才能使用那些插件吗? 否则,如何解决该问题?


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

1
2
3
plugins=(git wd)
export ZSH=/home/<user>/.oh-my-zsh
source $ZSH/oh-my-zsh.sh


我被这个咬了。

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

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

因此修复很简单:

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

再见!


我刚才有同样的问题!我的Archlinux中安装了一个名为grml-zsh-config的软件包。我删除了此程序包,并且oh-my-zsh主题开始起作用。


我是通过kubectl插件运行的。

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