oh my zsh插件:命令动态提示和自动增量补全命令incr/自动补全zsh-autosuggestion安装/命令行命令高亮插件zsh-syntax-highlighting/

下载incr地址:

https://mimosa-pudica.net/zsh-incremental.html

值得注意的是,该插件某些场景下比较卡顿,可以不设置为自动启动,在想用的时候通过:
source /incr所在目录/incr*.zsh

  • 事实上,我认为,shell自带的tab提示候选已经足够了,如果在配合轻量的autocomplete插件,则更加高效,但是incr虽然可以动态提示,但是开销较大,影响性能
  • incr插件本身不依赖于oh-my-zsh框架,只需要原始的zsh(zshell)就可以驱动该插件
  • 下载时,为了和oh my zsh 插件目录结构相适应,执行如下命令创建目录:
mkdir -p ~/.oh-my-zsh/plugins/incr/
cd ~/.oh-my-zsh/plugins/incr/
wget http://mimosa-pudica.net/src/incr-0.2.zsh   

启用脚本

source incr*.zsh

配置自启

设置自动启动incr动态提示插件:(设置永久有效,当然可以把添加的行注释掉以关闭它)
编辑.zshrc:

 vim ~/.zshrc   

在末尾添加一行:
(ctrl+G),o

source ~/.oh-my-zsh/plugins/incr/incr*.zsh

在这里插入图片描述
立即生效,执行

source ~/.zshrc

使配置生效.
在这里插入图片描述


reference link1:How Do I Enable Syntax Highlighting in ZSH
reference link2


> 高亮插件不依赖于oh My zsh

zsh-syntax-highlighting

下载(clone)插件到指定目录

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

在zshrc中注册该插件

Finally, add the zsh-syntax-highlighting as the plugin in your .zshrc file as:

plugins=( zsh-syntax-highlighting)

但是一般的,您的插件不只一个,可以写成如下形式

# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
 # zsh-autosuggestions
  #其他插件...
  autojump
  zsh-syntax-highlighting
)

激活该配置,使插件生效

To apply the changes to your current terminal session, enter the command:

source ~/.oh-my-zsh/zshrc

zsh-autosuggestion

  • 过程和zsh-syntaxhighlith几乎一样

reference of auto-suggestions

  • How to Use ZSH Auto-suggestions (linuxhint.com)
    插件也不依赖于oh my zsh框架(仅依赖于zsh),但是可以整合到oh-my-zsh
  • 下载(克隆)
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    然后添加
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
 zsh-autosuggestions
  #其他插件...
  autojump
  zsh-syntax-highlighting
)

激活

cd ~
source .zhsrc

一键批量安装上述两个插件

!!! 执行下述脚本最好切换到bash执行(zsh下执行sed的某些指令可能会提示找不到sed!)

包括 zsh-autosuggestion
zsh-syntax-highlight

两个插件克隆成功可能需要多次尝试

成功后,执行一下代码配置和激活插件


# 将两个插件下载到指定目录下:(git 已经指定好了目录)
git clone https://gitee.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#将工作目录转移到家目录
cd ~
path=.zshrc
sed '/(^plugins)/ s/^#*/#/;
/^#*plugins/ a\
plugins=(\
    git\
    zsh-syntax-highlighting\
    zsh-autosuggestions\
    # 注意,sed命令的后续不能换行\
)' -r -iE $path

source .zshrc

cd - 


附:加速/clone两个插件

将github换为gitee,提高clone成功率


git clone https://gitee.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值