头图

their tools if they want to do their jobs well". Only with the tools that are easy to use can you give full play to your abilities, increase productivity and efficiency, and avoid ineffective overtime. Therefore, the "Sharp Tools" series will record my transformation of various tools and how I combined and applied them to achieve value.


This article mainly records my Terminal & Bash transformation. Terminal & Bash is the first and most frequently contacted place for all programmers in the new development environment. Therefore, here is the first article in the "Sharp Tool" series. give everyone.

Note: In the following content, the links related to downloading have all passed the domestic network optimization address, which is convenient for everyone to quickly download

Terminal :Windows Terminal

In Windows environment, I choose Windows Terminal

selection solve, that is, when using remote Tmux, you cannot use the mouse to select copy and paste. At the same time, Windows Terminal also has the function of not losing other terminal personalized configuration

Installation method : Directly search for "Windows Terminal" in the Microsoft App Store and install it.

Configuration

There are two configuration methods, one is interactive, and the other is to edit the configuration file setttings.json. It is recommended to use the interactive configuration method for the initial configuration. After the configuration is complete, the configuration file can be exported and backed up to a cloud disk for direct use in the future.

I mainly modified the font and font size. The font size is set to 14 for easy reading on the big screen. The font used is "FiraCode", which is a font for programming. The detailed introduction can be found here: FiraCode

The official download link of the font: FiraCode.zip

Alibaba Cloud download link:

"Firacode", click the link to save, or copy the content of this paragraph, open the "Alibaba Cloud Disk" APP, no need to download extremely fast online viewing, the original video is played at double speed. Link: https://www.aliyundrive.com/s/Wx5ZFrUhquY

Shell configuration

Because I usually connect to the server Ubuntu system remotely via SSH locally, therefore, only the Shell configuration under the Ubuntu environment will be discussed here.

Install ZSH

Under Ubuntu system, execute

sudo apt install -y zsh curl wget git tmux

Install Oh My Zsh

Oh My Zsh is Zsh's configuration manager, including the configuration of plug-ins, themes, etc., and has many practical functions by default, and integrates quite a lot of plug-ins (most of which are not enabled by default). Friends who are interested can enter its official website to get more More information:

Oh My Zsh - a delightful & open source framework for Zsh

Friends who want to know quickly, can look at its Cheatsheet:

https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet

Installation process

cd ~
wget https://pd.zwc365.com/https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
# 设置远端地址为github镜像地址
Export REMOTE=https://hub.fastgit.org/ohmyzsh/ohmyzsh.git
sh install.sh

Install starship

sh -c "$(curl -fsSL https://pd.zwc365.com/https://starship.rs/install.sh)" -- -B https://hub.fastgit.org/starship/starship/releases
echo 'eval "$(starship init zsh)"' >> ~/.zshrc

Install Shell syntax highlighting plugin

Plug-in address:

Fast Syntax Highlighting (F-Sy-H)

Effect preview:

https://pic1.zhimg.com/v2-f5e23c855f18f66809237e5bf31ec798_b.png

installation steps:

  1. Excuting an order:
git clone https://hub.fastgit.org/zdharma-continuum/fast-syntax-highlighting.git \
  ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
  1. Open the ~/.zshrc file, find plugins , add the fast-syntax-highlighting plug-in
 plugins=(git fast-syntax-highlighting)
  1. Activate the ZSH configuration, execute the command
source ~/.zshr

Install Shell auto-complete plug-in

Effect preview:

https://asciinema.org/a/37390

  1. Download plugin
git clone https://hub.fastgit.org/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  1. Add plugin

Open the ~/.zshrc and find plugins

 plugins=(git fast-syntax-highlighting zsh-autosuggestions)
  1. Activate the plugin
source ~/.zshrc

Tmux

Tmux is a powerful terminal multiplexer (this translation is a bit useless). In layman's terms, the program running in the terminal will not be disconnected even when the SSH remote connection is closed.

For the basic introduction and use of Tmux, you can refer to Ruan Yifeng's blog, the link is here:

Tmux tutorial-Ruan Yifeng's network log

Tmux configuration file Oh My Tmux

Effect preview:

https://pic3.zhimg.com/v2-a373906b98b5ed7cfadb506017c27eea_b.png

The installation command is as follows:

cd
git clone https://hub.fastgit.org/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .

After the installation is complete, you can see the new interface when you enter Tmux

I use more shortcut keys:

  1. Added C-a as the second choice of Cb (from the perspective of key position, C-a more convenient)
  2. <prefix> m bind mouse mode
  3. <prefix> - Split the current panel vertically
  4. <prefix> _ Split the current panel horizontally

For a more detailed introduction, you can go to the author's github page to understand, the link is as follows:

https://github.com/gpakosz/.tmux


The above is the whole process of the transformation of Terminal and Shell. I hope this article can help you improve efficiency in the terminal interface.

Of course, this is not the end of the transformation. The related tools and plug-ins are actually very complicated, and there are many places worthy of further exploration. I am just using these tools as the tip of the iceberg.

I will gradually add some targeted environment configuration and tool usage tutorials in future articles.

If you want to recommend the tools you use, please leave a message in the comment area, and I will update the recommended content to the article.


Title Picture Photo by Andrew Svk on Unsplash

Reference article: https://tjay.dev/howto-my-terminal-shell-setup-hyper-js-zsh-starship/


方文达
107 声望9 粉丝

AI算法工程师