Leif160519's blog Leif160519's blog

——————

目录
oh-my-fishy-zsh配置
/      

oh-my-fishy-zsh配置

都说普通青年用bash,装逼青年用zsh,文艺青年用fish。fish是真的好用,但是它最大的问题是与bash不兼容,从而带来各种各样兼容性问题,折腾过fish的人都知道。而zsh有着可定制化的oh-my-zsh框架,同时又是兼容bash语法的,笔者在这里记录一下如何安装一个oh-my-fishy-zsh。

一、前置环境安装

1.1 环境参数

⚡ root@gens-virtual-machine  ~  uname -a        
Linux gens-virtual-machine 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

 ⚡ root@gens-virtual-machine  ~  lsb_release -a        
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

1.2 安装zsh

apt-get install zsh curl git autojump

1.3 安装oh-my-zsh

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

1.4 自定义你的~/.zshrc

安装完oh-my-zsh的下一步就是自定义配置文件,下面罗列了一些模仿fish必备的插件

1.4.1 fishy主题

zsh主题选择fishy,可以模仿fish特有的路径简写模式。

ZSH_THEME="fishy"

本人更喜欢agnoster主题所以就改了,默认主题路径:~/.oh-my-zsh/themes
如果想每次登录shell显示的主题随机,则配置文件改为:ZSH_THEME="random"

1.4.2 插件清单

plugins=(
        git
        zsh-autosuggestions
        zsh-syntax-highlighting
        zsh-completions
        z
        history-substring-search
        command-not-found
        colored-man-pages
        extract
        history-search-multi-word
)
  • git: 提示当前目录所在git仓库的状态的插件
  • z: 可以无脑跳跃到历史记录中出现过的文件夹中
  • command-not-found:会自动根据出错的命令,推荐该命令可能相关的包
  • colored-man-pages: 给man page自动高亮,命令行神器
  • extract: 只需要一个x就可以解压任何压缩包,再也不需要手打tar xfvz
  • zsh-syntax-highlighting: 模仿fish命令行高亮的插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • zsh-completions: 自动命令补全,类似bash-completions功能的插件
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zdharma/history-search-multi-word ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/history-search-multi-word

二、最终效果

image.png

image.png

三、参考


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题oh-my-fishy-zsh配置
作  者Leif160519
出  处https://github.icu/articles/2020/09/02/1599028639385.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!