Zsh常用插件整理

ZSH

安装 ZSH

Zsh(Z-shell)是一款用于交互式使用的shell,也可以作为脚本解释器来使用。其包含了 bash,ksh,tcsh 等其他shell中许多优秀功能,也拥有诸多自身特色。

sudo apt-get install zsh

Oh-My-Zsh

Oh My Zsh 是一个令人愉快的、开源的、社区驱动的框架,用于管理您的 Zsh 配置。它捆绑了数千个有用的功能、助手、插件、主题等。

安装 Oh-My-Zsh

sh -c "$(curl -fsSL <https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"

配置

# 打开~/.zshrc

# 设置主题,可以指定某个主题,也可以随机(random),
ZSH_THEME="random"

# 添加插件。下载的插件放置~/.oh-my-zsh/custom/plugins目录下,然后在plugins后面追加插件名字即可
plugins=(git docker z zsh-syntax-highlighting alias-tips zsh-autosuggestions zsh-completions)

Zsh 插件

推荐几个比较使用的插件。

zsh-syntax-highlighting

这个插件可以识别的shell命令并高亮显示,效果如下:

安装:

#Clone this repository in oh-my-zsh's plugins directory:
git clone <https://github.com/zsh-users/zsh-syntax-highlighting.git> ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

#Activate the plugin in ~/.zshrc:
plugins=( [plugins...] zsh-syntax-highlighting)

#Restart zsh (such as by opening a new instance of your terminal emulator).
zsh

zsh-autosuggestions

自动补全插件,输入命令后会自动提示相关命令,使用方向键可以实现自动补全。

安装:

#Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)
git clone <https://github.com/zsh-users/zsh-autosuggestions> ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

#Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):
plugins=( 
    # other plugins...
    zsh-autosuggestions
)

#Start a new terminal session.
zsh

fzf

fzf是一款使用 GO 语言编写的交互式的 Unix 命令行工具。可以用来查找任何列表内容、文件、历史命令、 本机绑定的host、 进程、 Git 分支、进程等。所有的命令行工具可以生成列表输出的都可以再通过管道 pipe 到 fzf 上进行搜索和查找。

安装:

git clone --depth 1 <https://github.com/junegunn/fzf.git> ~/.fzf
~/.fzf/install

zsh-completions

命令补全插件,输入命令按Tab键后会提示可以使用的命令和说明。

安装:

#Clone the repository inside your oh-my-zsh repo:
git clone <https://github.com/zsh-users/zsh-completions> ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions

#Add it to FPATH in your .zshrc by adding the following line before source "$ZSH/oh-my-zsh.sh":
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src

#Start a new terminal session.
zsh

autojump

自动跳转目录插件,平时我们使用 cd 时autojump都会记录下来,下次我们要进入这个目录直接使用 j+目录名即可,如果遇到相同目录名它按你使用频率来决定跳转到哪个目录。

安装:

#Grab a copy of autojump:
git clone git://github.com/wting/autojump.git

#Run the installation script and follow on screen instructions.
cd autojump
./install.py or ./uninstall.py

web-search

该插件可以让在你浏览器中输入网站的别名来打开网页,插件本身已经带来很多的网址比如 baidu、google、stackoverflow、github等等。我们可以自己手动添加一些常用网址,添加方式如下:

plugins=(web-search)

ZSH_WEB_SEARCH_ENGINES=(
notion "https://www.notion.so/"
shimo "https://shimo.im"
asource "https://source.android.com/"
)

其他

  • alias-finder 当你引用或定义了很多别名时,但是你记不住,这个插件会提示你可以使用什么别名,这使得学习新别名更容易。
  • git git插件定义了很多git操作的别名,让git操作更丝滑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值