zsh 主题 自定义_10个Zsh技巧和窍门:配置,自定义和用法

2024-01-15 21:59

本文主要是介绍zsh 主题 自定义_10个Zsh技巧和窍门:配置,自定义和用法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

zsh 主题 自定义

As web developers, the command line is becoming an ever more important part of our workflow. We use it to install packages from npm, to test API endpoints, to push commits to GitHub, and lots more besides.

作为Web开发人员,命令行正在成为我们工作流程中越来越重要的部分。 我们使用它来从npm安装软件包,测试API端点,将提交推送到GitHub等。

My shell of choice is zsh. It is a highly customizable Unix shell, that packs some very powerful features such as killer tab completion, clever history, remote file expansion, and much more.

我选择的外壳是zsh 。 它是一个高度可定制的Unix shell,其中包含一些非常强大的功能,例如杀手级选项卡完成,巧妙的历史记录,远程文件扩展等等 。

In this article I’ll show you how to install zsh, then offer ten tips and tricks to make you more productive when working with it.

在本文中,我将向您展示如何安装zsh,然后提供十个技巧和窍门,使您在使用它时工作效率更高。

This is a beginner-level guide which can be followed by anybody (even Windows users, thanks to Windows Subsystem for Linux). However, in light of Apple’s announcement that zsh is now the standard shell on macOS Catalina, mac users might find it especially helpful.

这是一个入门级指南,任何人(即使Windows用户,也要感谢Linux的Windows子系统)都可以遵循。 但是,鉴于苹果公司宣布zsh现在是macOS Catalina上的标准外壳 ,mac用户可能会发现它特别有用。

Let’s get started.

让我们开始吧。

安装 (Installation)

I don’t want to offer in-depth installation instructions for each operating system, rather some general guidelines instead. If you get stuck installing zsh, there is plenty of help available online.

我不想为每个操作系统提供深入的安装说明,而是提供一些常规指导。 如果您在安装zsh时遇到问题,可以在线获得大量帮助。

At the time of writing the current zsh version is 5.7.1.

在撰写本文时,当前的zsh版本是5.7.1。

苹果系统 (macOS)

Most versions of macOS ship with zsh pre-installed. You can check if this is the case and if so, which version you are running using the command: zsh --version. If the version is 4.3.9 or higher, you should be good to go (we’ll need at least this version to install Oh My Zsh later on). If not, you can follow this guide to install a more recent version of zsh using homebrew.

大多数版本的macOS都预装了zsh。 您可以使用命令zsh --version来检查是否是这种情况,以及正在运行的是哪个版本。 如果版本为4.3.9或更高版本,那么您应该可以使用(我们至少需要此版本才能安装Oh My Zsh)。 如果没有,您可以按照本指南使用自制软件安装zsh的最新版本。

Once installed, you can set zsh as the default shell using: chsh -s $(which zsh). After issuing this command, you’ll need to log out, then log back in again for the changes to take effect.

安装后,可以使用以下命令将zsh设置为默认外壳: chsh -s $(which zsh) 。 发出此命令后,您需要注销,然后重新登录以使更改生效。

If at any point you decide you don’t like zsh, you can revert to Bash using: chsh -s $(which bash).

如果您在任何时候都不喜欢zsh,可以使用chsh -s $(which bash)还原为Bash。

的Linux (Linux)

On Ubuntu-based distros, you can install zsh using: sudo apt-get install zsh. Once the installation completes, you can check the version using zsh --version, then make zsh your default shell using chsh -s $(which zsh). You’ll need to log out, then log back in for the changes to take effect.

在基于Ubuntu的发行版上,可以使用以下sudo apt-get install zsh安装zsh: sudo apt-get install zsh 。 安装完成后,可以使用zsh --version检查版本,然后使用chsh -s $(which zsh)将zsh设置为默认外壳。 您需要注销,然后重新登录以使更改生效。

As with macOS, you can revert back to Bash using: chsh -s $(which bash).

与macOS一样,您可以使用chsh -s $(which bash)恢复到Bash。

If you are running a non-Ubuntu based distro, then check out the instructions for other distros.

如果您运行的不是基于Ubuntu的发行版,请查看有关其他发行版的说明 。

视窗 (Windows)

Unfortunately, this is where things start to get a little complicated. Zsh is a Unix shell and for it to work on Windows, you’ll need to activate Windows Subsystem for Linux (WSL), an environment in Windows 10 for running Linux binaries.

不幸的是,这里的事情开始变得有些复杂。 Zsh是Unix shell,要使其在Windows上运行,您需要激活Windows子系统Linux(WSL) ,这是Windows 10中用于运行Linux二进制文件的环境。

There are various tutorials online explaining how to get up and running with zsh in Window 10s. I found these two to be up-to-date and easy to follow:

在线上有各种教程,介绍了如何在Window 10s中使用zsh进行启动和运行。 我发现这两个是最新的,易于遵循:

  • How to Install and Use the Linux Bash Shell on Windows 10 – follow this one first to install WSL

    如何在Windows 10上安装和使用Linux Bash Shell –首先按照此步骤安装WSL

  • How to Use Zsh (or Another Shell) in Windows 10 – follow this one second to install zsh

    如何在Windows 10中使用Zsh(或另一个Shell) –请花一秒钟的时间安装zsh

Note that it is also possible to get zsh running with Cygwin. Here are instructions for doing that.

注意,也可以使zsh与Cygwin一起运行 。 这是执行此操作的说明 。

第一次运行 (First Run)

When you first open zsh, you’ll be greeted by the following menu.

首次打开zsh时,以下菜单将为您打招呼。

Zsh first run menu

If you select (1) you’ll be taken to a menu that allows you to configure history, keybindings and a bunch of other things. However, I suggest selecting (2) which will create a configuration profile with the recommended default settings.

如果选择(1)您将进入一个菜单,该菜单可让您配置历史记录,键绑定和其他内容。 但是,我建议选择(2) ,它将使用建议的默认设置创建一个配置文件。

查找配置文件 (Locating the Configuration File)

Now let’s have a look at the file that zsh just created. Enter your home directory and open the

这篇关于zsh 主题 自定义_10个Zsh技巧和窍门:配置,自定义和用法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/610342

相关文章

Java字符串操作技巧之语法、示例与应用场景分析

《Java字符串操作技巧之语法、示例与应用场景分析》在Java算法题和日常开发中,字符串处理是必备的核心技能,本文全面梳理Java中字符串的常用操作语法,结合代码示例、应用场景和避坑指南,可快速掌握字... 目录引言1. 基础操作1.1 创建字符串1.2 获取长度1.3 访问字符2. 字符串处理2.1 子字

Java Optional的使用技巧与最佳实践

《JavaOptional的使用技巧与最佳实践》在Java中,Optional是用于优雅处理null的容器类,其核心目标是显式提醒开发者处理空值场景,避免NullPointerExce... 目录一、Optional 的核心用途二、使用技巧与最佳实践三、常见误区与反模式四、替代方案与扩展五、总结在 Java

Linux内核参数配置与验证详细指南

《Linux内核参数配置与验证详细指南》在Linux系统运维和性能优化中,内核参数(sysctl)的配置至关重要,本文主要来聊聊如何配置与验证这些Linux内核参数,希望对大家有一定的帮助... 目录1. 引言2. 内核参数的作用3. 如何设置内核参数3.1 临时设置(重启失效)3.2 永久设置(重启仍生效

IDEA自动生成注释模板的配置教程

《IDEA自动生成注释模板的配置教程》本文介绍了如何在IntelliJIDEA中配置类和方法的注释模板,包括自动生成项目名称、包名、日期和时间等内容,以及如何定制参数和返回值的注释格式,需要的朋友可以... 目录项目场景配置方法类注释模板定义类开头的注释步骤类注释效果方法注释模板定义方法开头的注释步骤方法注

如何在Mac上安装并配置JDK环境变量详细步骤

《如何在Mac上安装并配置JDK环境变量详细步骤》:本文主要介绍如何在Mac上安装并配置JDK环境变量详细步骤,包括下载JDK、安装JDK、配置环境变量、验证JDK配置以及可选地设置PowerSh... 目录步骤 1:下载JDK步骤 2:安装JDK步骤 3:配置环境变量1. 编辑~/.zshrc(对于zsh

C#中async await异步关键字用法和异步的底层原理全解析

《C#中asyncawait异步关键字用法和异步的底层原理全解析》:本文主要介绍C#中asyncawait异步关键字用法和异步的底层原理全解析,本文给大家介绍的非常详细,对大家的学习或工作具有一... 目录C#异步编程一、异步编程基础二、异步方法的工作原理三、代码示例四、编译后的底层实现五、总结C#异步编程

售价599元起! 华为路由器X1/Pro发布 配置与区别一览

《售价599元起!华为路由器X1/Pro发布配置与区别一览》华为路由器X1/Pro发布,有朋友留言问华为路由X1和X1Pro怎么选择,关于这个问题,本期图文将对这二款路由器做了期参数对比,大家看... 华为路由 X1 系列已经正式发布并开启预售,将在 4 月 25 日 10:08 正式开售,两款产品分别为华

python3 gunicorn配置文件的用法解读

《python3gunicorn配置文件的用法解读》:本文主要介绍python3gunicorn配置文件的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录python3 gunicorn配置文件配置文件服务启动、重启、关闭启动重启关闭总结python3 gun

SQL server配置管理器找不到如何打开它

《SQLserver配置管理器找不到如何打开它》最近遇到了SQLserver配置管理器打不开的问题,尝试在开始菜单栏搜SQLServerManager无果,于是将自己找到的方法总结分享给大家,对SQ... 目录方法一:桌面图标进入方法二:运行窗口进入方法三:查找文件路径方法四:检查 SQL Server 安

MySQL 中的 LIMIT 语句及基本用法

《MySQL中的LIMIT语句及基本用法》LIMIT语句用于限制查询返回的行数,常用于分页查询或取部分数据,提高查询效率,:本文主要介绍MySQL中的LIMIT语句,需要的朋友可以参考下... 目录mysql 中的 LIMIT 语句1. LIMIT 语法2. LIMIT 基本用法(1) 获取前 N 行数据(