Henry Henry
  • JavaScript
  • TypeScript
  • Vue
  • ElementUI
  • React
  • HTML
  • CSS
  • 技术文档
  • GitHub 技巧
  • Nodejs
  • Chrome
  • VSCode
  • Other
  • Mac
  • Windows
  • Linux
  • Vim
  • VSCode
  • Chrome
  • iTerm
  • Mac
  • Obsidian
  • lazygit
  • Vim 技巧
  • 分类
  • 标签
  • 归档
  • 网站
  • 资源
  • Vue 资源
GitHub (opens new window)

Henry

小学生中的前端大佬
  • JavaScript
  • TypeScript
  • Vue
  • ElementUI
  • React
  • HTML
  • CSS
  • 技术文档
  • GitHub 技巧
  • Nodejs
  • Chrome
  • VSCode
  • Other
  • Mac
  • Windows
  • Linux
  • Vim
  • VSCode
  • Chrome
  • iTerm
  • Mac
  • Obsidian
  • lazygit
  • Vim 技巧
  • 分类
  • 标签
  • 归档
  • 网站
  • 资源
  • Vue 资源
GitHub (opens new window)
  • 说明
  • Vim

  • VSCode

  • Chrome

  • iTerm

    • iTerm-说明
    • iTerm-01-导航
    • iTerm-02-初识 zellij
    • iTerm-03-zellij 高级使用技巧
    • iTerm-复习 -1
    • iTerm-04-初始 zsh-vi-mode
    • iTerm05-zsh-vi-mode 高级使用技巧
    • iTerm-06-zsh 常用插件
      • 任务点
        • zsh-autosuggestions: 历史命令自动填充
        • zsh-syntax-highlighting: 指令高亮
        • autojump: 快速跳转路径
        • copypath: 复制当前路径
        • copyfile: 复制文件内容
        • web-search: 搜索
        • macos: 提供 macos 的实用工具
      • 社群讨论
    • iTerm-07-zsh 自定义快捷键
    • iTerm-复习 -2
  • mac

  • Obsidian

  • lazygit

  • 学习双拼
  • Vim 技巧

  • 键盘侠
  • iTerm
Henry
2022-07-23
目录

iTerm-06-zsh 常用插件

# 任务点

# zsh-autosuggestions (opens new window): 历史命令自动填充

安装:

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
)
1
2
3

Start a new terminal session.

选择提示的历史命令:

  • 右方向键

修改样式:

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"

# zsh-syntax-highlighting (opens new window): 指令高亮

安装:

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)
1

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

# autojump (opens new window): 快速跳转路径

安装:

brew install autojump

Activate the plugin in ~/.zshrc:

plugins=( [plugins...] autojump)
1

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

使用:

  • j + 模糊的目录:跳转到该路径
  • jo + 模糊的目录:使用 Finder 打开该目录
  • j -s: 查看记录
  • j -i: 增加当前路径的权重
  • j -d: 减少当前路径的权重
  • j -a: 添加路径

# copypath (opens new window): 复制当前路径

安装:

Activate the plugin in ~/.zshrc:

plugins=( [plugins...] copypath)
1

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

使用:

  • copypath

# copyfile (opens new window): 复制文件内容

安装:

Activate the plugin in ~/.zshrc:

plugins=( [plugins...] copyfile)
1

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

使用:

  • copyfile

# web-search (opens new window): 搜索

安装:

Activate the plugin in ~/.zshrc:

plugins=( [plugins...] web-search)
1

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

使用:

  • google + 搜索关键字

自定义:

ZSH_WEB_SEARCH_ENGINES=(bl "https://search.bilibili.com/all?keyword=")

  • bl + 搜索关键字

# macos (opens new window): 提供 macos 的实用工具

安装:

Activate the plugin in ~/.zshrc:

plugins=( [plugins...] macos)
1

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

使用:

  • tab: 新建一个 tab
  • split_tab: 向下分屏
  • vsplit_tab: 向右分屏
  • man-preview: 使用 pdf 查看文档

# 社群讨论

话说崔哥 vim 之后 auto suggest .zshrc,然后是怎么 tab 一键补全的啊?就是总会有 .zsh_history 等一些文件,然后 tab 就补全不了,需要输入完整地

没看懂 录个视频瞅瞅

就是崔哥,你 vim .zshrc 是不是 vim 空格 tab 然后就出来了,还需要按什么键吗?

用 →

哦哦,原来是右方向键,懂了

官方文档上也有,发现 ctrl + e 也可以。哦,这个的逻辑就是到行尾,tab 不行,但是基本到行尾的都可以,回到 normal 模式用 $ 也可以


zsh plugin 的调用原理是怎样的?为什么 autojump brew install 了之后放在 zsh plugin 里会直接生效?

autojump brew install 安装的才是  autojump 的代码,zsh plugin 文件里面的 autojump.zsh 只是帮你 source autojump 的

应该是按照 plugins 的项遍历执行 .oh-my-zsh/plugins 和 .oh-my-zsh/custome/plugins 中对应的 *.plugin.zsh,而 *.plugin.zsh 再去 source 真正的功能代码文件,brew install autojump 在

/usr/local/etc/profile.d/autojump.sh               # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh            # macOS with Homebrew (default on M1 macs)
1
2

安装了功能代码,在 oh-my-zsh/plugins 中安装了 autojump/autojump.plugin.zsh 调用功能代码的脚本

之前看到一半忙别的去了,所以才问了 zsh plugin 调用原理的问题。接着往后看发现视频里解释过了。崔老师懂我们啊


copypath 是不是 echo $(pwd) | pbcopy 就行了,实操了下没 copypath 好用,复制文件路径也没 copypath 方便

编辑 (opens new window)
上次更新: 5/27/2023, 1:02:05 PM
iTerm05-zsh-vi-mode 高级使用技巧
iTerm-07-zsh 自定义快捷键

← iTerm05-zsh-vi-mode 高级使用技巧 iTerm-07-zsh 自定义快捷键→

最近更新
01
version 1.15
07-01
02
version 1.14
06-27
03
version 1.13
06-27
更多文章>
Theme by Vdoing | Copyright © 2017-2023 HenryTSZ | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式