再见 XShell 和 ITerm 2,是时候拥抱全平台高颜值终端工具 Hyper 了!
source link: http://mp.weixin.qq.com/s?__biz=MzA5MTkxNTMzNg%3D%3D&%3Bmid=2650265439&%3Bidx=2&%3Bsn=ae22df7433171ce025942807ee444b71
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
点击上方“ 涛哥聊Python ”,选择“星标”公众号
重磅干货,第一时间送达
转自:运维之美
不论是 macOS
还是 Windows
下,我们都不推荐使用系统自带终端。无论是可拓展性还是可编程性都被「系统自带」这样的特点限制。特别是 Windows
下的万恶之源「小黑框」,在 9012 年真的是不太好用哟!
今天我们将给大家介绍一款基于 Electron
的全平台高颜值的终端工具 Hyper
。 Hyper
支持丰富的主题和插件功能,通过强大的插件系统提供了非常丰富的自定义选项,可谓是颜值和易用并存的神器。
官网地址:https://hyper.is
下面先放一张配置好的预览效果图,让大家先睹为快。
由于 Hyper
是基于 Electron
的,所以它的插件、主题等等可拓展性都非常强大。几行简单的 Javascript
、 HTML
、 CSS
代码,你就可以定制自己的插件。
Electron
是一个利用最新
Web
技术栈搭建跨平台应用的项目,比如:
GitHub
出品的代码编辑器
Atom
和微软出品的
VSCode
都是基于
Electron
的。
安装 Hyper
Hyper
的安装非常简单,只需要在官网下载对应平台二进制安装包后,直接安装就可以运行。
如果你是 macOS
平台,你还可以通过 Homebrew
命令来快速完成安装。
$ brew cask install hyper
Hyper 主题安装
Hyper
做为一个高颜值终端工具,自然就少不了对主题的支持。官方首页推荐了 4 种不同颜色的主题,你可以在官方主题地址 https://hyper.is/themes
直接查看并安装。
当然,如果上面官方推荐的主题满足不了你,你也可以去在上面的主题地址中的 NEWEST
页签找到更多主题,或者是去 GitHub
搜索更多好看的主题。
善用 Hyper 插件
Hyper
本身是支持插件系统的,在安装扩展插件前,你需要先安装 Hyper
命令行程序。你可以点击菜单,选择 Plugin
选项,然后点击 Install Hyper CLI command in PATH
。
Hyper
命令行程序安装完成后, Hyper
插件安装就十分简单了,只需要打开 Hyper
之后一行代码就可以搞定:
$ hyper i verminal
这样就安装了 verminal
这个插件。
Hyper
官方也在首页给大家推荐了 4 个比较易用的插件,推荐大家全部都安装试试。
1. hypercwd
它可以让你的终端在新建标签页时,保持上一个终端的目录地址。其安装命令是:
$ hyper i hypercwd
2. hyper-search
它可以让你搜索整个终端的所有文本内容。其安装命令是:
$ hyper i hyper-search
3. hyper-pane
该插件用来增强窗口导航,对于支持多个页签的软件来说这是个利器。其安装命令是:
$ hyper i hyper-pane
4. hyperpower
这是一个让你的终端变得更加绚丽的插件,类似于 Atom
里面的一个叫做 activate-power-mode
的插件。当然这么炫酷的效果是不是会影响你的工作呢,还是要视个人情而定。其安装命令是:
$ hyper i hyperpower
如果你需要更多的插件和主题,你可以在官方网站以下地址中找到。
-
Hyper
的官方主题地址: https://hyper.is/themes -
Hyper
的官方插件地址: https://hyper.is/plugins
除了,官方提供的主题和插件。目前还有一个社区驱动的 awesome-hyper
项目,里面有着更多开源的 Hyper
终端插件、主题等等。如果你对不同的主题和插件有兴趣,可以去这个项目里进行探索哟!
-
项目地址: https://github.com/bnb/awesome-hyper
整合 ZSH
通常 Linux
服务器上面默认使用的 SHELL
是 Bash
。其实除了 Bash
之外,还有很多其他的 SHELL
程序,比如: ZSH
、 CSH
、 Fish
等等。
这里我们将介绍的 ZSH
是我认为在类 Unix
系统下最优雅的 Shell
程序 。虽然 ZSH
设置复杂,但得益于开源社区,我们可以使用 Oh-My-ZSH
这个神器来很方便的管理和配置 ZSH
。
安装 ZSH 和 Oh-My-ZSH
在使用 Oh-My-ZSH
之前,你需要先安装 ZSH
。各个平台安装的方式可能不一样,这里就只简单说下比较常用的 Centos
和 Ubuntu
系统下的安装方法。
# Redhat / Centos
$ yum install zsh
# Debian / Ubuntu
$ apt-get install zsh
安装好 ZSH
后,就可以安装 Oh-My-ZSH
了。 Oh-My-ZSH
的安装也是非常简单的,你只需要用下面两条指令中的任意一条就可完成安装。
# 通过 curl 安装
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 通过 wget 安装
$ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
安装完成后,你就会发现你的终端 SHELL
变成了 ZSH
。你还可以通过命令 chsh -s /bin/zsh
将 ZSH
设置为默认的 Shell
。
配置主题
Oh-My-ZSH
默认也附带了大量好看的主题,你可以利用它们对终端界面做进一步增强和美化。 Oh-My-ZSH
默认的主题存放在 ~/.oh-my-zsh/themes
目录中。
$ ls ~/.oh-my-zsh/themes
3den.zsh-theme essembeh.zsh-theme junkfood.zsh-theme rgm.zsh-theme
Soliah.zsh-theme evan.zsh-theme kafeitu.zsh-theme risto.zsh-theme
adben.zsh-theme example.zsh-theme kardan.zsh-theme rixius.zsh-theme
af-magic.zsh-theme fino-time.zsh-theme kennethreitz.zsh-theme rkj-repos.zsh-theme
afowler.zsh-theme fino.zsh-theme kiwi.zsh-theme rkj.zsh-theme
agnoster.zsh-theme fishy.zsh-theme kolo.zsh-theme robbyrussell.zsh-theme
alanpeabody.zsh-theme flazz.zsh-theme kphoen.zsh-theme sammy.zsh-theme
amuse.zsh-theme fletcherm.zsh-theme lambda.zsh-theme simonoff.zsh-theme
apple.zsh-theme fox.zsh-theme linuxonly.zsh-theme simple.zsh-theme
arrow.zsh-theme frisk.zsh-theme lukerandall.zsh-theme skaro.zsh-theme
....
对于主题的启用,你只需编辑 ZSH
配置文件 ~/.zshrc
。并在 ZSH_THEME
项中直接修改主题名称为要启用的主题名称即可。
ZSH_THEME="agnoster"
注意:
如果你安装的主题无法显示预期效果,那是因为响应的主题的系统字体没有安装。
这时,你需要正确的安装了
Powerline
字体才会显示出来。
-
Powerline
项目地址: https://github.com/powerline/fonts -
Powerline
安装教程: https://powerline.readthedocs.io/en/latest/installation.html#fonts-installation
如果这些默认主题还不能满足你的需要,你还可以到下面这些地址中找到更多的 ZSH
主题。
-
https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
-
https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes
-
https://github.com/unixorn/awesome-zsh-plugins#themes
配置插件
Oh-My-ZSH
之所以强大,其中一个原因就是支持诸多功能强大的插件, Oh-My-ZSH
默认自带的插件都存放在 ~/.oh-my-zsh/plugins
目录中。
$ ls ~/.oh-my-zsh/plugins
adb brew coffee dirpersist fastfile gitignore httpie last-working-dir nanoc pod rebar sprunge terminitor vault zeus
ant brew-cask colemak django fbterm git-prompt iwhois lein nmap postgres redis-cli ssh-agent terraform vim-interaction zsh-navigation-tools
apache2-macports bundler colored-man-pages dnf fedora git-remote-branch jake-node lighthouse node pow repo stack textastic vi-mode zsh_reload
archlinux bwana colorize docker forklift glassfish jhbuild lol npm powder rsync sublime textmate virtualenv
asdf cabal command-not-found docker-compose frontend-search gnu-utils jira macports nvm powify ruby sudo thefuck virtualenvwrapper
autoenv cake common-aliases emacs gas go jruby man nyan profiles rvm supervisor themes vundle
autojump cakephp3 compleat ember-cli geeknote golang jsontools marked2 osx pyenv safe-paste suse thor wakeonlan
autopep8 capistrano composer emoji gem gpg-agent jump mercurial pass pylint sbt svn tmux wd
aws cask copydir emoji-clock git gradle kate meteor paver python scala svn-fast-info tmux-cssh web-search
battery catimg copyfile emotty git-extras grails kitchen mix pep8 rails scd symfony tmuxinator wp-cli
bbedit celery cp encode64 gitfast grunt knife mix-fast per-directory-history rake screen symfony2 torrent xcode
bgnotify chruby cpanm extract git-flow gulp knife_ssh mosh perl rake-fast scw systemadmin tugboat yii
boot2docker chucknorris debian fabric git-flow-avh heroku laravel mvn phing rand-quote sfffe systemd ubuntu yii2
bower cloudapp dircycle fancy-ctrl-z github history laravel4 mysql-macports pip rbenv singlechar taskwarrior urltools yum
branch codeclimate dirhistory fasd git-hubflow history-substring-search laravel5 n98-magerun pj rbfu spring terminalapp vagrant z
默认情况下, Oh-My-ZSH
只启用 Git
插件。
# Git 插件可以十分清晰的显示出当前代码仓库里与远程仓库是否同步,以及最新同步日期等等信息。
plugins=(git)
如果你需启用更多插件,只需加入要启用插件的名称。
plugins=(git wd web-search history history-substring-search)
除默认自带的插件外,你还可以在 GitHub
上找到更多好用的 ZSH
三方插件,这里推荐几个比较好用三方插件。
-
zsh-history-substring-search
项目地 址:https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/history-substring-search -
zsh-syntax-highlighting
项目地址:https://github.com/zsh-users/zsh-syntax-highlighting
-
zsh-autosuggestions
项目地址:https://github.com/zsh-users/zsh-autosuggestions
集成 WSL
通常在使用 WSL (Windows Subsystem for Linux)
工作时,我们希望启动终端时就进入 WSL
的 SHELL
内部。但默认情况下我们需要在启动终端并输入 bash
命令后才能进入 WSL
终端。
很显然有此一步操作后,我们会觉得太繁琐了。有了 Hyper
后,我们只需要改动一下配置文件,上面这步就可以直接省略。
现在,你只需打开 Hyper
设置页面文件,从菜单 Edit -> Preferences
进入,然后编辑 shell
和 shellArgs
参数即可。
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: [],
修改完成后,再次重新打开 Hyper
,你会发现默认已经进入了 Bash
终端界面了。
总结
本文讲述了如何安装和使用 Hyper
这个高颜值跨平台的终端软件,其中包括配置 Hyper
插件和主题。并讲述了如何使用 ZSH
来代替 Bash
让你的终端更加强大易用的方法。都看到这里了,你还在等什么呢?是时候放弃你的 Xshell
和 iTerm 2
吧!
参考文档
-
https://www.google.com
-
https://sspai.com/post/56081
-
https://sspai.com/post/45332
-
https://archive.spencerwoo.com/posts/2018/06/17/terminal.html
-
https://www.fythonfang.com/blog/post/24
-
https://github.com/sindresorhus/hyper-snazzy
-
https://www.veinin.com/2018/11/30/hyper-windows-tutorial/
-
https://blog.csdn.net/was172/article/details/85016495
-
https://github.com/sindresorhus/pure
-
https://www.fythonfang.com/blog/post/24
学界震动!北大教授实名举报武大,中科院三人学术造假!官方回应
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK