Oh My ZSH让你的终端美如画
文章目录
- 前言
- 安装方法
- 安装高亮显示插件
- 智能提示 zsh-autosuggestions
- 主题设置
- 设置 vim 可配色
- 临时不想用Oh My ZSH
- 方法一:
- 方法二:
- 卸载
- 参考文档
前言
无意中发现这个插件Oh My ZSH,之前也有在一些视频中看到过,一直好奇是什么插件。怎么早没发现这么好用的插件啊。
安装方法
官网:
https://ohmyz.sh/
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
国内源加速:
sh -c "$(curl -fsSL https://gitee.com/lxyoucan/tools/raw/master/common/ohmyzshinstall.sh)"
安装完成后,打开终端会出现:
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxrwx 3 itkey admin 96 12 17 10:26 /usr/local/share/zsh
drwxrwxrwx 4 itkey admin 128 12 17 10:29 /usr/local/share/zsh/site-functions[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
根据提示,执行以下语句:
compaudit | xargs chmod gw,ow
下次打开终端就没有这个提示了。
安装高亮显示插件
我首先要做的是安装一个名为
zsh-syntax-highlighting的插件。它为ZSH Shell提供语法高亮显示。
cd $HOME/.oh-my-zsh/plugins
#下载代码
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
最后一行,就是自动修改 ~/.zshrc,在最后一行加入
source /Users/itkey/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
智能提示 zsh-autosuggestions
cd $HOME/.oh-my-zsh/plugins
#下载代码
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
修改~/.zshrc
增加插件引用
plugins=(zsh-autosuggestions)
主题设置
如多主题到这里看吧:
https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
我挑一个自己喜欢的主题。
这主题要先安装字体:
- 安装 powerline 字体
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
- iTerm中设置字体
- 修改
~/.zshrc
ZSH_THEME=“agnoster”
VSCODE中设置
在你的设置文件中 (Code | Preferences | Settings)
增加如下这行:
"terminal.integrated.fontFamily": "Meslo LG S DZ for Powerline"
设置 vim 可配色
终端输入vim .vimrc,设置内容如下,
syntax on
set number
set ruler
临时不想用Oh My ZSH
如果体验以后,发现可能不适合你。或者都临时换成以前的zsh怎么办呢?
肉吃多了想吃点素的。
方法一:
zsh -f
这只是临时的,下次打开终端还是会以 Oh My ZSH打开。
方法二:
安装Oh My ZSH以前会自动把我们之前的~/.zshrc ,重命名为~/.zshrc.pre-oh-my-zsh
。
修改~/.zshrc
为安装Oh My ZSH这前的配置即可。
- 从
Oh My ZSH
切换到ZSH
#备份Oh My ZSH的配置,方便后面还原
cp ~/.zshrc ~/.zshrc.bak-oh-my-zsh
#切换为原配置
cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc
- 从
ZSH
切换到Oh My ZSH
#前提是之前执行过从Oh My ZSH切换到ZSH
cp ~/.zshrc.bak-oh-my-zsh ~/.zshrc
重新开启终端生效。反正就捣鼓这两个文件~/.zshrc
和 ~/.zshrc.pre-oh-my-zsh
,如果你喜欢可以把这个操作做成快捷指令方便来回切换。
卸载
这么好的东西你要卸载了?心不会痛吗?好吧,那么它来了。
uninstall_oh_my_zsh
重启以后它就没有了。变回它原来的样子了。
友情提醒:卸载会把你安装的插件一起卸载了,如果觉得有需要就备份一下吧。
参考文档
https://dev.to/amanhimself/setup-macbook-m1-for-web-and-react-native-development-8la
Oh My ZSH让你的终端美如画相关推荐
- Terminator + ZSH + OhMyZsh配置优美终端
文章目录 参考资料 前言 分屏工具Terminator 命令行工具zsh oh-my-zsh 安装与配置 1. 安装Terminator 2. 安装zsh 3. 安装oh-my-zsh 4. 配置oh ...
- found zsh 所有命令在终端失效
zsh终端里所有命令全部失效解决办法 ?? ~ lszsh: command not found: ls?? ~ dirzsh: command not found: dir?? ~ cat .zsh ...
- Mac zsh: command not found zsh 所有命令在终端失效
方法一: PATH=/bin:/usr/bin:/usr/local/bin:${PATH} export PATH 方法二: exec /bin/zsh 方法三: exec /usr/bin/zsh ...
- zsh: permission denied:解决终端命令行失效,文件夹无权限的问题。
在 .zshrc中添加了一个 PATH. 把终端的权限全部给搞没了. 导致 输入任何命令都失效了.还以为自己的权限被系统给收回去了.导致输入 sudo都提示 找不到该命令.需要使用命令都需要打上 $在 ...
- 玩转手机中的linux系统termux并搭建java开发环境
目标 春节在家,偶尔要出门在外.出门在外的时候,没有电脑可以写代码.那么代码瘾上来了怎么办呢?我在想能不能在手机上写代码呢? 手机远程电脑是一种方式,但是远程开发这种方式,它的要求比较高,首先你要有台 ...
- Mac终端shell类型bash和zsh切换
查看shell类型 可以执行命令echo $SHELL,先查看终端类型. bash: /bin/bash zsh: /bin/zsh shell类型切换命令 切换到bash 输入命令:chsh -s ...
- centos7花里胡哨之终端美化
centos7花里胡哨之终端美化 只想整天学习 2019-10-06 17:57:03 4872 收藏 27 分类专栏: RHEL7 文章标签: zsh主题设置 centos7终端美化 版权 很多 ...
- 使用 ohmyzsh 打造 windows、ubuntu、mac 系统高效终端命令行工具
如果觉得内容不错,可以设为星标置顶我的公众号 原标题名:oh my zsh 和 windows git bash 设置别名提高效率 写于2018年06月03日 在我的微信交流群中听闻很多前端开发比较贫 ...
- [转]Oh My Zsh,安装,主题配置
https://swp-song.com/2017/08/20/Tools/OhMyZsh%E5%AE%89%E8%A3%85%E5%92%8C%E4%B8%BB%E9%A2%98%E9%85%8D% ...
最新文章
- 是男人就下100层【第四层】——Crazy贪吃蛇(2)
- 公差基本偏差代号_《公差配合与技术测量》试题答案卷
- zabbix API 删除host
- Django框架(15.Django中的自关联)
- OpenCV YOLO DNN(yolo_object_detection)
- 博物馆守卫问题(世界名画展览馆)
- c++反汇编与逆向分析技术揭秘_C++反汇编与逆向分析技术揭秘
- Redis持久化RDB
- HTML5---新增客户端储存
- open cv+C++错误及经验总结(十二)
- php redis 查询,Redis慢查询日志 PHP中使用redis – 安装扩展模块
- 无线充QI协议之TX与RX通讯方式篇
- JavaWeb:(练习)十四、基于mybatis框架的简单的学生管理系统
- Leetcode各种题型题目+思路+代码(共176道题及答案)
- Redis的基本操作
- yxy小蒟蒻的201113总结
- STM32 PWM的理解
- Java物联网项目中,运行SPringBoot脚手架,运行失败问题
- Oracle备份恢复(一)
- DecimalFormat 用法详解