Mac/Linux终端配置oh | 您所在的位置:网站首页 › debian应用商店安装 › Mac/Linux终端配置oh |
1 前言 回想上大学以前第一次玩linux很上头,各种配置各种花里胡哨。 从arch linux,manjaro,debian,ubuntu,deepin,甚至到后面够了一下网安的kali linux。除了kali外大同小异,几乎所有开源的主流发行版都折腾了遍,年少不懂事,统统上真机,环境docker乱成一锅粥的时候直接重装系统,备着七八个u盘的安装镜像启动盘。 热度期》平淡期〉高效期mac和linux是师出同门unix的,后面前者走商业化,后者走开源化仅此而已,终端bash的运行逻辑是一样的,都可用。 2 安装和配置homebrewApp store是苹果官方的应用商店,但是其实发不上去的软件要获得苹果验证是需要定期交钱的;homebrew[1]是包管理软件,相比于linux的yum、apt等这是Mac必备神器。可以理解为前者是一座大超市,后者是一个精品小铺。 ##install /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ##若龟速下载或github:443报错用镜像安装 ##中科大镜像源 /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)" ##国内佬做的,有其他国内源 /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" ###国内镜像源下载的需完成以下配置 ##替换 brew.git: git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git ##替换 homebrew-core.git: git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git若有报错也绕不开就网络和路径两个问题,无法解决的可以+v私信。基本语法跟linux的那些包管理工具一样: ##查询 brew search name ##安装 brew install name ##卸载 brew uninstall name ##更新 brew updata ##查看配置信息 brew config ##查看已安装的包 brew list3 安装和配置oh-my-zsh##查看本地内置了几种shell: cat /etc/shells ##设置zsh为默认shell chsh -s /bin/zsh![]() 安装oh-my-zsh:(两种方法都行,二选一) ##github sh脚本安装 sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ##手动安装 git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh ##创建zsh配置文件 cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc![]() (两种安装方法都行,二选一) ##下载安装 git clone --depth=1 https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions ##添加目录 fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src ##激活 source "$ZSH/oh-my-zsh.sh" ##brew下载安装 brew install zsh-completions4.3 zsh-autosuggestions:历史补全##下载安装 git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-autosuggestions ##vi进去配置zsh-autosuggestions plugins=( git # other plugins... zsh-autosuggestions )![]() ![]() 命令错误显示红色,直至正确才为绿色,路径正确会添加下划线 ##下载安装 git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ##vi进去配置zsh-syntax-highlighting plugins=([plugins...] zsh-syntax-highlighting)5 主题配置github有公开的所有内置主题样式,外置的也有要自己下载。主题这个因人而异了,一般是初期有新鲜感,过后哪个方便用哪个。常用philips,alien-minimal,dst,duellj几个,又想要时间,又想简约,又想要行数,还有主题高亮颜色....还没笔者缝合了一下自己写了一个主题,还是有一点小问题这里就不开源了。。 内置主题[3]外部主题[4]##配置文件 cd ~ vi ~/.zshrc ## 默认主题,修改引号内内容即可 ZSH_THEME="robbyrussell"![]() [1]homebrew: https://brew.sh/ [2]zsh: https://github.com/zsh-users [3]内置主题: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes [4]外部主题: https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes |
CopyRight 2018-2019 实验室设备网 版权所有 |