ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

【macOS】zsh增强:自动建议&语法高亮

2022-06-13 11:35:43  阅读:261  来源: 互联网

标签:macOS 高亮 com autosuggestions syntax https highlighting zsh


✨Zsh

https://www.zsh.org/

Zsh is a shell designed for interactive use, although it is also a powerful scripting language.


✨Oh My ZSH

!建议安装 Oh My Zsh

https://ohmyz.sh/


安装

  • Install oh-my-zsh via curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • Install oh-my-zsh via wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

✨自动建议

https://github.com/zsh-users/zsh-autosuggestions


安装

  1. Clone this repository somewhere on your machine. This guide will assume ~/.zsh/zsh-autosuggestions.

    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
    
  2. Add the following to your .zshrc:

    source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
    
  3. Start a new terminal session.


详细可参考:

https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md


Homebrew 安装

我们直接在brew中搜索zsh

brew search zsh

发现可以搜索到zsh-autosuggestions


那我们直接使用homebrew安装

brew install zsh-autosuggestions

需要把 source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh写入.zshrc

echo "source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc

效果

It suggests commands as you type based on history and completions.

这个时候直接按 → 就能自动完成建议的命令


✨语法高亮

https://github.com/zsh-users/zsh-syntax-highlighting


安装

Simply clone this repository and source the script:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Then, enable syntax highlighting in the current interactive shell:

source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If git is not installed, download and extract a snapshot of the latest development tree from:

https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz

Note the source command must be at the end of ~/.zshrc.


详细可参考:

https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md


Homebrew 安装

brew install zsh-syntax-highlighting

需要把source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh写入.zshrc

echo "source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

效果

Fish shell-like syntax highlighting for Zsh.

命令错误状态

命令正确状态


⭐转载请注明出处

本文作者:双份浓缩馥芮白

原文链接:https://www.cnblogs.com/Flat-White/p/16370201.html

版权所有,如需转载请注明出处。

标签:macOS,高亮,com,autosuggestions,syntax,https,highlighting,zsh
来源: https://www.cnblogs.com/Flat-White/p/16370201.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有