给matrix重新列名_如何认真升级Mac终端(甚至给它一个Matrix主题)
給matrix重新列名
by Marcus Gardiner
通過(guò)馬庫(kù)斯·加德納(Marcus Gardiner)
如何認(rèn)真升級(jí)Mac終端(甚至給它一個(gè)Matrix主題) (How to seriously upgrade your Mac terminal (and even give it a Matrix theme))
藍(lán)色藥丸,紅色藥丸和通往極樂(lè)世界的3個(gè)步驟 (A Blue Pill, a Red Pill and 3 Steps to Terminal Bliss)
您的Mac Terminal當(dāng)前是否看起來(lái)像這樣->(換句話說(shuō),有點(diǎn)爛)? (Does your Mac Terminal currently look like this -> (in other words, it kinda sucks)?)
您是否希望它看起來(lái)像這樣->(或者,您知道,壞蛋)? (Do you want it to look like this -> (or, ya know, badass)?)
或者更現(xiàn)實(shí)地->(實(shí)際上更棒)……像這樣? (Or more realistically -> (and actually more awesome)…like this?)
Still looks badass, and it’s now usable and able to run a load of extra useful features that will save you time and make you feel like a next-level coder (whether or not you stick to the Matrix color scheme).
看起來(lái)仍然很糟,它現(xiàn)在可以使用并且能夠運(yùn)行許多額外的有用功能,這些功能可以節(jié)省您的時(shí)間,并使您感覺(jué)像是下一個(gè)編碼器 (無(wú)論您是否堅(jiān)持使用Matrix配色方案)。
現(xiàn)在,請(qǐng)注意,讓我們一起學(xué)習(xí)。 (Now that I have your attention, let’s learn together.)
My promise to you, dear reader, is that I will write in plain English as best I can to take you on this glorious fact-finding mission. I myself am at the beginning of my coding journey, but that does not mean we cannot accomplish great and important things (like avoiding actually learning how to code by working out how to make every damn thing look like the Matrix, and maybe accidentally learning something about code in the process).
親愛(ài)的讀者,我對(duì)您的承諾是,我將竭盡全力以純正的英語(yǔ)來(lái)帶您完成這一光榮的實(shí)況調(diào)查任務(wù)。 我本人正處于我的編碼旅程的開(kāi)始,但這并不意味著我們無(wú)法完成偉大而重要的事情(例如避免通過(guò)制定使每件該死的東西看起來(lái)像矩陣而避免實(shí)際學(xué)習(xí)編碼的方法,也許是偶然地學(xué)習(xí)了一些東西)關(guān)于過(guò)程中的代碼)。
對(duì)于初學(xué)者:什么是Mac上的Terminal? (For the uninitiated: what is Terminal on Mac?)
Normally you clickity-click around your screen with a keyboard and mouse to do fun things on your computer. With Terminal (a normal application that comes with your Mac), you command your computer to do things instead using the power of typing on your keyboard.
通常,您單擊并單擊鍵盤(pán)和鼠標(biāo)即可在屏幕上單擊,以在計(jì)算機(jī)上做一些有趣的事情。 使用Terminal(Mac隨附的普通應(yīng)用程序),您可以命令計(jì)算機(jī)執(zhí)行操作,而不是使用鍵盤(pán)上的鍵入功能。
These can be simple things like creating a new folder by typing “mkdir <foldername>”, up to all-powerful things like forcing your computer to make you a sandwich:
這些可能很簡(jiǎn)單,例如通過(guò)鍵入“ mkdir <foldername>”來(lái)創(chuàng)建新文件夾,而最強(qiáng)大的功能例如是強(qiáng)迫計(jì)算機(jī)為您做一個(gè)三明治:
Now that is cleared up, how do we make Terminal awesome?
現(xiàn)在已經(jīng)清除了,我們?nèi)绾问筎erminal很棒?
藍(lán)丸或紅丸… (The Blue Pill or the Red Pill…)
As I am sure you expected in a blog post of loose and fast Matrix references, there are two choices. The blue pill is easy and you will be done lickety-split in less than three minutes. The red pill is more exciting, enthralling, and has a vastly higher ceiling — for which we will need to leverage far more of your precious neurons.
正如我確定的那樣,您在有關(guān)寬松和快速M(fèi)atrix引用的博客文章中期望過(guò),有兩種選擇。 藍(lán)色藥丸很容易,您將在不到三分鐘的時(shí)間內(nèi)完成自由分裂。 紅色藥丸更令人著迷,令人著迷,并且具有更高的上限-為此,我們將需要利用更多的寶貴神經(jīng)元。
藍(lán)丸 (The Blue Pill)
For the blue pill, here are some quick and easy steps to have your terminal make Neo proud:
對(duì)于藍(lán)色藥丸,可通過(guò)以下快速簡(jiǎn)便的步驟使您的終端機(jī)讓Neo感到驕傲:
[1] Open Terminal via the Spotlight search function - Command ? + Space, “Terminal”
[1]通過(guò)Spotlight搜索功能打開(kāi)終端 -Command?+空格,“ Terminal”
[2] Open Terminal preferences: change profile to “Homebrew,” including on startup- Terminal, Preferences, General -> New window with profile -> Homebrew- Terminal, Preferences, Profiles -> Homebrew -> Click “Default” in the bottom left
[2]打開(kāi)“終端”偏好設(shè)置:將配置文件更改為“自制”,包括在啟動(dòng)時(shí) - 終端,首選項(xiàng),常規(guī)->帶有配置文件的新窗口-> Homebrew-終端,首選項(xiàng),配置文件-> Homebrew->單擊左下方的“默認(rèn)”
[3] Restart Terminal
[3]重新啟動(dòng)終端
You should now have a niiiccceee Matrix-esque terminal, like the below:
您現(xiàn)在應(yīng)該擁有一個(gè)niiiccceee Matrix式終端,如下所示:
That Blue Pill was delicious and easy. Now for the Red Pill.
那個(gè)藍(lán)色藥丸既美味又容易。 現(xiàn)在換紅色藥丸。
紅色藥丸 (The Red Pill)
This is for the over-achievers, the crazy ones, the truth-seekers. After it, your terminal code won’t just look like the Matrix, it will do all-powerful things. You may never be the same coder again…
這是為那些過(guò)分成就的人,瘋狂的人,尋求真相的人準(zhǔn)備的。 在此之后,您的終端代碼將不僅看起來(lái)像矩陣,而且將執(zhí)行所有功能。 您可能再也不會(huì)是同一位編碼員了……
All it will take is three steps:[1] Badassify your Terminal[2] Make it Matrix[3] Power-level your Terminal
它只需要三個(gè)步驟: [1]破壞您的終端 [2]使其成為矩陣 [3]對(duì)您的終端進(jìn)行功率級(jí)
第1步,共3步:對(duì)您的終端進(jìn)行惡意分類 (Step 1 of 3: Badassify your terminal)
First things first, we need to empower your terminal to do awesome things, including:
首先,我們需要授權(quán)您的終端執(zhí)行很棒的事情,包括:
Installing iTerm: a better version of Terminal (check out the awesome features from splitting panes to intelligent search terminal searching by clicking here)
安裝iTerm : Terminal的更好版本(單擊此處 ,查看從拆分窗格到智能搜索終端搜索的強(qiáng)大功能)
Changing shell from “bash” to the more flexible and powerful “zsh” (The shell is like the software your terminal application is running. It takes your keyboard commands in terminal and gives them to the computer to perform.)
將外殼程序從“ bash”更改為更靈活,功能更強(qiáng)大的“ zsh” (外殼程序類似于您的終端應(yīng)用程序正在運(yùn)行的軟件。它將終端中的鍵盤(pán)命令帶給計(jì)算機(jī),以供執(zhí)行。)
Install “oh-my-zsh,” which will super-charge your zsh shell (that is, it is a community-driven framework for managing your zsh configuration)
安裝“ oh-my-zsh ”,它將為您的zsh shell增添力量 (即,這是一個(gè)由社區(qū)驅(qū)動(dòng)的框架,用于管理zsh配置)
Bonus powers: syntax highlighting (shows you whether your command will run before you run it) and z terminal navigation (makes navigating the terminal much faster by estimating the folder you want to switch to using “frecency”)
附加功能:語(yǔ)法高亮顯示 (顯示命令是否在運(yùn)行之前運(yùn)行)和z終端導(dǎo)航 (通過(guò)使用“ frefency”估計(jì)要切換到的文件夾,可以更快地導(dǎo)航終端)
To empower your terminal with all the above, follow this excellent guide by Jilles Soeters: Baddassify your terminal and come back for Steps 2 and 3.
要使您的終端具備以上所有功能,請(qǐng)遵循Jilles Soeters的出色指南: Baddassify您的終端 然后返回步驟2和3。
很高興你回來(lái) (Glad to have you back)
Now its time to take your newly-badassified terminal and fully ingest that Red Pill…
現(xiàn)在是時(shí)候采取您新近陷入困境的終端并充分?jǐn)z取該Red Pill…
第2步,共3步:使其成為矩陣 (Step 2 of 3: Make it Matrix)
Thankfully some kind soul (Robert Dempsey) has already exported a full Matrix color scheme for iTerm, so all we need to do is import it!
值得慶幸的是,一些善良的靈魂(Robert Dempsey)已經(jīng)為iTerm導(dǎo)出了完整的Matrix配色方案,因此我們需要做的就是導(dǎo)入它!
Of course if the Matrix color theme doesn’t take your fancy, feel free to use a default and skip to step 3!
當(dāng)然,如果Matrix顏色主題不受歡迎,請(qǐng)隨意使用默認(rèn)值并跳至步驟3!
[1] Download the color scheme code from this link and move the folder to an easy place to access- Click: “Download Zip”- Create a folder on your Desktop called “iTermThemes”- Move the file “matrix_color_scheme_iterm2” to the iTermThemes folder (not the whole folder, only the file)
[1]從此鏈接下載配色方案代碼,然后將文件夾移至易于訪問(wèn)的位置 -單擊:“下載Zip”-在桌面上創(chuàng)建一個(gè)名為“ iTermThemes”的文件夾-將文件“ matrix_color_scheme_iterm2”移至iTermThemes文件夾(不是整個(gè)文件夾,只有文件)
[2] Open Terminal and change to the directory where you moved the file- Use the change directory (cd) command to change to the folder where you have the filecd Desktop/iTermThemes
[2]打開(kāi)終端,然后切換到文件移動(dòng)的目錄 -使用change directory(cd)命令切換到文件cd Desktop/iTermThemes的文件cd Desktop/iTermThemes
[3] Now that you are in the correct directory (folder) in Terminal, copy paste the following code into Terminal to run it: for f in *; do THEME=$(basename "$f") defaults write -app iTerm 'Custom Color Presets' -dict-add "$THEME" "$(cat "$f")"done
[3]現(xiàn)在您已經(jīng)在Terminal中的正確目錄(文件夾)中,將以下代碼復(fù)制粘貼到Terminal中以運(yùn)行它: for f in * ; do f in * ; do THEME =$( basename "$f" ) THEME =$( basename "$f" ) defaults write -app iTerm 'Custom Color Presets' -dict-add "$THEME" " $( cat "$f" ) " done
This code runs through each of the color codes in the file (using “for…”)and saves the result as “matrix_color_scheme_2” in the Custom colors in iTerm (Example of a color: ‘Selected Text Color’ = { ‘Blue Component’ = ‘1.000000’; ‘Green Component’ = ‘1.000000’; ‘Red Component’ = ‘1.000000’)
該代碼遍歷文件中的每個(gè)顏色代碼(使用“ for…”),并將結(jié)果保存為iTerm中“自定義顏色”中的“ matrix_color_scheme_2”(顏色示例: “選定的文本顏色” = {“藍(lán)色成分” ='1.000000';'綠色組件'='1.000000';'紅色組件'='1.000000')
[4] Update iTerm preferences to use the new Matrix color scheme- iTerm2, Preferences, Profiles, Colors, Color Presets, “matrix_color_scheme_iterm2”
[4]更新iTerm首選項(xiàng)以使用新的矩陣顏色方案 -iTerm2,首選項(xiàng),配置文件,顏色,顏色預(yù)設(shè),“ matrix_color_scheme_iterm2”
您的終端現(xiàn)在應(yīng)該像這樣: (Your Terminal should now feel like this:)
第3步(共3步):對(duì)終端進(jìn)行功率電平 (Step 3 of 3: Power-level your terminal)
There is more?! Indeed there is more, you want your terminal to be the talk of the town, right?
還有更多?! 確實(shí)還有更多,您希望您的終端成為小鎮(zhèn)的話題,對(duì)嗎?
The next step is to pimp your terminal with Powerlevel9k by Ben Hilburn, giving it fancy symbols and customisable gizmos with an out-of-the-box configuration. These visual cues are actually super useful in saving space and understanding your live environment, like what directory you are in, what Git branch you are on, and even how long your code took to run.
下一步是使用Ben Hilburn的Powerlevel9k來(lái)修飾您的終端,并使用即裝即用的配置為其提供精美的符號(hào)和可自定義的小控件。 這些視覺(jué)提示實(shí)際上對(duì)于節(jié)省空間和了解您的實(shí)時(shí)環(huán)境非常有用,例如您所在的目錄,您所在的Git分支,甚至代碼運(yùn)行了多長(zhǎng)時(shí)間。
Before we begin, some background knowledge: - “Powerlevel9k” is a theme for Oh-My-Zsh - For the symbols to appear properly, you also need to install a “Powerline” font (a font that includes a set of symbols, like how wingdings has symbols, but with actual letters too)
在我們開(kāi)始之前,有一些背景知識(shí): -“ Powerlevel9k”是Oh-My-Zsh的主題 -為了使符號(hào)正確顯示,您還需要安裝“ Powerline ” 字體 (一種包含一組符號(hào)的字體,例如wingdings如何具有符號(hào),但也帶有實(shí)際字母)
為Oh-My-ZSH安裝Powerlevel9k主題 (Install Powerlevel9k theme for Oh-My-ZSH)
[1] Copy this code into your terminal, which will clone the Powerlevel9k repository into your Oh-My-Zsh custom themes directory.
[1]將此代碼復(fù)制到您的終端,這會(huì)將Powerlevel9k存儲(chǔ)庫(kù)克隆到您的Oh-My-Zsh自定義主題目錄中。
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k[2] You then need to choose this theme in Oh-My-Zsh by editing the profile file[i] Open the profile file in the text editor “nano” by typing the following into your terminal: nano ~/.zshrc
[2]然后,您需要通過(guò)編輯配置文件來(lái)選擇哦,MY-巖組這個(gè)主題[I]打開(kāi)文本編輯器“納米”通過(guò)輸入配置文件下到你的終端: nano ~/.zshrc
[ii] Find the part of the file withZSH_THEME="<theme_name>" …and replace it with (important: no spaces)ZSH_THEME="powerlevel9k/powerlevel9k"
[ii]使用ZSH_THEME="<theme_nam e>”找到文件的一部分,并替換為(重要:無(wú)ZSH_THEME="powerlevel9k/powerle aces) ZSH_THEME="powerlevel9k/powerle vel9k”
Note: You can navigate around the “nano” text editor using your arrow keys and type straight into it (much easier than VIM, if you have ever used that!).
注意:您可以使用箭頭鍵在“ nano”文本編輯器中導(dǎo)航并直接鍵入它(如果您曾經(jīng)使用過(guò),則比VIM容易得多!)。
[iii] To save the change and exit the Nano text editor:- Ctrl-x (i.e. ^x)- Y (this saves the change)
[iii]保存更改并退出Nano文本編輯器:-Ctrl-x(即^ x)-Y(保存更改)
Now… the final step
現(xiàn)在……最后一步
安裝并選擇電力線字體 (Install and select Powerline fonts)
Installing the standard Powerline fonts is thankfully very easy!
幸運(yùn)的是,安裝標(biāo)準(zhǔn)Powerline字體非常容易!
[1] By running the following code, you will clone the Powerline repository to your computer and install the fonts all in one easy step (you can keep the comments in).
[1]通過(guò)運(yùn)行以下代碼,您可以將Powerline存儲(chǔ)庫(kù)克隆到您的計(jì)算機(jī),并在一個(gè)簡(jiǎn)單的步驟中全部安裝字體(您可以保留注釋)。
# clonegit clone https://github.com/powerline/fonts.git --depth=1# installcd fonts./install.sh# clean-up a bitcd ..rm -rf fonts[2] Select a Powerline font in iTerm preferences- iTerm, Preferences, Profiles, Text, Change Font, *Select Meslo LG M for Powerline*
[2]在iTerm首選項(xiàng)中選擇Powerline字體-iTerm,首選項(xiàng),配置文件,文本,更改字體,*為Powerline選擇Meslo LG M *
剩下的就是感受新終端的力量 (All that is left is to FEEL THE POWER of your new Terminal)
如果我告訴你...那僅僅是個(gè)開(kāi)始 (What if I told you… that this is only the beginning)
I highly recommend continuing to play around with the powers of iTerm, Oh-My-Zsh and Powerlevel9k. It is a great practical way to learn more about Terminal while super-charging it.
我強(qiáng)烈建議繼續(xù)使用iTerm , Oh-My-Zsh和Powerlevel9k的功能 。 在對(duì)終端進(jìn)行超級(jí)充電的同時(shí)了解更多有關(guān)終端的信息,這是一種非常實(shí)用的方法。
There are a ton of settings, customisation options, and plugins so you can get your Terminal looking and behaving exactly as you want it to with a bunch of awesome features.
有大量的設(shè)置,自定義選項(xiàng)和插件,因此您可以通過(guò)一系列令人敬畏的功能使您的終端看起來(lái)和行為完全像您想要的那樣。
An easy win I found was adding the following code to your zshrc file. Type it into Terminal nano ~/.zshrc) just before the “ ZSH_Theme” line. This shortens the file-paths shown on each line and saves some room for your code itself.
我發(fā)現(xiàn)一個(gè)簡(jiǎn)單的選擇就是將以下代碼添加到您的zshrc文件中。 它輸入到終端nano ~/.zshrc)只是“ZSH_Theme”行之前。 這樣可以縮短每行顯示的文件路徑,并為代碼本身節(jié)省一些空間。
#Shorten directory shownPOWERLEVEL9K_SHORTEN_DIR_LENGTH=1POWERLEVEL9K_SHORTEN_DELIMITER=””P(pán)OWERLEVEL9K_SHORTEN_STRATEGY=”truncate_from_right”#Set default user to avoid showing 'user' on every lineDEFAULT_USER=”whoami”Of course, you can also choose alternative colour schemes for your Terminal if your grow tired of green. Just know, you may upset Morpheus.
當(dāng)然,如果您厭倦了綠色,也可以為終端選擇其他配色方案。 只是知道,您可能會(huì)讓Morpheus感到不安。
I hope you enjoy your new Badass Matrix Terminal and, if you enjoyed this blog post, (my first ever!), feel free to click ‘Follow’ and give me a few Claps by clicking the beautiful Medium claps button below ?
希望您喜歡您的新Badass Matrix Terminal,并且,如果您喜歡這篇博客文章(我有史以來(lái)第一次!),請(qǐng)隨時(shí)單擊“關(guān)注”,并通過(guò)單擊下面漂亮的中號(hào)拍手按鈕給我一些拍手?
Click here for my next post: “How to become a code-learning super NINJA”
單擊此處查看我的下一篇文章:“如何成為學(xué)習(xí)代碼的超級(jí)NINJA”
翻譯自: https://www.freecodecamp.org/news/how-to-make-a-badass-matrix-terminal-and-maybe-learn-something-about-code-8abc81c6b7a2/
給matrix重新列名
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的给matrix重新列名_如何认真升级Mac终端(甚至给它一个Matrix主题)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 孕妇梦到金鱼是什么意思
- 下一篇: code warri_我参加了有史以来的