macos终端美化

Speeding it up more than the standard bash terminal that comes with your MacOS by using iTerm2, Z shell, Oh My Zsh along with the Powerlevel10k theme and Neofetch to make your terminal look like this:

通过使用iTerm2,Z shell,Oh My Zsh以及Powerlevel10k主题和Neofetch,使其比MacOS随附的标准bash终端更快,从而使终端看起来像这样:

NOTE : This tutorial will use iterm2 which is a popular alternative to the MacOS terminal. If you want you can use other terminals, usually Alacritty is a good option and looks damn cool too. This guide will also cover some simple things you can do with the Z-shell to show you why it is so much better than the bash shell. If you get stuck somewhere, don’t worry and keep reading I’ve tried to cover all the problems I ran into myself and how I went back. The reason I decided to write this article, even though some similar articles exist out there, is that personally I’ve run into problems and bugs at many points trying out themes and thus to make others lives easier, I made this comprehensive hackle-free guide to getting a fast and good looking terminal.

注意:本教程将使用iterm2,它是MacOS终端的流行替代品。 如果您希望可以使用其他终端,通常Alacritty是一个不错的选择,而且看起来也很酷。 本指南还将介绍您可以使用Z-shell进行的一些简单操作,向您展示为什么它比bash外壳好得多。 如果您被卡在某个地方,请不要担心,继续阅读我会尽力解决我遇到的所有问题以及我如何回去。 我决定写这篇文章的原因是,尽管那里有一些类似的文章,但我个人还是在尝试主题的许多时候遇到了问题和错误,从而使其他人的生活变得更加轻松,我使这一全面的工作变得无忧无虑。快速而美观的终端指南。

步骤1:如果尚未下载Homebrew,请下载。 (Step 1 : Download Homebrew if you already haven’t.)

Homebrew is the best thing to happen to the MacOS and honestly it makes developers' lives easy every day. If you’re not aware of this novel software, learn how to use it! At some point, it will be useful to you because of how easily you can download packages and maintain them with it, Without needing to know the git and ruby code underneath. You can get homebrew here, Just run this code in your terminal and answer install prompts:

自制软件是MacOS上发生的最好的事情,老实说,它使开发人员的生活每天都变得轻松。 如果您不了解此新颖软件,请学习如何使用它! 在某些时候,这对您很有用,因为您可以轻松下载软件包并使用它们进行维护,而无需了解下面的git和ruby代码。 您可以在此处进行自制程序,只需在终端中运行以下代码并回答安装提示:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

步骤2:使用Homebrew命令下载iTerm2 (Step 2 : Download iTerm2 using Homebrew commands)

Why iTerm2? For the simple reason that it is way more customisable than the Mac terminal, you can adjust transparency, add images to the background, download and use themes for iTerm2, use custom fonts and a lot more:

为什么选择iTerm2? 出于简单的原因,它比Mac终端更具可定制性,因此您可以调整透明度,将图像添加到背景,下载和使用iTerm2主题,使用自定义字体等等:

brew cask install iterm2

NOTE : If you want to see how to use custom themes and fonts follow this section or else feel free to skip to step 3.

注意:如果要查看如何使用自定义主题和字体,请遵循本节,否则请跳至步骤3。

  1. To open Preferences (Settings for iTerm2 basically) use COMMAND+i. A window will pop up where you can play around with colours and fonts, whatever works for you. I’m currently using the custom theme called dark+ with foreground text set to green. You can get all the themes here :要打开首选项(基本上是iTerm2的设置),请使用COMMAND + i。 会弹出一个窗口,您可以在其中随意使用颜色和字体。 我当前正在使用名为dark +的自定义主题,前景文本设置为绿色。 您可以在这里获得所有主题:

Select the theme you would like to download the code as an .itermcolors file then go to preferences on iterm2 and select color presets. Import the file from where you saved it and select it. Don’t forget to save your settings by selecting “Copy current settings to default profile” in General.

选择您想要将代码下载为.itermcolors文件的主题,然后转到iterm2的首选项并选择颜色预设。 从保存文件的位置导入文件并选择它。 不要忘记在常规中选择“将当前设置复制到默认配置文件”来保存设置。

2. I’m also using a downloaded custom font called Inconsolata dz, which is a powerline font, (you maybe asked to download this by Powerlevel10k but it's not compulsory and I’ll show you why later). However, if you want to download it:

2.我还使用了一种名为Inconsolata dz的下载自定义字体,它是电力线字体(您可能会被Powerlevel10k要求下载该字体,但这不是强制性的,稍后我将向您展示为什么)。 但是,如果要下载它:

# clone the repo of powerline fontsgit clone https://github.com/powerline/fonts.git --depth=1# installcd fonts./install.sh# clean-up a bit, remove the file after installation.cd ..rm -rf fonts# If you want to uninstall Powerline fonts completely for some  #reason :./uninstall.sh

After doing this the fonts should appear in Text > Fonts > Dropdown Menu.

完成此操作后,字体应显示在“文本”>“字体”>“下拉菜单”中。

步骤3:打开iTerm2并安装zsh和ohmyzsh (Step 3 : Open iTerm2 and install zsh and ohmyzsh)

Zsh is a fast alternative to bash commands with the advantage that you can club your repetitive bash commands into a single zsh alias. It is very customisable, you can use custom themes, apps, and plugins with zsh. However, zsh alone is incomplete and requires a powerful plugin manager like ohmyzsh which we will be installing as well. I will also cover some simple things you can do with Z-Shell and OhMyZsh.

Zsh是bash命令的快速替代方法,其优点是您可以将重复的bash命令组合为一个zsh别名。 这是非常可定制的,您可以在zsh中使用自定义主题,应用程序和插件。 但是,仅zsh尚不完善,需要像ohmyzsh这样功能强大的插件管理器,我们也将安装它。 我还将介绍Z-Shell和OhMyZsh可以完成的一些简单操作。

brew install zsh

Then paste and execute this in your terminal for Oh My Zsh:

然后将其粘贴并在您的终端中执行Oh My Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

步骤4:了解如何围绕Z-Shell进行工作 (Step 4 : Learning how to work your way around Z-Shell)

(If you do not care about this you may skip) Now that you have Z-shell and Oh My Zsh installed, somethings you Should know before we download the Powerlevel10k theme and Neofetch to further beautify our terminal are these: Managing Themes, Managing Plugins, Adding a permanent alias ( think of this as the custom commands) and finally getting your pip and conda commands to work with Zsh because they don’t do so by default.

(如果您不关心此问题,则可以跳过)现在已经安装了Z-shell和Oh My Zsh,在下载Powerlevel10k主题和Neofetch以进一步美化我们的终端之前,您应该了解以下内容:管理主题,管理插件,添加一个永久别名(将其视为自定义命令),并最终使pip和conda命令与Zsh一起使用,因为默认情况下它们不这样做。

  1. Managing themes: Say you’ve downloaded a custom theme and applied it to the terminal (Which we will soon), However ensuring that the theme loads every time, on startup is another issue altogether. To do this we will:管理主题:假设您已经下载了一个自定义主题,并将其应用到了终端(稍后将进行介绍),但是,确保每次启动时都加载该主题是另一个问题。 为此,我们将:
open ~/.zshrc

Think of this file as the code that executes every time you start your Z-shell. Head over to the part that says ZSH_THEME and edit its value. the default should be “robbyrussell” you can make it “agnoster” or a custom theme after we download it. But DON’T close the File just yet :)

将此文件视为每次启动Z-shell时执行的代码。 转至显示ZSH_THEME的部分,然后编辑其值。 默认值为“ robbyrussell”,您可以在下载后将其设置为“ agnoster”或自定义主题。 但是暂时不要关闭文件:)

2. Managing Plugins : In the same File zshrc go to the section that says plugins = (git) and edit it to plugins = (git docker). This will add docker as a plugin to the Z-shell. To know more about what plugins to use for your convenience head over to this link, however fair warning: Using too many plugins will slow you terminal startup considerably. Again don’t close the file after you’re done.

2.管理插件:在同一文件zshrc中,转到显示plugins =(git)的部分,然后将其编辑为plugins =(git docker)。 这会将docker作为插件添加到Z-shell。 要了解有关为方便起见使用哪些插件的更多信息,请转至此链接,但是警告是:使用太多的插件会大大降低终端的启动速度。 同样,完成后不要关闭文件。

3. Now I had run into an issue way later that screwed up everything for me, i.e, I couldn’t run conda or pip on my Z-shell. So I’m giving you guys the fix to this early on itself. Just like ~/.zshrc our bash shell has a file that allows us to use conda commands, we will simply call the file in our zshrc file. So open the zshrc file and at the end of it copy this code:

3.现在我遇到了一个麻烦的问题,那就是为我搞砸了所有东西,即我无法在Z-shell上运行conda或pip。 因此,我正在尽早给大家解决此问题的方法。 就像〜/ .zshrc一样,我们的bash shell具有一个允许使用conda命令的文件,我们只需在zshrc文件中调用该文件即可。 因此,打开zshrc文件,并在其末尾复制以下代码:

source ~/.bash_profile

4. We will see how to use custom commands as permanent aliases in this section. I hope you have your ~/.zshrc open, if not open it using the command in step 1 (you may also use vim “vi” or “nano” just anything that edits text). Head over the part that says “Example aliases” right at the end of the file and makes an alias. The format is simple alias <name> = “<bash command>”

4.我们将在本节中了解如何将自定义命令用作永久别名。 我希望您打开〜/ .zshrc,如果没有使用步骤1中的命令将其打开(您也可以使用vim“ vi”或“ nano”编辑任何文本)。 转至文件末尾的“示例别名”部分,并创建一个别名。 格式为简单别名<名称> =“ <bash命令>”

# Example aliases# alias zshconfig="mate ~/.zshrc"# alias ohmyzsh="mate ~/.oh-my-zsh"# Alias to run dockeralias dk="docker ps"#Alias to show lyrics of current song (Needs swaglyrics installed)alias showlyrics="swaglyrics -c"

Now you can run dk and it will run docker ps or showlyrics to print lyrics of the spotify song playing (again, needs swaglyrics installed-just an example)

现在您可以运行dk,它将运行docker ps或showlyrics来打印Spotify歌曲播放的歌词(同样,需要安装swaglyrics-仅作为示例)

5. Now that you’re done with all the edits to the ~/.zshrc file hit Command+S to save it and head over to your iTerm2 to run this code and apply all the changes, alternatively you can restart the terminal and changes will apply automatically:

5.现在,您已经完成对〜/ .zshrc文件的所有编辑,请按Command + S保存并转到iTerm2来运行此代码并应用所有更改,或者您可以重新启动终端并进行更改将自动应用:

source ~/.zshrc

6. The last thing we will see is how to run bash commands in zsh, or chnage shells completely. Also if you screw up in the installation stage just run the command to uninstall ohmyzsh, it’s gonna be like a rest and you can start again. To run bash in Z-shell use the command:

6.我们将看到的最后一件事是如何在zsh或完全chnage shell中运行bash命令。 另外,如果您在安装阶段搞砸了,只需运行命令以卸载ohmyzsh,就好比休息了,您可以重新开始。 要在Z-shell中运行bash,请使用以下命令:

exec bash #executes bash shell

To change default shell completely (requires password and to restart terminal for changes to take place):

要完全更改默认外壳程序(需要密码并重新启动终端以进行更改):

chsh -s /bin/bash #zsh to bashchsh -s /bin/zsh  #bash to zsh

To uninstall oh my zsh and reset shell to bash to start over, simply run:

要卸载我的zsh并将shell重置为bash以重新开始,只需运行:

uninstall_oh_my_zsh #in the zsh shell#if this doesn't work remove the .ohmyzsh file from the root #directory itself before re-intsalling zshsudo rm -R "yourRootPath/.ohmyzsh"## if you screw up so bad you need to install zsh again:brew reinstall zsh

步骤5:更多自定义! (Step 5 : More Customisation !)

In this section, we will install Powerlevel10k, which is one of the fastest themes for the Z-shell and use Neofetch along with it which displays the PC details and distribution as shown in the image. Note that if you just came for neofetch (a lot of people do), you can also use neofetch with your bash shell, I will show you how. But using Zsh is a lot faster and easier once you start using the terminal a lot more.

在本部分中,我们将安装Powerlevel10k,它是Z-shell最快的主题之一,并与它一起使用Neofetch,它显示了PC的详细信息和分布,如图所示。 请注意,如果您只是来进行neofetch(很多人这样做),也可以将neofetch与bash shell一起使用,我将向您展示如何使用。 但是,一旦您开始更多地使用终端,使用Zsh就会更快,更容易。

功率水平10k (Powerlevel10k)

To clone your custom theme from its github repository into the /.ohmyzsh ’s custom themes directory run the following code in your terminal :

要将自定义主题从其github存储库克隆到/.ohmyzsh的自定义主题目录,请在终端中运行以下代码:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

After that’s done hopefully the theme has been downloaded into the directory. Now all you need to do is open the ~/.zshrc file and set the theme so that it opens as required (shown in step 4.1)

希望完成后,主题已下载到目录中。 现在,您需要做的就是打开〜/ .zshrc文件并设置主题,使其根据需要打开(如步骤4.1所示)。

open ~/. zshrc## Head over to ZSH_THEME in zshrc and paste this line instead:ZSH_THEME="powerlevel10k/powerlevel10k"##Save and run in terminal using source or restart.

When you open the terminal, Powerlevel10k’s built in installation guide will start. It may prompt you to download the Meslo Font (a powerline font), It’s not compulsory to do so. The rest of the steps are pretty self explanatory, just select the designs you like. The reason we were prompted to install powerline fonts (already shown in step 2.2) is because it supports powerline glyphs that make your shell look cool. However iTerm2 has it’s own built in powerline glyphs feature that you can enable in Text > Use built-in Powerline Glyphs, that is, if you did not download the fonts in step 2.2, which is fine.

当您打开终端时,Powerlevel10k的内置安装指南将启动。 它可能会提示您下载Meslo字体(电力线字体),这不是强制性的。 其余步骤很容易解释,只需选择所需的设计即可。 提示我们安装电源线字体的原因(已在步骤2.2中显示)是因为它支持使您的外壳看起来很酷的电源线字形。 但是,iTerm2具有它自己的内置电力线字形功能,可以在“文本”>“使用内置电力线字形”中启用该功能,也就是说,如果您没有在步骤2.2中下载字体,那很好。

After you’re done with the installation guide make sure to add this code in ~/.zshrc so that the setup guide doesn’t start everytime you start the iTerm2. If this was automatically added during the installation guide itself you may skip the step, so it’s worth checking in ~/.zshrc

在完成安装指南后,请确保将此代码添加到〜/ .zshrc中,以使安装指南不会在每次启动iTerm2时启动。 如果这是在安装指南本身中自动添加的,则可以跳过此步骤,因此值得在〜/ .zshrc中进行检查。

#open ~/.zshrc and head over to the end of the file to add:#to disable Powerline promptPOWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true#To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh#save and source ~/.zshrc in the terminal to save settings.

The setup for other custom themes are also fairly similar.

其他自定义主题的设置也非常相似。

Neofetch (Neofetch)

Neofetch is a command-line system information tool written in bash 3.2+. Neofetch displays information about your operating system, software and hardware in an aesthetic and visually pleasing way.

Neofetch是用bash 3.2+编写的命令行系统信息工具。 Neofetch以美观和美观的方式显示有关您的操作系统,软件和硬件的信息。

To install neofetch just simply run:

要安装neofetch,只需运行:

brew install neofetch ##if this does not work :#1. Clone the repogit clone https://github.com/dylanaraps/neofetch#2. go to the directorycd neofetch#3. install using make commandmake install##Or you can try pip install (if you followed step 4.3)

Now that this is done, you can just run the command “neofetch” in the terminal to display your Mac details along with the logo (which is also customisable). Again we need to save this in the ~/.zshrc file to make neofetch run everytime the Z-shell starts. This is simple as you just need to add neofetch to the end of ~/.zshrc and save the file, then use “source ~/.zshrc” command in the terminal to save settings.

既然完成了,您只需在终端中运行命令“ neofetch”即可显示Mac详细信息以及徽标(也可以自定义)。 同样,我们需要将其保存在〜/ .zshrc文件中,以便每次Z-shell启动时都能运行neofetch。 这很简单,因为您只需要在〜/ .zshrc的末尾添加neofetch并保存文件,然后在终端中使用“ source〜/ .zshrc”命令保存设置即可。

If you want to run neofetch with your bash shell as well:

如果您还想使用bash shell运行neofetch:

open ~/.bash_profile##Go to the end of the file and add the neofetch commandneofetch##save and exit the text editor and enter into the terminal:source ~/.bash_profile

NOTE : Since in this tutorial we are already running ~/. bash_profile in our ~/.zshrc, this may cause neofetch to run twice, it’s upto you to figure out which shell to use.

注意:由于在本教程中,我们已经在运行〜/。 我们的〜/ .zshrc中的bash_profile,这可能会导致neofetch运行两次,这取决于您确定要使用哪个shell。

Here’s the link to neofetch’s github repo if you want to play around some more and get some customisations to amp up your terminal’s looks (for expample adding a custom logo or image instead of the ASCII apple logo):

如果您想玩得更多,并获得一些自定义来增强终端的外观,这是neofetch的github存储库的链接(例如,添加自定义徽标或图像而不是ASCII苹果徽标):

You’re all set, happy hacking!

一切就绪,黑客入侵愉快!

翻译自: https://medium.com/unknownimous/the-most-hackle-free-guide-to-terminal-beautification-for-macos-a-crash-course-in-z-shell-6e57ab17ad5e

macos终端美化


http://www.taodudu.cc/news/show-3165782.html

相关文章:

  • react 添加css_在JS中使用情感CSS将暗模式添加到您的React应用中
  • vs2010最佳字体配色_2010年50个最佳Windows最佳做法文章
  • amaozn aws 设置_在aws上设置一个免费的piKong
  • 产品设计中重要的用户体验_为什么好的设计对任何产品都重要?
  • 黑客独角兽_写作是产品设计师真正的独角兽技能
  • 链接诱饵黑客大刀阔斧新闻点被认为有癌性要求采取行动
  • js 实现 不足为数 前 补0
  • qt QString数值转换格式化不足补0 QString十进制转换不足补0
  • js不足十位自动补0函数
  • C# 字符串不足位数补零
  • npm install 提示权限不足
  • DBeaver解决内存不足问题
  • 邯郸楼市金九银十成色不足
  • 进服务器显示系统缓冲区空间不足,由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作--解决方法...
  • Python 十进制转换为二进制 高位补零
  • c++ 怎么控制输出的两位数不足十的时候用零来补齐前面空余的位数
  • MySQL导入几十G数据后创建索引时提示空间不足(Errcode: 28 - No space left on device)
  • 十进制的转换与任意进制的互转
  • Solr JVM内存不足
  • ppt提示内存或系统资源不足_存储空间不足无法处理此命令是什么原因?内存够却提示空间不足...
  • 九章算数 七:《盈不足》
  • (三十) Ubuntu解决/boot 空间不足问题
  • 十、不足两位用0补齐
  • 爱思服务器显示磁盘空间不足,iPhone 11 有储存空间,但仍会提示“空间不足”怎么办?...
  • c语言输出不足10补0,c++ cout输出不足位补0 setw、setfill
  • pytorch用法笔记--不定期更新
  • python openpyxl库读写更新excel表格
  • 现代控制工程-状态空间(正在更新)
  • 《算法系列》之回溯
  • 【数据结构与算法】之深入解析“N皇后”的求解思路与算法示例

macos终端美化_关于macOS终端美化的最轻松的指南Z Shell中的速成课程相关推荐

  1. macos 终端下载_如何使用终端下载macOS更新

    macos 终端下载 Tired of opening the Mac App Store to install macOS updates? Use the Terminal instead. 厌倦 ...

  2. mac 设置终端样式_如何将终端样式设置为freeCodeCamp或任何您想要的样式

    mac 设置终端样式 "It's over 9,000!" That iconic line from the show Dragon Ball Z inspired the na ...

  3. mac 终端提示_有用的终端提示

    mac 终端提示 A while ago I started a thread on Twitter with a few terminal tips. There are lots of comma ...

  4. macos文本编辑器_适用于macOS的最佳免费照片编辑器

    macos文本编辑器 If you're a Mac-using professional photographer, you're probably already paying $10 a mon ...

  5. ubuntuv20启动界面美化_小米任务栏美化软件下载-小米任务栏美化插件最新版下载v1.1...

    小米任务栏美化软件,超级好用的手机状态栏美化工具,使用简单,您可以通过它一键设置手机状态栏,使得它更美观.富有个性.并且小米任务栏美化软件拥有多类免费的素材包,您可以自由挑选一个自己喜欢的进行自定义手 ...

  6. python编写网页美化_五 使用并美化网页文本

    属性值 说明 bold 定义粗体字体 bolder 定义更粗的字体,相对值 lighter 定义更细的字体,相对值 normal 默认值,标准字体 属性值 说明 normal 默认值. oblique ...

  7. python打开伪终端_关于 macOS 伪终端(PTY)的学习

    转载请注明来源 https://justinyan.me 1973 年 Xerox PARC 第一次在 Xerox Alto 这款个人计算机上推出带有 GUI 界面的操作系统,自此让极大地降低个人计算 ...

  8. ubuntu20 桌面美化换成macos桌面主题

    ubuntu20 桌面美化换成macos桌面主题 最近新安装的ubuntu,总感觉桌面不好看,换成macos主题,感觉一下子就出来了. 废话不多少,先上图看效果可以看到左侧不同文件类型的图标样式. 因 ...

  9. macOS系统(Linux同)终端输入操作的一些快捷操作!

    macOS系统(Linux同)终端输入的一些基本快捷操作! 首先打开电脑的终端页面 我们可以看到原始的终端界面,不论窗口还是字体都比较小,不方便我们的操作和指令的输入,我们可以先将进行以下两个操作 1 ...

最新文章

  1. VMP分析之VMP2.13插件化分析(四)
  2. 教你从0到1搭建秒杀系统-Canal快速入门(番外篇)
  3. 1 分钟 Serverless 极速抽盲盒,自己部署自己抽
  4. Extjs关于alert显示不出—异步问题
  5. 极客时间和极客学院_极客历史记录的本周:Twitter的诞生,OS X十周年以及太空停留时间最长的时代即将结束...
  6. ap计算机科学课程内容,AP计算机科学课程补习有哪些知识点梳理?
  7. 如何使用社会化媒体网络建立个人品牌(国外篇)
  8. 人脸识别的前世今生:从人工特征的百花齐放到深度学习的一统江湖
  9. java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
  10. Linux深度系统卡在开机界面,deepin开机卡死在logo页面解决方案
  11. 东方欲晓,莫道君行早。踏遍青山人未老,风景这边独好。
  12. 浅谈限流式保护器在充电线路中电气防火的应用
  13. Jmeter如何控制取样器执行顺序
  14. 【兴趣书签】科幻小说——《走出一日囚》
  15. 图学习推荐系统综述| Graph Learning Approaches to Recommender Systems
  16. JavaSE自学笔记013_Real(抽象类、接口、两种设计模式)
  17. 动态时间规整算法DTW
  18. [Swift]LeetCode334. 递增的三元子序列 | Increasing Triplet Subsequence
  19. 电子邮件营销七大案例
  20. PCIe设备驱动demo

热门文章

  1. android psp模拟器 怪物猎人,曾经狩猎的日子:安卓PSP模拟器评测:怪物猎人P3
  2. 岗位认识---算法工程师、数据分析
  3. 艾默生流量计基础知识
  4. 基于SMTP协议和POP3协议实现的邮件收发客户端
  5. 《现代通信原理》学习(一)绪论
  6. 计算机应用基础wOrd教学目标,计算机应用基础教案说课.doc
  7. 启动/关闭oracle服务有三种方式
  8. 截至2020年3月,所有与Android Auto兼容的汽车
  9. 24点算法 | 逆波兰表达式实现去重复
  10. python中的in ,not in来检查元素是不是在列表中