<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Zsh on Tech Philosopher</title><link>https://blog.bktus.com/tags/zsh/</link><description>Recent content in Zsh on Tech Philosopher</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Mon, 22 Nov 2021 15:04:56 +0800</lastBuildDate><atom:link href="https://blog.bktus.com/tags/zsh/index.xml" rel="self" type="application/rss+xml"/><item><title>oh my zsh 在Ubuntu下的配置教程</title><link>https://blog.bktus.com/archives/2hlujj/</link><pubDate>Mon, 22 Nov 2021 15:04:56 +0800</pubDate><guid>https://blog.bktus.com/archives/2hlujj/</guid><description>&lt;p>oh my zsh 是十分好用的基于 zsh 的配置框架，它能简化 Linux 终端用户的很多日常操作。而且，它的界面相对于原始的 bash 来说，非常好看。这篇文章就是用来介绍如何在
Ubuntu 下安装并配置 oh my zsh 及其常用插件的。&lt;/p></description><content:encoded><![CDATA[<p>oh my zsh 是十分好用的基于 zsh 的配置框架，它能简化 Linux 终端用户的很多日常操作。而且，它的界面相对于原始的 bash 来说，非常好看。这篇文章就是用来介绍如何在
Ubuntu 下安装并配置 oh my zsh 及其常用插件的。</p>
<h2 id="oh-my-zsh-安装与基本配置">oh my zsh 安装与基本配置</h2>
<p>在 oh my zsh 安装前需要先执行以下命令安装下列 git、curl、zsh。</p>
<pre tabindex="0"><code>% sudo apt install git curl zsh
</code></pre><p>安装完依赖项目后，直接执行下面的命令来一键安装：</p>
<pre tabindex="0"><code>% sh -c &#34;$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)&#34;
</code></pre><p>设置 zsh 为默认 shell：</p>
<pre tabindex="0"><code>% chsh
</code></pre><p>按照提示一步一来，输入/bin/zsh 即可。</p>
<h2 id="常用插件安装">常用插件安装</h2>
<p>单单配置 oh my zsh 本身是远远不够的，你可能需要以下常用插件来真正达到简化操作的目的。</p>
<ul>
<li>z 历史目录管理</li>
<li>zsh-autosuggestions 命令提示</li>
<li>zsh-syntax-highlighting 高亮</li>
<li>sudo 忘记加 sudo 前缀之时</li>
<li>extract 一个命令解压几乎所有安装包</li>
</ul>
<h3 id="z">z</h3>
<p>无需额外安装，直接在 plugins 中填写即可。</p>
<h3 id="zsh-autosuggestions">zsh-autosuggestions</h3>
<p>先执行以下命令，然后在 plugins 中填写。</p>
<pre tabindex="0"><code>% git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH\_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
</code></pre><h3 id="zsh-syntax-highlighting">zsh-syntax-highlighting</h3>
<p>先执行以下命令，然后在 plugins 中填写。</p>
<pre tabindex="0"><code>% git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH\_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
</code></pre><h3 id="sudo">sudo</h3>
<p>无需额外安装，直接在 plugins 中填写即可。</p>
<h3 id="extract">extract</h3>
<p>无需额外安装，直接在 plugins 中填写即可。</p>
<h2 id="设置代理">设置代理</h2>
<p>我们可以通过在.zshrc 中加入以下配置来启动可开关的代理功能：</p>
<pre tabindex="0"><code>proxy() {
    export https\_proxy=http://127.0.0.1:1234
    export http\_proxy=http://127.0.0.1:1234
    export all\_proxy=socks5://127.0.0.1:1234
}

unproxy() {
    unset https\_proxy
    unset http\_proxy
    export all\_proxy
}
</code></pre><p>你可以将 1234 改为你任何想要的端口。</p>
<h3 id="刷新配置">刷新配置</h3>
<p>执行以下命令来刷新配置。</p>
<pre tabindex="0"><code>% source ~/.zshrc
</code></pre>]]></content:encoded></item><item><title>为MacOS的终端加上代理设置</title><link>https://blog.bktus.com/archives/5ytwua/</link><pubDate>Tue, 25 May 2021 20:15:28 +0800</pubDate><guid>https://blog.bktus.com/archives/5ytwua/</guid><description>&lt;p>MacOS 现在默认采用 Zsh，所以在用户家目录下寻找.zshrc 配置文件，如果没有则自行创建。 编辑.zshrc 文件，在最后加入下列代码&lt;/p>
&lt;pre tabindex="0">&lt;code>\# set proxy
alias proxy=&amp;#39;export all\_proxy=socks5://127.0.0.1:1234&amp;#39;
alias unproxy=&amp;#39;unset all\_proxy&amp;#39;
&lt;/code>&lt;/pre>&lt;p>添加完毕后，保存，在终端输入以下命令&lt;/p></description><content:encoded><![CDATA[<p>MacOS 现在默认采用 Zsh，所以在用户家目录下寻找.zshrc 配置文件，如果没有则自行创建。 编辑.zshrc 文件，在最后加入下列代码</p>
<pre tabindex="0"><code>\# set proxy
alias proxy=&#39;export all\_proxy=socks5://127.0.0.1:1234&#39;
alias unproxy=&#39;unset all\_proxy&#39;
</code></pre><p>添加完毕后，保存，在终端输入以下命令</p>
<pre tabindex="0"><code>% source ～/.zshrc
</code></pre><p>完毕。 如果需要使用代理，则预先输入 proxy 命令。如果需要取消代理，则输入 unproxy
命令。 或者如果需要默认启用代理的话，在.zshrc 配置文件末尾添加</p>
<pre tabindex="0"><code>% export https\_proxy=http://127.0.0.1:7890 http\_proxy=http://127.0.0.1:7890 all\_proxy=socks5://127.0.0.1:7890
</code></pre><p>保存。</p>
<pre tabindex="0"><code>% source ～/.zshrc
</code></pre><p>完毕。</p>
]]></content:encoded></item><item><title>解决oh-my-zsh plugin 'zsh-autosuggestions' not found 与 plugin 'zsh-syntax-highlighting' not found问题</title><link>https://blog.bktus.com/archives/9s3ea1/</link><pubDate>Tue, 25 May 2021 17:49:23 +0800</pubDate><guid>https://blog.bktus.com/archives/9s3ea1/</guid><description>&lt;p>安装 zsh 插件 zsh-autosuggestions 或者 zsh-syntax-highlighting 的时候，我们一般会遇到 oh-my-zsh plugin &amp;lsquo;xxx&amp;rsquo; not found 的问题。现在，我们分析并解决 oh-my-zsh
plugin &amp;lsquo;zsh-autosuggestions&amp;rsquo; not found 与 plugin &amp;lsquo;zsh-syntax-highlighting&amp;rsquo; not
found 问题。 问题产生的原因是，没有把插件的代码仓库克隆到本地位置上，所以你想要的插件其实并没有被安装。 解决问题非常简单，只需要简单输入以下命令：&lt;/p></description><content:encoded><![CDATA[<p>安装 zsh 插件 zsh-autosuggestions 或者 zsh-syntax-highlighting 的时候，我们一般会遇到 oh-my-zsh plugin &lsquo;xxx&rsquo; not found 的问题。现在，我们分析并解决 oh-my-zsh
plugin &lsquo;zsh-autosuggestions&rsquo; not found 与 plugin &lsquo;zsh-syntax-highlighting&rsquo; not
found 问题。 问题产生的原因是，没有把插件的代码仓库克隆到本地位置上，所以你想要的插件其实并没有被安装。 解决问题非常简单，只需要简单输入以下命令：</p>
<pre tabindex="0"><code>$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
$ source ~/.zshrc
</code></pre><p>然后，你可以重新打开 shell，可以发现问题已解决。你也可以用该方法解决其他插件的此类问题。</p>
]]></content:encoded></item></channel></rss>