oh-my-zsh 插件不工作 [英] oh-my-zsh plugins not working

查看:145
本文介绍了oh-my-zsh 插件不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<预><代码># oh-my-zsh 配置的路径.出口 ZSH=$HOME/.oh-my-zsh# 设置要加载的主题名称.# 查看 ~/.oh-my-zsh/themes/# 可选地,如果您将其设置为随机",它将加载一个随机主题# oh-my-zsh 加载的时间.出口 ZSH_THEME="steeef"# 设置为这个以使用区分大小写的完成# export CASE_SENSITIVE="true"# 注释掉以禁用每周自动更新检查# 导出 DISABLE_AUTO_UPDATE="true"# 如果要在 ls 中禁用颜色,请取消注释以下行# 导出 DISABLE_LS_COLORS="true"# 如果要禁用自动设置终端标题,请取消注释以下行.# 导出 DISABLE_AUTO_TITLE="true"# 你想加载哪些插件?(插件可以在 ~/.oh-my-zsh/plugins/* 中找到)# 示例格式:plugins=(rails git textmate ruby​​ lighthouse)插件=(git osx github macports textmate svn)来源 $ZSH/oh-my-zsh.sh# 根据您的需要定制...导出路径=/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 完成.我是否必须导出一些东西才能使用这些插件?或者如果没有,该怎么做才能解决这个问题?

解决方案

我被这个咬了.

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

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

所以修复很简单:

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

呸!

I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my .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 and osx plugins also do not seem to work - zsh just complains about unknown command and stops. git and svn have some basic completion but I'm not sure whether it's done by plugin or just a normal zsh completion. Do I have to export something to use those plugins? Or if not, what to do to have that fixed?

解决方案

I got bitten by this.

What happened is you did a manual install and the instructions for the manual install don't mention that you need to set the PATH yourself.

So you end up with the default PATH. The source for the automatic setup code copies your current path and appends it to the .zshrc, which isn't enough if you depend on non-standard PATH entries (e.g. you run Homebrew on a Mac).

So the fix is simple:

Fire up your old shell and its configuration file and then copy and paste the value of $PATH into the top of your ~/.zshrc file.

Ciao!

这篇关于oh-my-zsh 插件不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆