【问题标题】:zshell command named "prompt" in macOS?macOS中名为“提示”的zsh命令?
【发布时间】:2020-09-19 20:23:22
【问题描述】:

我正在为 macOS Catalina (10.15.6) 使用 zshell。 《Learning Shell Scripting With Zsh》一书描述了一个名为prompt的可执行命令,可以以如下形式使用:

$ prompt -p
$ prompt -h
$ prompt <theme_name>
$ prompt adam1 red yellow magenta

但是zsh报告“command not found: prompt”。

我如何获得该命令或等效命令。

(我尝试搜索的所有地方都提供了指向解释如何设置 zsh 提示符的位置的链接,以及所有常用的转义序列、“$...”符号等)

【问题讨论】:

    标签: macos zsh macos-catalina


    【解决方案1】:

    来自man zshcontrib

    PROMPT THEMES
       Installation
           You  should  make  sure  all  the  functions from the Functions/Prompts
           directory of the source distribution are available; they all begin with
           the  string `prompt_' except for the special function`promptinit'.  You
           also  need  the  `colors'  and  `add-zsh-hook'  functions  from   Func-
           tions/Misc.   All these functions may already be installed on your sys-
           tem; if not, you will need to find them and copy them.   The  directory
           should  appear  as  one of the elements of the fpath array (this should
           already be the case if they were installed), and at least the  function
           promptinit  should  be autoloaded; it will autoload the rest.  Finally,
           to initialize the use of the system you need  to  call  the  promptinit
           function.   The  following  code  in your .zshrc will arrange for this;
           assume the functions are stored in the directory ~/myfns:
    
                  fpath=(~/myfns $fpath)
                  autoload -U promptinit
                  promptinit
    

    所以,要获取prompt 命令,您只需运行

    $ autoload -U promptinit
    $ promptinit
    

    【讨论】:

    • 做到了。谢谢!
    猜你喜欢
    • 2023-03-04
    • 1970-01-01
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 2023-03-08
    • 2020-09-04
    • 2020-02-06
    • 2022-08-17
    相关资源
    最近更新 更多