首页
友链
壁纸
留言
今日热榜
更多
关于
时光
推荐
精品流量卡
Search
1
都二十多年了,你的梦为什么还没碎!
57,085 阅读
2
2022年5个好用的 BT/ 磁力链接下载工具推荐 |Windows 、安卓系统
37,355 阅读
3
nps内网穿透实现外网访问树莓派
32,424 阅读
4
实践利用宝塔建emlog个人博客-超详细【原创】
26,132 阅读
5
Typecho-Joe-Theme主题帮助文档
24,612 阅读
闲杂乱码
Python
网站源码
微信小程序
娱乐分享
Is相册
软件工具
登录
Search
标签搜索
PHP
HTML
API
Javascript
源码
JS
Vue
Github
CloudFlare
接口
函数
SQL
ASP.NET
MVC
EF
T4模板
后台管理
CDN
微信小程序
MAC
韩小韩
累计撰写
261
篇文章
累计收到
1,304
条评论
首页
栏目
闲杂乱码
Python
网站源码
微信小程序
娱乐分享
Is相册
软件工具
页面
友链
壁纸
留言
今日热榜
关于
时光
推荐
精品流量卡
搜索到
1
篇与
zsh
的结果
2021-05-24
iTerm2 + Oh My Zsh 打造MAC舒适终端体验
{message type="info" content="众所周知,大部分的Linux发行版的默认命令解释器是Bash。但除此之外,这个星球上的命令解释器多了去了。相比于默认的 Bash,Zsh 有更多的自定义选项,并支持扩展。因此 Zsh 可以实现更强大的命令补全,命令高亮等一系列酷炫功能。今天我们就来打造一个自己的好看、好用的 Zsh 终端。"/}下载iTerm2可以直接去官网下载: {anote icon="fa-link" href="https://www.iterm2.com/" type="info" content="iTerm2"/} 安装完成后,在/bin目录下会多出一个zsh的文件。Mac系统默认使用dash作为终端,可以使用命令修改默认使用zsh:chsh -s /bin/zsh如果想修改回默认dash,同样使用chsh命令即可:chsh -s /bin/bashOK,这就是iTerm2初始的样子,下面我们来美化它,让它变得更好用!安装Oh my zsh安装方法有两种,可以使用curl或wget,看自己环境或喜好:# curl 安装方式 sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"# wget 安装方式 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"⚠️ ㅤ有些同学的终端如果无法访问raw.githubusercontent.com:443,但可以打开Github,打开Github可直接下载到本地,然后本地执行 tools/install.sh即可 安装命令和安装完成后的截图:oh-my-zsh开源地址: {anote icon="fa-link" href="https://github.com/robbyrussell/oh-my-zsh" type="info" content="oh-my-zsh"/}安装PowerLinePowerline是agnoster主题的依赖。具体可以在repo里查询到: {anote icon="fa-link" href="https://github.com/agnoster/agnoster-zsh-theme" type="info" content="Powerline"/} powerline官网: {anote icon="fa-link" href="http://powerline.readthedocs.io/en/latest/installation.html" type="secondary" content="powerline官网"/} 安装powerline的方式依然简单,也只需要一条命令:pip install powerline-status --user没有安装pip的同学可能会碰到zsh: command not found: pip。使用命令安装pip即可:sudo easy_install pip安装后再次执行安装powerline的命令即可。安装PowerFonts安装字体库需要首先将项目git clone至本地,然后执行源码中的install.sh。在你习惯的位置新建一个文件夹,如:~/Desktop/OpenSource/在此文件夹下执行git clone命令:# git clone git clone https://github.com/powerline/fonts.git --depth=1 # cd to folder cd fonts # run install shell ./install.sh执行结果如下:安装好字体库之后,我们来设置iTerm2的字体,具体的操作是iTerm2 -> Preferences -> Profiles -> Text,在Font区域选中Change Font,然后找到Meslo LG字体。有L、M、S可选,看个人喜好:安装配色方案配色方案在使用VIM或Colorful Log时会变得非常有用,同时界面也不会一片黑绿一样死板。同样使用git clone的方式下载源码进行安装:cd ~/Desktop/OpenSource git clone https://github.com/altercation/solarized cd solarized/iterm2-colors-solarized/ open .在打开的finder窗口中,双击Solarized Dark.itermcolors和Solarized Light.itermcolors即可安装明暗两种配色:再次进入iTerm2 -> Preferences -> Profiles -> Colors -> Color Presets中根据个人喜好选择这两种配色中的一种即可:安装主题下载agnoster主题,执行脚本安装:cd ~/Desktop/OpenSource git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor.git cd oh-my-zsh-agnoster-fcamblor/ ./install执行上面的命令会将主题拷贝到oh my zsh的themes中:拷贝完成后,执行命令打开zshrc配置文件,将ZSH_THEME后面的字段改为agnoster。vi ~/.zshrc修改完成后按一下esc调出vi命令,输入:wq保存并退出vi模式。此时command+Q或source配置文件后,iTerm2变了模样:安装高亮插件这是oh my zsh的一个插件,安装方式与theme大同小异:cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git vi ~/.zshrc这时我们再次打开zshrc文件进行编辑。找到plugins,此时plugins中应该已经有了git,我们需要把高亮插件也加上:请务必保证插件顺序,zsh-syntax-highlighting必须在最后一个。然后在文件的最后一行添加:source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh按一下esc调出vi命令,输入:wq保存并退出vi模式。执行命令使刚才的修改生效:source ~/.zshrc至此大功告成,请看最终效果图:背景图片取自微软Surface Studio的4K壁纸(将近12MB大小),非常漂亮,需要的可以自取:{cloud title="4K终端背景图片" type="wy" url="https://p.ananas.chaoxing.com/star3/origin/ac6c0b1566b8b3f17fbeaa23ada6d447.png" password=""/}更换背景图片方式:iTerm2 -> Preferences -> Profiles -> Window -> BackGround Image勾选图片即可。可选择、命令补全跟代码高亮的安装方式一样,这也是一个zsh的插件,叫做 zsh-autosuggestion ,用于命令建议和补全。cd ~/.oh-my-zsh/custom/plugins/ git clone https://github.com/zsh-users/zsh-autosuggestions vi ~/.zshrc找到plugins,加上这个插件即可:插件效果:有同学说补全命令的字体不太清晰,与背景颜色太过相近,其实可以自己调整一下字体颜色。Preferences -> Profiles -> Colors 中有Foreground是标准字体颜色,ANSI Colors中Bright的第一个是补全的字体颜色。{callout color="#f0ad4e"}转自 https://github.com/sirius1024/iterm2-with-oh-my-zsh喜欢请star{/callout}
2021年05月24日
9,825 阅读
0 评论
1 点赞