Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize mac-item2-oh-my-zsh

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to realize mac-item2-oh-my-zsh". In daily operation, I believe many people have doubts on how to realize mac-item2-oh-my-zsh. I have consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts of "how to realize mac-item2-oh-my-zsh"! Next, please follow the small series to learn together!

1. Introduction to ITerm2 1. Installation

iTerm2 is a completely free command-line app for Mac OS users. Download and install it directly from http://www.example.com on the official websiteiterm2.com/

2. configured

Set ITerm as default terminal

II. Install oh-my-zsh1. Check how many shells the system has

cat /etc/shells

echo this

/bin/bash

/bin/csh

/bin/ksh

/bin/sh

/bin/tcsh

/bin/zsh

bash is the shell that comes with terminal in mac, replace it with zsh, which has much more features. Has syntax highlighting, command line tab completion, automatic prompt, display Git repository status and other functions.

Use the following command to set the default shell

chsh -s /bin/zsh

2. Install oh-my-zsh

Github address: github.com/robbyrussell/oh-my-zsh

Using crul to install:

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

3. theme

After successful installation, use vim ~/.zshrc to open hidden files and modify the theme to agnostor

PS: zsh theme, refer to the theme link to choose your favorite theme.

ZSH_THEME="agnoster"

Application of this theme requires special font support, otherwise there will be garbled situation, then we configure the font:

1. To use Meslo font, click on the link and click view raw to download the font.

2. Install fonts into the system font book.

3. Apply font to iTerm2 and set the font size you like to look comfortable with, which I set to 14px (iTerm -> Preferences -> Profiles -> Text -> Change Font).

4. Set color scheme

After setting the theme through oh-my-zsh, use ITerm2 with several background colors to show uncomfortable, download other color schemes are more beautiful. I chose solarized and it worked well. Click on the official website, download, extract, and then open the preferences under iTerm2, click on the colors option under profiles, click on the Color Presets option in the lower right corner, select import, and import Solarized Dark.itermcolors under the decompressed file. This solarized will also be used later when coloring vim.

At this point our terminal looks great, so let's install other plug-ins to make it look even better.

5. autoprompt command

When we enter commands, the terminal will automatically prompt you for the next possible commands, then press → to output these commands, very convenient.

Settings are as follows:

1. Clone the repository to the local ~/.oh-my-zsh/custom/plugins path

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

2. Open the file with vim ~/.zshrc, slide down to find the plug-in settings command, the default is plugins=(git), we modify it to

plugins=(zsh-autosuggestions git)

3. Re-open the terminal window.

4. syntax highlighting

1. Install the zsh-syntax-highlighting plugin using homebrew.

brew install zsh-syntax-highlighting

2. vim ~/.zshrc configuration file, insert a line, save exit.

source /usr/local/Cellar/zsh-syntax-highlighting/0.6.0/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

PS: The above path is the path after brew successfully installed the plug-in. It will be displayed after successful installation. Copy and record it.

3. Enter the command.

source ~/.zshrc

PS: Install Homebrew Package Management Tool:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Display effect after installation

III. Coloring Vim in ITerm

It is best to keep the color of Vim consistent with the color of the terminal, otherwise it will be awkward to use the command line Vim in Terminal/iTerm2.

First download solarized, download method and address above. execute the following command

$ cd solarized

$ cd vim-colors-solarized/colors

$ mkdir -p ~/.vim/colors

$ cp solarized.vim ~/.vim/colors/

$ vi ~/.vimrc

Add the following three lines of settings

syntax enable

set background=dark

colorscheme solarized

display effect

IV. Coloring ITerm2 with ls

1. Download Coreutils

brew install coreutils

2. Create a color profile

gdircolors --print-database > ~/.dir_colors

3. Enable color profiles

sudo vim ~/.zshrc

Add as follows

if brew list | grep coreutils > /dev/null ; then PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH">

At this point, the study of "how to implement mac-item2-oh-my-zsh" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report