美文网首页
ubuntu里zsh插件设置

ubuntu里zsh插件设置

作者: 蜡笔刘 | 来源:发表于2017-11-23 13:48 被阅读246次

    安装zsh-syntax-highlighting插件

    先下载源码:
    cd ~/.oh-my-zsh/custom/plugins
    git clone git://github.com/zsh-users/zsh-syntax-highlighting.git

    打开~/.zshrc文件,找到以下段落:

    # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
        # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
        # Example format: plugins=(rails git textmate ruby lighthouse)
        # Add wisely, as too many plugins slow down shell startup.
        plugins=(git)
    

    按照注释中的提示改成:
    plugins=(git zsh-syntax-highlighting)

    安装autojump插件

    先下载源码:
    git clone git://github.com/joelthelion/autojump.git
    然后安装该程序:

    cd autojump
    ./install.py
    

    ~/.zshrc文件中加入以下代码:

     # install autojump
    [[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
    

    安装Powerline-Shell插件

    先下载源码:
    git clone https://github.com/milkbikis/powerline-shell
    再安装:

     cd powerline-shell
     ./install.py
     ln -s <path/to/powerline-shell.py> ~/powerline-shell.py
    

    再配置~/.zshrc文件,在其末尾加入如下代码:

    # install powerline-shell
    function powerline_precmd() {
      export PS1="$(~/powerline-shell.py  --cwd-max-depth 1 --cwd-only $? --shell zsh 2> /dev/null )"
    }
    
    function install_powerline_precmd() {
      for s in "${precmd_functions[@]}"; do
        if [ "$s" = "powerline_precmd" ]; then
          return
        fi
      done
      precmd_functions+=(powerline_precmd)
    }
    install_powerline_precmd
    

    相关文章

      网友评论

          本文标题:ubuntu里zsh插件设置

          本文链接:https://www.haomeiwen.com/subject/hqdzvxtx.html