推荐 6 个超好用的 iterm2 zsh 插件
推荐 6 个超好用的 iterm2 zsh 插件
本文将介绍6个实用的iterm2 zsh插件,这些插件可以显著提高命令行使用效率。每个插件都经过精心挑选,能够解决日常开发中常见的痛点。
zsh-autosuggestions
插件地址:https://github.com/zsh-users/zsh-autosuggestions
效果展示:当你输入命令时,插件会基于之前执行过的命令自动给出提示,非常实用。
安装方法:
通过Git克隆到
$ZSH_CUSTOM/plugins
目录:git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
或者使用Homebrew安装:
brew install zsh-autosuggestions
在
.zshrc
中配置:plugins=( # other plugins... zsh-autosuggestions )
如果使用Homebrew安装,还需要在
.zshrc
最后增加激活插件的命令:source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
autojump
插件地址:https://github.com/wting/autojump
效果展示:autojump允许你通过简短的命令快速跳转到常用目录。例如,从根目录直接跳转到temp
目录只需输入j temp
。
安装方法:
使用Homebrew安装:
brew install autojump
或者手动安装:
git https://github.com/wting/autojump $ZSH_CUSTOM/plugins/autojump cd $ZSH_CUSTOM/plugins/autojump ./install.py
在
.zshrc
中配置:plugins=( # other plugins... autojump )
zsh-better-npm-completion
插件地址:https://github.com/lukechilds/zsh-better-npm-completion
效果展示:输入npm run
后按下tab
键,可以自动弹出项目中的所有scripts,支持使用tab
、ctrl + n
和ctrl + p
进行选择。
安装方法:
克隆插件代码到zsh插件目录:
git clone https://github.com/lukechilds/zsh-better-npm-completion ~/.oh-my-zsh/custom/plugins/zsh-better-npm-completion
在
.zshrc
中配置:plugins=( # other plugins... zsh-better-npm-completion )
zsh-syntax-highlighting
插件地址:https://github.com/zsh-users/zsh-syntax-highlighting
效果展示:该插件为关键字提供高亮显示,错误命令也会报红,使命令输入更加直观。
安装方法:
克隆项目到zsh插件目录:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
在
.zshrc
中配置:plugins=( # other plugins... zsh-syntax-highlighting )
zsh-vi-mode
插件地址:https://github.com/jeffreytse/zsh-vi-mode
效果展示:该插件允许你在命令行中使用vi模式进行编辑,对于熟悉vim的用户非常友好。
安装方法:
克隆插件到zsh插件目录:
git clone https://github.com/jeffreytse/zsh-vi-mode $ZSH_CUSTOM/plugins/zsh-vi-mode
在
.zshrc
中配置:plugins=( # other plugins... zsh-vi-mode )
copypath和copybuffer
这两个是zsh自带的插件,不需要额外配置:
copypath
:将当前目录快速复制到剪切板。copybuffer
:映射到ctrl + o
快捷键,用于复制当前终端显示的命令。
you-should-use
插件地址:https://github.com/MichaelAquilina/zsh-you-should-use
效果展示:在你输入命令时,插件会自动给出更好的命令建议。
安装方法:
克隆插件到zsh插件目录:
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use
在
.zshrc
中配置:plugins=( # other plugins... you-should-use )
总结
以上插件都是作者在日常使用中觉得非常实用的zsh插件。使用命令行操作不仅很酷,而且很多时候比用鼠标操作更高效。如果你有其他好用的插件或提效工具,欢迎分享。
本文原文来自CSDN