<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Spark's Blog</title><link>https://blog.sparkzh.top/</link><description>Spark 的个人博客 —— 记录技术、折腾与思考</description><generator>Hugo 0.167.0 &amp; FixIt v1.0.0-beta-mukxzari</generator><language>zh-CN</language><managingEditor>Spark-CN@outlook.com (Spark)</managingEditor><webMaster>Spark-CN@outlook.com (Spark)</webMaster><lastBuildDate>Tue, 06 Oct 2026 18:03:10 +0800</lastBuildDate><atom:link href="https://blog.sparkzh.top/index.xml" rel="self" type="application/rss+xml"/><item><title>Neovim使用`conform.nvim`或`none-ls.nvim`实现格式化代码</title><link>https://blog.sparkzh.top/posts/neovim_cmp_other-fmt/</link><pubDate>Wed, 02 Oct 2024 15:00:00 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/neovim_cmp_other-fmt/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="该配置由chatgpt完成经笔者修改测试后完全可用注释可以不看"&gt;&lt;span&gt;该配置由ChatGPT完成，经笔者修改测试后完全可用(注释可以不看)&lt;/span&gt;&#10; &lt;a href="#%e8%af%a5%e9%85%8d%e7%bd%ae%e7%94%b1chatgpt%e5%ae%8c%e6%88%90%e7%bb%8f%e7%ac%94%e8%80%85%e4%bf%ae%e6%94%b9%e6%b5%8b%e8%af%95%e5%90%8e%e5%ae%8c%e5%85%a8%e5%8f%af%e7%94%a8%e6%b3%a8%e9%87%8a%e5%8f%af%e4%bb%a5%e4%b8%8d%e7%9c%8b" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="conformnvim"&gt;&lt;span&gt;&lt;code&gt;Conform.nvim&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#conformnvim" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;blockquote&gt;&#10;&lt;p&gt;Lightweight yet powerful formatter plugin for Neovim&#10;(轻量但强大的Neovim代码格式化插件)&#10;—— &lt;a href="https://github.com/stevearc/conform.nvim" target="_blank" rel="external nofollow noopener noreferrer"&gt;GitHub描述&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 class="heading-element" id="开始使用"&gt;&lt;span&gt;开始使用&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;首先，先安装&lt;code&gt;conform.nvim&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;return {&#10; {&#10; &amp;#34;stevearc/conform.nvim&amp;#34;, -- 安装插件&#10; config = function()&#10; -- 配置conform，使用black和isort格式化Python&#10; require(&amp;#34;conform&amp;#34;).setup({&#10; formatters_by_ft = {&#10; -- python = { &amp;#34;black&amp;#34; },&#10; python = { &amp;#34;black&amp;#34; },&#10; lua = { &amp;#39;lua-ls&amp;#39; },&#10; },&#10; })&#10;&#10; -- 自动格式化配置&#10; -- vim.api.nvim_create_autocmd(&amp;#34;BufWritePre&amp;#34;, {&#10; -- pattern = &amp;#34;*.py&amp;#34;,&#10; -- callback = function(args)&#10; -- require(&amp;#34;conform&amp;#34;).format({ bufnr = args.buf })&#10; -- end,&#10; -- })&#10; end,&#10; }&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后保存，重新进入Neovim就可以看见&lt;code&gt;lazy.nvim&lt;/code&gt;正在安装了。&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="安装代码格式化工具"&gt;&lt;span&gt;安装代码格式化工具&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%bb%a3%e7%a0%81%e6%a0%bc%e5%bc%8f%e5%8c%96%e5%b7%a5%e5%85%b7" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;以&lt;code&gt;Python&lt;/code&gt;为例&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# Arch Linux&#10;sudo pacman -S python-black&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来安装&lt;code&gt;black&lt;/code&gt;。你也可以用&lt;code&gt;isort&lt;/code&gt;等&lt;br&gt;&#10;&lt;code&gt;formatters_by_ft&lt;/code&gt;是一个列表，你可以添加你所用编程语言的格式化工具，如&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;formatters_by_ft = {&#10; bash = { &amp;#39;beautysh&amp;#39; },&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;关于格式化工具，你可以查看：&lt;br&gt;&#10;&lt;a href="https://github.com/stevearc/conform.nvim?tab=readme-ov-file#formatters" target="_blank" rel="external nofollow noopener noreferrer"&gt;Conform文档&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;br&gt;&#10;或通过在Neovim中使用&lt;code&gt;:help conform-formatters&lt;/code&gt;来查看&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="格式化代码"&gt;&lt;span&gt;格式化代码&lt;/span&gt;&#10; &lt;a href="#%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bb%a3%e7%a0%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你只需要使用&lt;code&gt;:lua require(&amp;quot;conform&amp;quot;).format()&lt;/code&gt;的命令来进行代码格式化。&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="关于保存时自动格式化请看保存时自动格式化代码"&gt;&lt;span&gt;关于保存时自动格式化，请看&lt;a href="https://blog.sparkzh.top/content/posts/Neovim_cmp_other-fmt.md#保存时自动格式化代码"&gt;保存时自动格式化代码&lt;/a&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%85%b3%e4%ba%8e%e4%bf%9d%e5%ad%98%e6%97%b6%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e8%af%b7%e7%9c%8b%e4%bf%9d%e5%ad%98%e6%97%b6%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bb%a3%e7%a0%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h1 class="heading-element" id="使用none-lsnvim"&gt;&lt;span&gt;使用&lt;code&gt;none-ls.nvim&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8none-lsnvim" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;blockquote&gt;&#10;&lt;p&gt;null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.&#10;(继承null-ls.nvim/通过Lua使用Neovim作为一个语言服务器来注入LSP诊断，代码动作等等)&#10;—— &lt;a href="https://github.com/nvimtools/none-ls.nvim/" target="_blank" rel="external nofollow noopener noreferrer"&gt;GitHub描述&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 class="heading-element" id="开始使用-1"&gt;&lt;span&gt;开始使用&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;首先，安装&lt;code&gt;none-ls.nvim&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;return {&#10; {&#10; &amp;#34;nvimtools/none-ls.nvim&amp;#34;, -- 安装none-ls.nvim插件&#10; dependencies = { &amp;#34;nvim-lua/plenary.nvim&amp;#34; }, -- 依赖plenary.nvim&#10; config = function()&#10; local none_ls = require(&amp;#34;null-ls&amp;#34;)&#10;&#10; -- 配置none-ls，集成black&#10; none_ls.setup({&#10; sources = {&#10; none_ls.builtins.formatting.black,&#10; },&#10; })&#10;&#10; -- 自动格式化配置&#10; vim.cmd [[&#10; augroup LspFormatting&#10; autocmd! * &amp;lt;buffer&amp;gt;&#10; autocmd BufWritePre *.py lua vim.lsp.buf.format()&#10; augroup END&#10; ]]&#10; end,&#10; }&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后保存，重新进入Neovim就可以看见lazy.nvim正在安装了。&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="安装代码格式化工具-1"&gt;&lt;span&gt;安装代码格式化工具&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%bb%a3%e7%a0%81%e6%a0%bc%e5%bc%8f%e5%8c%96%e5%b7%a5%e5%85%b7-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;以&lt;code&gt;Python&lt;/code&gt;为例&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# Arch Linux&#10;sudo pacman -S python-black&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来安装&lt;code&gt;black&lt;/code&gt;。你也可以用&lt;code&gt;isort&lt;/code&gt;等&lt;br&gt;&#10;&lt;code&gt;sources&lt;/code&gt;是一个列表，你可以添加你所用编程语言的格式化工具，如&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sources = {&#10; null_ls.builtins.formatting.stylua,&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;关于格式化工具，你可以查看：&lt;br&gt;&#10;&lt;a href="https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md" target="_blank" rel="external nofollow noopener noreferrer"&gt;none-ls文档-内置源&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="格式化代码-1"&gt;&lt;span&gt;格式化代码&lt;/span&gt;&#10; &lt;a href="#%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bb%a3%e7%a0%81-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你只需要使用&lt;code&gt;:lua vim.lsp.buf.format()&lt;/code&gt;的命令来进行代码格式化。&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="关于保存时自动格式化请看保存时自动格式化代码-1"&gt;&lt;span&gt;关于保存时自动格式化，请看&lt;a href="https://blog.sparkzh.top/content/posts/Neovim_cmp_other-fmt.md#保存时自动格式化代码"&gt;保存时自动格式化代码&lt;/a&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%85%b3%e4%ba%8e%e4%bf%9d%e5%ad%98%e6%97%b6%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e8%af%b7%e7%9c%8b%e4%bf%9d%e5%ad%98%e6%97%b6%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bb%a3%e7%a0%81-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h1 class="heading-element" id="保存时自动格式化代码"&gt;&lt;span&gt;保存时自动格式化代码&lt;/span&gt;&#10; &lt;a href="#%e4%bf%9d%e5%ad%98%e6%97%b6%e8%87%aa%e5%8a%a8%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%bb%a3%e7%a0%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="conformnvim-1"&gt;&lt;span&gt;&lt;code&gt;conform.nvim&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#conformnvim-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;使用该代码：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;return {&#10; {&#10; &amp;#34;stevearc/conform.nvim&amp;#34;, -- 安装插件&#10; config = function()&#10; -- 配置conform，使用black和isort格式化Python&#10; require(&amp;#34;conform&amp;#34;).setup({&#10; formatters_by_ft = {&#10; -- python = { &amp;#34;black&amp;#34; },&#10; python = { &amp;#34;black&amp;#34; },&#10; lua = { &amp;#39;lua-ls&amp;#39; },&#10; },&#10; })&#10;&#10; -- 自动格式化配置&#10; vim.api.nvim_create_autocmd(&amp;#34;BufWritePre&amp;#34;, {&#10; pattern = &amp;#34;*.py&amp;#34;,&#10; callback = function(args)&#10; require(&amp;#34;conform&amp;#34;).format({ bufnr = args.buf })&#10; end,&#10; })&#10; end,&#10; }&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;h2 class="heading-element" id="none-lsnvim"&gt;&lt;span&gt;&lt;code&gt;none-ls.nvim&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#none-lsnvim" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;使用以下代码：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;return {&#10; {&#10; &amp;#34;nvimtools/none-ls.nvim&amp;#34;, -- 安装none-ls.nvim插件&#10; dependencies = { &amp;#34;nvim-lua/plenary.nvim&amp;#34; }, -- 依赖plenary.nvim&#10; config = function()&#10; local none_ls = require(&amp;#34;null-ls&amp;#34;)&#10;&#10; -- 配置none-ls，集成black&#10; none_ls.setup({&#10; sources = {&#10; none_ls.builtins.formatting.black,&#10; },&#10; })&#10;&#10; -- 自动格式化配置&#10; vim.cmd [[&#10; augroup LspFormatting&#10; autocmd! * &amp;lt;buffer&amp;gt;&#10; autocmd BufWritePre *.py lua vim.lsp.buf.format()&#10; augroup END&#10; ]]&#10; end,&#10; }&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;两个切记不能同时开启！因为可能会返回不同的结果（当然使用相同的格式化工具就不会）。但是会增加占用（富哥当我没说:(）。所以建议二选一即可&lt;/p&gt;&#10;</description></item><item><title>Neovim使用ruff格式化Python代码</title><link>https://blog.sparkzh.top/posts/neovim_cmp_ruff_fmt/</link><pubDate>Tue, 01 Oct 2024 19:51:57 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/neovim_cmp_ruff_fmt/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="在neovim中使用ruff来格式化python代码"&gt;&lt;span&gt;在Neovim中使用&lt;code&gt;ruff&lt;/code&gt;来格式化Python代码&lt;/span&gt;&#10; &lt;a href="#%e5%9c%a8neovim%e4%b8%ad%e4%bd%bf%e7%94%a8ruff%e6%9d%a5%e6%a0%bc%e5%bc%8f%e5%8c%96python%e4%bb%a3%e7%a0%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="原因"&gt;&lt;span&gt;原因&lt;/span&gt;&#10; &lt;a href="#%e5%8e%9f%e5%9b%a0" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;&lt;del&gt;笔者尝试过使用&lt;code&gt;cmp&lt;/code&gt;调用&lt;code&gt;black&lt;/code&gt;和&lt;code&gt;flake8&lt;/code&gt;来实现格式化Python代码&lt;/del&gt;&lt;/p&gt;&#10;&lt;p&gt;但是失败了，因为两个工具都不支持使用LSP协议（大概吧？）&lt;/p&gt;&#10;&lt;p&gt;有人介绍笔者使用&lt;code&gt;conform.nvim&lt;/code&gt;或&lt;code&gt;none-ls.nvim&lt;/code&gt;来实现，但是笔者都不成功 &amp;#x1f602;&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;如果你成功使用&lt;code&gt;conform.nvim&lt;/code&gt;或&lt;code&gt;none-ls.nvim&lt;/code&gt;来实现，欢迎&lt;a href="mailto:Spark@outlook.com"&gt;告诉笔者！&lt;/a&gt;&lt;/del&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="关于ruff"&gt;&lt;span&gt;关于&lt;code&gt;ruff&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%85%b3%e4%ba%8eruff" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;blockquote&gt;&#10;&lt;p&gt;An extremely fast Python linter and code formatter, written in Rust.&#10;(一个用 Rust 编写的极快的 Python linter 和代码格式化程序。)&#10;——ruff项目介绍&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 class="heading-element" id="安装使用"&gt;&lt;span&gt;安装使用&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%bd%bf%e7%94%a8" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;我安装时的&lt;a href="https://github.com/PILIHU2022/My-dotfiles/commit/7e2135f9b059dd272dbeacd8e84e5c60cee1604a" target="_blank" rel="external nofollow noopener noreferrer"&gt;commit&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;del&gt;其实你只需要在系统装安装&lt;code&gt;ruff&lt;/code&gt;就可以了&lt;/del&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# Arch Linux:&#10;sudo pacman -S ruff&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后在&lt;code&gt;cmp.lua&lt;/code&gt;中的&lt;code&gt;servers&lt;/code&gt;中添加&lt;code&gt;ruff = {},&lt;/code&gt;即可&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="完成"&gt;&lt;span&gt;完成&lt;/span&gt;&#10; &lt;a href="#%e5%ae%8c%e6%88%90" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;&lt;del&gt;又水一篇文章&lt;/del&gt;&lt;/p&gt;&#10;</description></item><item><title>使用rclone挂载OneDrive</title><link>https://blog.sparkzh.top/posts/rclone-mount-onedrive/</link><pubDate>Sun, 01 Sep 2024 08:58:42 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/rclone-mount-onedrive/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="使用rclone挂载onedrive"&gt;&lt;span&gt;使用&lt;code&gt;Rclone&lt;/code&gt;挂载OneDrive&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8rclone%e6%8c%82%e8%bd%bdonedrive" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;数据是无价的，它是你的互联网资产，丢失了就很难找回来。目前人们推荐使用3-2-1的备份模式&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;3-2-1备份模式：&#10;3：一堆数据有总共三份，一份在工作目录上，另两份作为备份&#10;2：数据应该至少有两种形式，如硬盘与云存储（上个世纪可能是磁带）&#10;1：三份数据中的一份应该在异地（如在云上，或在家里）&#10;&#10;# 链接(URL)：https://chariri.moe/archives/122/personal-backup-restic-rclone/#toc-head-7&#10;# 来源(Source)：茶栗栗屋&lt;/code&gt;&lt;/pre&gt;&lt;h1 class="heading-element" id="准备工作"&gt;&lt;span&gt;准备工作&lt;/span&gt;&#10; &lt;a href="#%e5%87%86%e5%a4%87%e5%b7%a5%e4%bd%9c" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="onedrive账号"&gt;&lt;span&gt;OneDrive账号&lt;/span&gt;&#10; &lt;a href="#onedrive%e8%b4%a6%e5%8f%b7" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;首先你需要有一个OneDrive账号。当然，容量越大越好（例如E5账号）。如果你不需要备份很大的文件的话，普通个人账号的免费版就够了。且服务器在国外，上传速度不理想。&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="安装rclone"&gt;&lt;span&gt;安装&lt;code&gt;Rclone&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85rclone" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;sudo pacman -S rclone&lt;/code&gt;&lt;/pre&gt;&lt;h1 class="heading-element" id="授权登录"&gt;&lt;span&gt;授权（登录）&lt;/span&gt;&#10; &lt;a href="#%e6%8e%88%e6%9d%83%e7%99%bb%e5%bd%95" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;pre&gt;&lt;code&gt;rclone config&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后输入&lt;code&gt;n&lt;/code&gt;:&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Enter name for new remote.&#10;name&amp;gt; &amp;lt;Name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在&lt;code&gt;&amp;lt;Name&amp;gt;&lt;/code&gt;处输入你想要的名称（建议不包含空格）&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Storage&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;输入&lt;code&gt;33&lt;/code&gt;并回车。&#10;在要求输入&lt;code&gt;client_id&amp;gt;&lt;/code&gt;和&lt;code&gt;client_secret&amp;gt;&lt;/code&gt;时，直接回车使用默认值即可。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;region&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;回车或输入&lt;code&gt;1&lt;/code&gt;。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Edit advanced config?&#10;y) Yes&#10;n) No (default)&#10;y/n&amp;gt; n&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;Use web browser to automatically authenticate rclone with remote?&#10; * Say Y if the machine running rclone has a web browser you can use&#10; * Say N if running rclone on a (remote) machine without web browser access&#10;If not sure try Y. If Y failed, try N.&#10;&#10;y) Yes (default)&#10;n) No&#10;y/n&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;输入&lt;code&gt;y&lt;/code&gt;来使用浏览器登录并且自动授权&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Choose a number from below, or type in an existing value of type string.&#10;Press Enter for the default (onedrive).&#10; 1 / OneDrive Personal or Business&#10; \ (onedrive)&#10; 2 / Root Sharepoint site&#10; \ (sharepoint)&#10; / Sharepoint site name or URL&#10; 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite&#10; \ (url)&#10; 4 / Search for a Sharepoint site&#10; \ (search)&#10; 5 / Type in driveID (advanced)&#10; \ (driveid)&#10; 6 / Type in SiteID (advanced)&#10; \ (siteid)&#10; / Sharepoint server-relative path (advanced)&#10; 7 | E.g. /teams/hr&#10; \ (path)&#10;config_type&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;输入&lt;code&gt;1&lt;/code&gt;并回车&lt;/p&gt;&#10;&lt;p&gt;然后Rclone找到一个OneDrive盘，输入y确定回车。&lt;br&gt;&#10;确认OneDrive网盘的所有信息是否正确，输入&lt;code&gt;y&lt;/code&gt;并回车。&lt;br&gt;&#10;然后输入&lt;code&gt;q&lt;/code&gt;并回车来退出配置界面。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="同步文件"&gt;&lt;span&gt;同步文件&lt;/span&gt;&#10; &lt;a href="#%e5%90%8c%e6%ad%a5%e6%96%87%e4%bb%b6" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="挂载到本地"&gt;&lt;span&gt;挂载到本地&lt;/span&gt;&#10; &lt;a href="#%e6%8c%82%e8%bd%bd%e5%88%b0%e6%9c%ac%e5%9c%b0" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你可以使用&lt;code&gt;rclone&lt;/code&gt;来将OneDrive挂载到本地：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;rclone mount &amp;lt;Name&amp;gt;:&amp;lt;Directory&amp;gt; &amp;lt;Local_path&amp;gt; --vfs-cache-mode writes&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;其中：&#10;&lt;code&gt;&amp;lt;Name&amp;gt;&lt;/code&gt;：表示你之前命名的&#10;&lt;code&gt;&amp;lt;Directory&amp;gt;&lt;/code&gt;：指你希望挂载的OneDrive中的目录&#10;&lt;code&gt;&amp;lt;Local_path&amp;gt;&lt;/code&gt;：指你希望挂载到本地的目录&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="直接同步"&gt;&lt;span&gt;直接同步&lt;/span&gt;&#10; &lt;a href="#%e7%9b%b4%e6%8e%a5%e5%90%8c%e6%ad%a5" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;使用&lt;code&gt;sync&lt;/code&gt;参数来同步：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;rclone sync &amp;lt;Local_path&amp;gt; &amp;lt;Name&amp;gt;:&amp;lt;Directory&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;其中：&#10;&lt;code&gt;&amp;lt;Name&amp;gt;&lt;/code&gt;：表示你之前命名的&#10;&lt;code&gt;&amp;lt;Directory&amp;gt;&lt;/code&gt;：指你希望挂载的OneDrive中的目录&#10;&lt;code&gt;&amp;lt;Local_path&amp;gt;&lt;/code&gt;：指你希望挂载到本地的目录&lt;br&gt;&#10;如果你想将整个文件夹复制到OneDrive中，而不是将文件夹中的文件放入备份目录，请使用&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;rclone sync &amp;lt;Local_path&amp;gt; &amp;lt;Name&amp;gt;:&amp;lt;Directory&amp;gt;/&amp;lt;Subdir&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 class="heading-element" id="参考资料"&gt;&lt;span&gt;参考资料&lt;/span&gt;&#10; &lt;a href="#%e5%8f%82%e8%80%83%e8%b5%84%e6%96%99" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;&lt;a href="https://chariri.moe/archives/122/personal-backup-restic-rclone/#toc-head-7" target="_blank" rel="external nofollow noopener noreferrer"&gt;茶栗栗屋&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;br&gt;&#10;&lt;a href="https://walixz.com/rclone-sync-onedrive.html" target="_blank" rel="external nofollow noopener noreferrer"&gt;瓦力箱子&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Linux下设置xdg-open打开某文件/目录的应用程序</title><link>https://blog.sparkzh.top/posts/linux-set-default-application/</link><pubDate>Tue, 20 Aug 2024 11:55:17 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/linux-set-default-application/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="设置xdg-open打开某文件目录的默认应用程序"&gt;&lt;span&gt;设置&lt;code&gt;xdg-open&lt;/code&gt;打开某文件/目录的默认应用程序&lt;/span&gt;&#10; &lt;a href="#%e8%ae%be%e7%bd%aexdg-open%e6%89%93%e5%bc%80%e6%9f%90%e6%96%87%e4%bb%b6%e7%9b%ae%e5%bd%95%e7%9a%84%e9%bb%98%e8%ae%a4%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;你需要使用&lt;code&gt;xdg-mime&lt;/code&gt;工具来获取&lt;code&gt;filetype&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;xdg-mime query filetype path_to_file&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后你需要在&lt;code&gt;/usr/share/applications&lt;/code&gt;中查找有没有你想打开的软件&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;ls /usr/share/applications | grep program_name&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;确认后，即可设置默认的打开程序&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;xdg-mime default program_name.desktop filetype&lt;/code&gt;&lt;/pre&gt;&lt;h1 class="heading-element" id="参考"&gt;&lt;span&gt;参考&lt;/span&gt;&#10; &lt;a href="#%e5%8f%82%e8%80%83" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;&lt;a href="https://man.archlinux.org/man/xdg-mime.1.en" target="_blank" rel="external nofollow noopener noreferrer"&gt;xdg-mime Arch man&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://man.archlinux.org/man/xdg-open.1.en" target="_blank" rel="external nofollow noopener noreferrer"&gt;xdg-open Arch man&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://man.archlinux.org/man/xdg-settings.1.en" target="_blank" rel="external nofollow noopener noreferrer"&gt;xdg-settings Arch man&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>设置Hyprland全局黑暗模式</title><link>https://blog.sparkzh.top/posts/set-global-dark-mode-for-hyprland/</link><pubDate>Wed, 14 Aug 2024 19:17:15 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/set-global-dark-mode-for-hyprland/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="在hyprland中设置全局黑暗模式"&gt;&lt;span&gt;在Hyprland中设置全局黑暗模式&lt;/span&gt;&#10; &lt;a href="#%e5%9c%a8hyprland%e4%b8%ad%e8%ae%be%e7%bd%ae%e5%85%a8%e5%b1%80%e9%bb%91%e6%9a%97%e6%a8%a1%e5%bc%8f" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="折腾部分"&gt;&lt;span&gt;折腾部分&lt;/span&gt;&#10; &lt;a href="#%e6%8a%98%e8%85%be%e9%83%a8%e5%88%86" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="安装有关软件"&gt;&lt;span&gt;安装有关软件！！&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e6%9c%89%e5%85%b3%e8%bd%af%e4%bb%b6" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;sudo pacman -S kvantum nwg-look qt6ct&lt;/code&gt;&lt;/pre&gt;&lt;h2 class="heading-element" id="aur解君愁"&gt;&lt;span&gt;AUR解君愁&lt;/span&gt;&#10; &lt;a href="#aur%e8%a7%a3%e5%90%9b%e6%84%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;paru -S catppuccin-gtk-theme-mocha&lt;/code&gt;&lt;/pre&gt;&lt;h2 class="heading-element" id="qt"&gt;&lt;span&gt;Qt&lt;/span&gt;&#10; &lt;a href="#qt" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;首先，将&lt;a href="https://github.com/catppuccin/Kvantum" target="_blank" rel="external nofollow noopener noreferrer"&gt;主题&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;克隆到本地&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git clone https://github.com/catppuccin/Kvantum.git&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后打开&lt;code&gt;kvantum&lt;/code&gt;，安装&lt;a href="https://github.com/catppuccin/Kvantum" target="_blank" rel="external nofollow noopener noreferrer"&gt;主题&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;。（可能是选择整个目录，&lt;del&gt;自己试试&lt;/del&gt;）&#10;&lt;img loading="lazy" src='https://s1.imagehub.cc/images/2024/08/11/51e1170bb44cf152f1929de9a3cf64fd.png' alt="Kvantum1"&gt;&#10;打开&lt;code&gt;qt6ct&lt;/code&gt;，在&lt;code&gt;style&lt;/code&gt;栏中选择&lt;code&gt;kvantum-dark&lt;/code&gt;，点击右下角的确定。&#10;&lt;img loading="lazy" src='https://s1.imagehub.cc/images/2024/08/11/9a4a1d1cdf7ccc0d2607f56f2dcf674f.png' alt="Qt6设置"&gt;&#10;在&lt;code&gt;kvantum&lt;/code&gt;中点击&lt;code&gt;变更/删除主题&lt;/code&gt;，点击右边的小箭头，选择心仪的主题，随后点击&lt;code&gt;应用此主题&lt;/code&gt;，再点击右下角的退出&lt;br&gt;&#10;&lt;img loading="lazy" src='https://s1.imagehub.cc/images/2024/08/11/f15969e8f613ed1435f77b4883c2c017.png' alt="Kvantum2"&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="gtk"&gt;&lt;span&gt;GTK&lt;/span&gt;&#10; &lt;a href="#gtk" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;打开&lt;code&gt;nwg-look&lt;/code&gt;，在侧边栏选择好你心仪的主题（建议和&lt;code&gt;kvantum&lt;/code&gt;所选的主题一样，避免出现差异）。&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="最后"&gt;&lt;span&gt;最后&lt;/span&gt;&#10; &lt;a href="#%e6%9c%80%e5%90%8e" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你只需要在Hyprland的配置文件中添加&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# change to qt6ct if you have that&#10;env = QT_QPA_PLATFORMTHEME,qt6ct&#10;&#10;# Set dark theme for GTK apps&#10;exec = gsettings set org.gnome.desktop.interface gtk-theme &amp;#34;&amp;lt;Theme-Name&amp;gt;&amp;#34; # for GTK3 apps&#10;exec = gsettings set org.gnome.desktop.interface color-scheme &amp;#34;prefer-Dark&amp;#34; # for GTK4 apps&lt;/code&gt;&lt;/pre&gt;&lt;h3 class="heading-element" id="关于查看theme-name"&gt;&lt;span&gt;关于查看&lt;code&gt;Theme-Name&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%85%b3%e4%ba%8e%e6%9f%a5%e7%9c%8btheme-name" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;以上面的&lt;code&gt;catppuccin-gtk-theme-mocha&lt;/code&gt;为例&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -Ql catppuccin-gtk-theme-mocha | grep &amp;lt;你挑选好的主题名称（在`nwg-look`中查看，仅需`mocha-颜色`）&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后将&lt;code&gt;/usr/share/themes/catppuccin-mocha-*-standard+default/gtk-4.0/assets/scale-vert-marks-before-slider-dark@2.svg&lt;/code&gt;中的&lt;code&gt;catppuccin-mocha-*-standard+default&lt;/code&gt;复制下来，填充到上面的&lt;code&gt;&amp;lt;Theme-Name&amp;gt;&lt;/code&gt;中&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="可选"&gt;&lt;span&gt;可选&lt;/span&gt;&#10; &lt;a href="#%e5%8f%af%e9%80%89" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;安装图标主题，并且在&lt;code&gt;nwg-look&lt;/code&gt;和&lt;code&gt;qt6ct&lt;/code&gt;设置（&lt;code&gt;qt6ct&lt;/code&gt;中你只需要双击图标主题即可）&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="可能是我个人的原因这里有一些软件是不追随设置的甚至出现一半黑暗一半明亮的"&gt;&lt;span&gt;可能是我个人的原因，这里有一些软件是不追随设置的，甚至出现一半黑暗，一半明亮的😅😅&lt;/span&gt;&#10; &lt;a href="#%e5%8f%af%e8%83%bd%e6%98%af%e6%88%91%e4%b8%aa%e4%ba%ba%e7%9a%84%e5%8e%9f%e5%9b%a0%e8%bf%99%e9%87%8c%e6%9c%89%e4%b8%80%e4%ba%9b%e8%bd%af%e4%bb%b6%e6%98%af%e4%b8%8d%e8%bf%bd%e9%9a%8f%e8%ae%be%e7%bd%ae%e7%9a%84%e7%94%9a%e8%87%b3%e5%87%ba%e7%8e%b0%e4%b8%80%e5%8d%8a%e9%bb%91%e6%9a%97%e4%b8%80%e5%8d%8a%e6%98%8e%e4%ba%ae%e7%9a%84" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;</description></item><item><title>在GitHub中使用GPG验证提交</title><link>https://blog.sparkzh.top/posts/use_gpg_to_verify_in_github/</link><pubDate>Tue, 23 Jul 2024 16:30:01 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/use_gpg_to_verify_in_github/</guid><category domain="https://blog.sparkzh.top/categories/guide/">Guide</category><description>&lt;h1 class="heading-element" id="介绍"&gt;&lt;span&gt;介绍&lt;/span&gt;&#10; &lt;a href="#%e4%bb%8b%e7%bb%8d" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;首先，你需要知道，GitHub是有GitHub Docs的。&lt;a href="https://docs.github.com/zh" target="_blank" rel="external nofollow noopener noreferrer"&gt;传送门&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;br&gt;&#10;本文所提及的在GitHub Docs中也有。&lt;a href="https://docs.github.com/zh/authentication/managing-commit-signature-verification/about-commit-signature-verification" target="_blank" rel="external nofollow noopener noreferrer"&gt;传送&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="关于提交验证"&gt;&lt;span&gt;关于提交验证&lt;/span&gt;&#10; &lt;a href="#%e5%85%b3%e4%ba%8e%e6%8f%90%e4%ba%a4%e9%aa%8c%e8%af%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;blockquote&gt;&#10;&lt;p&gt;您可以在本地签署提交和标签，让其他人对您所做更改的源充满信心。&#10;对于大多数个人用户，GPG 或 SSH 会是对提交进行签名的最佳选择。&#10;生成 GPG 签名密钥比生成 SSH 密钥更复杂，但 GPG 具有 SSH 所没有的功能。 GPG 密钥可以在不再使用时过期或撤销。&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h1 class="heading-element" id="开始操作"&gt;&lt;span&gt;开始操作&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e6%93%8d%e4%bd%9c" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h2 class="heading-element" id="安装gnupg"&gt;&lt;span&gt;安装&lt;code&gt;gnupg&lt;/code&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85gnupg" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;&lt;del&gt;其实默认就安装了&lt;/del&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="生成密钥"&gt;&lt;span&gt;生成密钥&lt;/span&gt;&#10; &lt;a href="#%e7%94%9f%e6%88%90%e5%af%86%e9%92%a5" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;gpg --full-generate-key&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;如果使用默认值，请连续按两次回车键&#10;若想自定义，选择序号，第9是默认项&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Please select what kind of key you want:&#10; (1) RSA and RSA&#10; (2) DSA and Elgamal&#10; (3) DSA (sign only)&#10; (4) RSA (sign only)&#10; (9) ECC (sign and encrypt) *default*&#10; (10) ECC (sign only)&#10; (14) Existing key from card&#10;Your selection?&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;选择密钥的过期时间（默认选择0，表示永不过期）：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Please specify how long the key should be valid.&#10; 0 = key does not expire&#10; &amp;lt;n&amp;gt; = key expires in n days&#10; &amp;lt;n&amp;gt;w = key expires in n weeks&#10; &amp;lt;n&amp;gt;m = key expires in n months&#10; &amp;lt;n&amp;gt;y = key expires in n years&#10;Key is valid for? (0)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;确认信息，确认后输入&lt;code&gt;y&lt;/code&gt;：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Key does not expire at all&#10;Is this correct? (y/N)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;接下来就输入自己GitHub的用户名和注册GitHub时所使用的邮箱，当弹出时，可以直接回车，这只是添加注释：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Comment:&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在弹出时，输入&lt;code&gt;o&lt;/code&gt;表示确认：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;You selected this USER-ID:&#10; &amp;#34;Username of GitHub (comment) &amp;lt;name@example.com&amp;gt;&amp;#34;&#10;&#10;Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后输入密码来保护GPG密钥（必须，否则将不会创建）&lt;br&gt;&#10;然后重复刚才所输入的密码&#10;注：这里输入密码不会显示，&lt;del&gt;请尽管输入&lt;/del&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="查看密钥是否创建"&gt;&lt;span&gt;查看密钥是否创建&lt;/span&gt;&#10; &lt;a href="#%e6%9f%a5%e7%9c%8b%e5%af%86%e9%92%a5%e6%98%af%e5%90%a6%e5%88%9b%e5%bb%ba" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;gpg --list-secret-keys --keyid-format=long&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后你会看到&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sec 4096R/3AA5C34371567BD2 date &#10;uid Username-of-GitHub &amp;lt;name@example.com&amp;gt;&#10;ssb 4096R/4BB6D45482678BE3 date&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;注：此处你只需要复制第一行中在&lt;code&gt;4096R/&lt;/code&gt;后，在&lt;code&gt;date&lt;/code&gt;前的值，不需要包含空格，以下简称为&lt;code&gt;id&lt;/code&gt;，请举一反三!&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="查看密钥"&gt;&lt;span&gt;查看密钥&lt;/span&gt;&#10; &lt;a href="#%e6%9f%a5%e7%9c%8b%e5%af%86%e9%92%a5" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;使用&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;gpg --armor --export &amp;lt;id&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;你也可以使用&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;gpg --armor --export &amp;lt;Email&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来查看&lt;br&gt;&#10;在输出的一大串中，你需要复制：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;-----BEGIN PGP PUBLIC KEY BLOCK-----&#10;...................................&#10;-----END PGP PUBLIC KEY BLOCK-----&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;注：你需要将上面的一整段复制下来，包含&lt;code&gt;-----BEGIN PGP PUBLIC KEY BLOCK-----&lt;/code&gt;和&lt;code&gt;-----END PGP PUBLIC KEY BLOCK-----&lt;/code&gt;！！&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="将密钥添加到github账户中"&gt;&lt;span&gt;将密钥添加到GitHub账户中&lt;/span&gt;&#10; &lt;a href="#%e5%b0%86%e5%af%86%e9%92%a5%e6%b7%bb%e5%8a%a0%e5%88%b0github%e8%b4%a6%e6%88%b7%e4%b8%ad" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;&lt;del&gt;懒得写了，看Docs吧&lt;/del&gt;&#10;&lt;a href="https://docs.github.com/zh/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account" target="_blank" rel="external nofollow noopener noreferrer"&gt;将GPG密钥添加到GitHub账户中&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="在使用git-commit时你需要输入生成gpg密钥时所输入的密码"&gt;&lt;span&gt;在使用&lt;code&gt;git commit&lt;/code&gt;时，你需要输入生成GPG密钥时所输入的密码&lt;/span&gt;&#10; &lt;a href="#%e5%9c%a8%e4%bd%bf%e7%94%a8git-commit%e6%97%b6%e4%bd%a0%e9%9c%80%e8%a6%81%e8%be%93%e5%85%a5%e7%94%9f%e6%88%90gpg%e5%af%86%e9%92%a5%e6%97%b6%e6%89%80%e8%be%93%e5%85%a5%e7%9a%84%e5%af%86%e7%a0%81" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h1 class="heading-element" id="祝在git-commit签名时不报该用户没有gpg密钥"&gt;&lt;span&gt;祝：在Git commit签名时不报该用户没有GPG密钥&lt;/span&gt;&#10; &lt;a href="#%e7%a5%9d%e5%9c%a8git-commit%e7%ad%be%e5%90%8d%e6%97%b6%e4%b8%8d%e6%8a%a5%e8%af%a5%e7%94%a8%e6%88%b7%e6%b2%a1%e6%9c%89gpg%e5%af%86%e9%92%a5" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;</description></item><item><title>使用Hugo搭建Blog+Cloudflare Pages实现自动部署</title><link>https://blog.sparkzh.top/posts/hugo-blog-cloudflare/</link><pubDate>Fri, 19 Jul 2024 05:00:00 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/hugo-blog-cloudflare/</guid><category domain="https://blog.sparkzh.top/categories/blog/">Blog</category><description>&lt;h1 class="heading-element" id="hugo介绍"&gt;&lt;span&gt;Hugo介绍&lt;/span&gt;&#10; &lt;a href="#hugo%e4%bb%8b%e7%bb%8d" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;blockquote&gt;&#10;&lt;p&gt;Hugo是世界上最快的构建网页的框架&lt;br&gt;&#10;——&lt;a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer"&gt; Hugo官网 &lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h1 class="heading-element" id="安装hugo"&gt;&lt;span&gt;安装Hugo&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85hugo" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;Arch Linux：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -S hugo&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;其余发行版请自行使用包管理器搜索并安装&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="开始使用"&gt;&lt;span&gt;开始使用&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;首先创建一个空白网站&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo new site &amp;lt;Site_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;这个操作会创建一个文件夹，包含Hugo的默认文件&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="安装主题"&gt;&lt;span&gt;安装主题&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%b8%bb%e9%a2%98" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h3 class="heading-element" id="博客是写给自己看的"&gt;&lt;span&gt;&lt;del&gt;博客是写给自己看的&lt;/del&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%8d%9a%e5%ae%a2%e6%98%af%e5%86%99%e7%bb%99%e8%87%aa%e5%b7%b1%e7%9c%8b%e7%9a%84" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;所以挑选一个自己心仪的主题很重要。&lt;br&gt;&#10;你可以在Hugo的&lt;a href="https://themes.gohugo.io" target="_blank" rel="external nofollow noopener noreferrer"&gt;主题网站&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;中查找&#10;建议查找更新日期较近的主题，以避免有废弃的主题（可能失去了作者支持）。当然，只要你喜欢就好:)&#10;然后你可以点击&lt;code&gt;Download&lt;/code&gt;按钮，以跳转至GitHub页面，查看&lt;code&gt;README.md&lt;/code&gt;以安装主题。&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="这里以fixit主题为例"&gt;&lt;span&gt;这里以&lt;code&gt;FixIt&lt;/code&gt;主题为例&lt;/span&gt;&#10; &lt;a href="#%e8%bf%99%e9%87%8c%e4%bb%a5fixit%e4%b8%bb%e9%a2%98%e4%b8%ba%e4%be%8b" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;&lt;a href="https://fixit.lruihao.cn/zh-cn/" target="_blank" rel="external nofollow noopener noreferrer"&gt;FixIt主题网站&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;，你可以查看文档&lt;br&gt;&#10;转至&lt;a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external nofollow noopener noreferrer"&gt;GitHub页面&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;，你可以提出issue和pull request以解决问题和完善文档\&lt;/p&gt;&#10;&lt;h4 class="heading-element" id="安装主题-1"&gt;&lt;span&gt;安装主题&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%b8%bb%e9%a2%98-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h4&gt;&lt;p&gt;切换到博客目录，执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git init&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来初始化一个空的Git存储库（之后用于GitHub Actions自动构建部署网站）&#10;将[FixIt]主题作为Git子模块添加到你的项目中的&lt;code&gt;themes&lt;/code&gt;目录。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;备份目录中的&lt;code&gt;hugo.toml&lt;/code&gt;文件，并将主题中的&lt;code&gt;hugo.toml&lt;/code&gt;文件复制出来&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;mv hugo.toml hugo.toml.back &amp;amp;&amp;amp; cp /themes/FixIt/hugo.toml ./&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在站点配置文件中添加一行，指定当前主题。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;echo &amp;#34;theme = &amp;#39;FixIt&amp;#39;&amp;#34; &amp;gt;&amp;gt; hugo.toml&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在站点配置文件中添加一行，指定默认的内容语言。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;echo &amp;#34;defaultContentLanguage = &amp;#39;zh-cn&amp;#39;&amp;#34; &amp;gt;&amp;gt; hugo.toml&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后启动Hugo开发服务器以查看站点&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo server&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;del&gt;Hugo，启动！&lt;/del&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="写文章"&gt;&lt;span&gt;写文章&lt;/span&gt;&#10; &lt;a href="#%e5%86%99%e6%96%87%e7%ab%a0" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你需要将Markdown文章放入&lt;code&gt;content/posts&lt;/code&gt;文件夹中，然后执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来构建网站&#10;这并不会在本地启动开发服务器，而是将构建后的网页文件放在&lt;code&gt;public&lt;/code&gt;文件夹下&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="使用草稿"&gt;&lt;span&gt;使用草稿&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8%e8%8d%89%e7%a8%bf" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;在Hugo中，你可以使用&lt;code&gt;draft&lt;/code&gt;参数来表示该文章是草稿&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;---&#10;title: 我的第一篇文章&#10;date: 2024-03-01T17:10:04&amp;#43;08:00&#10;draft: true&#10;# ...&#10;---&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;若想连草稿一起构建，请执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo -D&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;同理，也可以在开发服务器中使用&lt;code&gt;-D&lt;/code&gt;。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="使用cloudflare-pages实现自动部署博客"&gt;&lt;span&gt;使用Cloudflare Pages实现自动部署博客&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8cloudflare-pages%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2%e5%8d%9a%e5%ae%a2" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;!--请不要尝试在Cloudflare Pages中构建Hugo博客~~，别问我怎么知道的~~--&gt;&#10;&lt;!--Cloudflare Pages所提供的Hugo版本落后，为`0.118`版本，貌似不支持tags和categories功能，如果想要使用，请使用其他的提供商！--&gt;&#10;&lt;p&gt;使用FixIt主题的话，请在Pages的设置中添加环境变量以指定Hugo版本&#10;如&lt;code&gt;HUGO_VERSION&lt;/code&gt;:&lt;code&gt;0.129.0&lt;/code&gt;&#10;首先，在GitHub中新建博客仓库，命名为&lt;code&gt;&amp;lt;User-name&amp;gt;.github.io&lt;/code&gt;&#10;在本地Git中添加远程仓库&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git remote add origin https://github.com/&amp;lt;User-name&amp;gt;/&amp;lt;User-name&amp;gt;.github.io.git&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后添加&lt;code&gt;.gitingore&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;vim .gitingore #Vim可替换为其他编辑器&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;加入以下内容&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;pubilc&#10;resource&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;保存退出&#10;然后上传到GitHub即可。不会的可以看&lt;a href="https://www.runoob.com/git/git-basic-operations.html" target="_blank" rel="external nofollow noopener noreferrer"&gt;这里&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;到Cloudflare官网，点击侧边栏的&lt;code&gt;Workers &amp;amp; Pages&lt;/code&gt;&#10;选择&lt;code&gt;Pages&lt;/code&gt;，点击连接到GitHub，选择你创建的博客仓库&#10;选择生产分支为你Hugo博客存放的分支，框架预设选择&lt;code&gt;Hugo&lt;/code&gt;，构建命令不改。&#10;若使用&lt;code&gt;tags&lt;/code&gt;和&lt;code&gt;categories&lt;/code&gt;，请添加环境变量：&#10;&lt;code&gt;HUGO_VERSION = 0.129.0&lt;/code&gt;&#10;然后将一个小更改push到GitHub，Cloudflare会自动部署，给你一个二级域名。&#10;你也可以自定义，请自行搜索。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="all-done-enjoy-it"&gt;&lt;span&gt;All done! Enjoy it!&lt;/span&gt;&#10; &lt;a href="#all-done-enjoy-it" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;</description></item><item><title>使用Hugo搭建Blog+GitHub Actions实现自动部署</title><link>https://blog.sparkzh.top/posts/hugo-blog-github/</link><pubDate>Thu, 18 Jul 2024 12:00:59 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/hugo-blog-github/</guid><category domain="https://blog.sparkzh.top/categories/blog/">Blog</category><description>&lt;h1 class="heading-element" id="hugo介绍"&gt;&lt;span&gt;Hugo介绍&lt;/span&gt;&#10; &lt;a href="#hugo%e4%bb%8b%e7%bb%8d" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;blockquote&gt;&#10;&lt;p&gt;Hugo是世界上最快的构建网页的框架&lt;br&gt;&#10;——&lt;a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreferrer"&gt; Hugo官网 &lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h1 class="heading-element" id="安装hugo"&gt;&lt;span&gt;安装Hugo&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85hugo" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;Arch Linux：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -S hugo&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;其余发行版请自行使用包管理器搜索并安装&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="开始使用"&gt;&lt;span&gt;开始使用&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;首先创建一个空白网站&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo new site &amp;lt;Site_name&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;这个操作会创建一个文件夹，包含Hugo的默认文件&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="安装主题"&gt;&lt;span&gt;安装主题&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%b8%bb%e9%a2%98" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;h3 class="heading-element" id="博客是写给自己看的"&gt;&lt;span&gt;&lt;del&gt;博客是写给自己看的&lt;/del&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%8d%9a%e5%ae%a2%e6%98%af%e5%86%99%e7%bb%99%e8%87%aa%e5%b7%b1%e7%9c%8b%e7%9a%84" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;所以挑选一个自己心仪的主题很重要。&lt;br&gt;&#10;你可以在Hugo的&lt;a href="https://themes.gohugo.io" target="_blank" rel="external nofollow noopener noreferrer"&gt;主题网站&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;中查找&#10;建议查找更新日期较近的主题，以避免有废弃的主题（可能失去了作者支持）。当然，只要你喜欢就好:)&#10;然后你可以点击&lt;code&gt;Download&lt;/code&gt;按钮，以跳转至GitHub页面，查看&lt;code&gt;README.md&lt;/code&gt;以安装主题。&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="这里以fixit主题为例"&gt;&lt;span&gt;这里以&lt;code&gt;FixIt&lt;/code&gt;主题为例&lt;/span&gt;&#10; &lt;a href="#%e8%bf%99%e9%87%8c%e4%bb%a5fixit%e4%b8%bb%e9%a2%98%e4%b8%ba%e4%be%8b" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;&lt;a href="https://fixit.lruihao.cn/zh-cn/" target="_blank" rel="external nofollow noopener noreferrer"&gt;FixIt主题网站&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;，你可以查看文档&lt;br&gt;&#10;转至&lt;a href="https://github.com/hugo-fixit/FixIt" target="_blank" rel="external nofollow noopener noreferrer"&gt;GitHub页面&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;，你可以提出issue和pull request以解决问题和完善文档\&lt;/p&gt;&#10;&lt;h4 class="heading-element" id="安装主题-1"&gt;&lt;span&gt;安装主题&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85%e4%b8%bb%e9%a2%98-1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h4&gt;&lt;p&gt;切换到博客目录，执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git init&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来初始化一个空的Git存储库（之后用于GitHub Actions自动构建部署网站）&#10;将[FixIt]主题作为Git子模块添加到你的项目中的&lt;code&gt;themes&lt;/code&gt;目录。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git submodule add https://github.com/hugo-fixit/FixIt.git themes/FixIt&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;备份目录中的&lt;code&gt;hugo.toml&lt;/code&gt;文件，并将主题中的&lt;code&gt;hugo.toml&lt;/code&gt;文件复制出来&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;mv hugo.toml hugo.toml.back &amp;amp;&amp;amp; cp /themes/FixIt/hugo.toml ./&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在站点配置文件中添加一行，指定当前主题。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;echo &amp;#34;theme = &amp;#39;FixIt&amp;#39;&amp;#34; &amp;gt;&amp;gt; hugo.toml&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在站点配置文件中添加一行，指定默认的内容语言。&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;echo &amp;#34;defaultContentLanguage = &amp;#39;zh-cn&amp;#39;&amp;#34; &amp;gt;&amp;gt; hugo.toml&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后启动Hugo开发服务器以查看站点&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo server&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;del&gt;Hugo，启动！&lt;/del&gt;&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="写文章"&gt;&lt;span&gt;写文章&lt;/span&gt;&#10; &lt;a href="#%e5%86%99%e6%96%87%e7%ab%a0" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;你需要将Markdown文章放入&lt;code&gt;content/posts&lt;/code&gt;文件夹中，然后执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;来构建网站&#10;这并不会在本地启动开发服务器，而是将构建后的网页文件放在&lt;code&gt;public&lt;/code&gt;文件夹下&lt;/p&gt;&#10;&lt;h3 class="heading-element" id="使用草稿"&gt;&lt;span&gt;使用草稿&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8%e8%8d%89%e7%a8%bf" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;p&gt;在Hugo中，你可以使用&lt;code&gt;draft&lt;/code&gt;参数来表示该文章是草稿&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;---&#10;title: 我的第一篇文章&#10;date: 2024-03-01T17:10:04&amp;#43;08:00&#10;draft: true&#10;# ...&#10;---&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;若想连草稿一起构建，请执行&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;hugo -D&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;同理，也可以在开发服务器中使用&lt;code&gt;-D&lt;/code&gt;。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="使用github-actions实现自动部署博客"&gt;&lt;span&gt;使用GitHub Actions实现自动部署博客&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8github-actions%e5%ae%9e%e7%8e%b0%e8%87%aa%e5%8a%a8%e9%83%a8%e7%bd%b2%e5%8d%9a%e5%ae%a2" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;!--请不要尝试在Cloudflare Pages中构建Hugo博客~~，别问我怎么知道的~~--&gt;&#10;&lt;!--Cloudflare Pages所提供的Hugo版本落后，为`0.118`版本，貌似不支持tags和categories功能，如果想要使用，请使用其他的提供商！--&gt;&#10;&lt;p&gt;首先，在GitHub中新建博客仓库，命名为&lt;code&gt;&amp;lt;User-name&amp;gt;.github.io&lt;/code&gt;&#10;在本地Git中添加远程仓库&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;git remote add origin https://github.com/&amp;lt;User-name&amp;gt;/&amp;lt;User-name&amp;gt;.github.io.git&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后新建文件夹&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;mkdir .github/workflows&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;新建一个YAML文件，文件名随意，输入以下内容&#10;若使用以下代码，请认真看代码后的注意事项！&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;# 使用GitHub Actions自动部署Hugo博客&#10;name: Hugo-Build&#10;on:&#10; push:&#10; branches:&#10; - Hugo&#10;permissions:&#10; contents: write&#10;jobs:&#10; build:&#10; runs-on: ubuntu-latest&#10; steps:&#10; - name: Checkout repo&#10; uses: actions/checkout@v4&#10; - name: Install Hugo&#10; uses: peaceiris/actions-hugo@v3&#10; with:&#10; hugo-version: &amp;#39;0.129.0&amp;#39;&#10; extended: true&#10; - name: Hugo Build&#10; run: |&#10; git submodule update --init --remote --merge themes/FixIt&#10; hugo&#10; # - name: Deploy&#10; # uses: peaceiris/actions-gh-pages@v3&#10; # with:&#10; # github_token: ${{ secrets.GITHUB_TOKEN }}&#10; # publish_dir: ./public&#10; # cname: pilihu2022.github.io&#10; - name: Deploy&#10; uses: JamesIves/github-pages-deploy-action@v4&#10; with:&#10; branch: gh-pages&#10; folder: public&lt;/code&gt;&lt;/pre&gt;&lt;h2 class="heading-element" id="注意事项"&gt;&lt;span&gt;&lt;mark class="mark-default"&gt;注意事项&lt;/mark&gt;&lt;/span&gt;&#10; &lt;a href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;ol&gt;&#10;&lt;li&gt;在&lt;code&gt;branches&lt;/code&gt;下的&lt;code&gt;hugo&lt;/code&gt;，需修改为你存放博客的分支&lt;/li&gt;&#10;&lt;li&gt;注释的代码可删除，也可使用，其中的&lt;code&gt;github_token&lt;/code&gt;不需要理会，GitHub Action的机器会自动生成&lt;/li&gt;&#10;&lt;li&gt;两个&lt;code&gt;Deploy&lt;/code&gt;任选其一即可，不要重复使用！&lt;/li&gt;&#10;&lt;li&gt;若没有在GitHub中找到Actions的选项，请自行搜索‘GitHub如何开启Actions’&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 class="heading-element" id="使用github-pages"&gt;&lt;span&gt;使用GitHub Pages&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8github-pages" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;在&lt;code&gt;Settings&lt;/code&gt; &amp;gt; &lt;code&gt;Pages&lt;/code&gt;，在&lt;code&gt;Source&lt;/code&gt;中选择&lt;code&gt;Deploy from a branch&lt;/code&gt;，随后选择&lt;code&gt;gh_pages&lt;/code&gt;，点击&lt;code&gt;Save&lt;/code&gt;按钮，稍等片刻即可看见看见顶栏有提示：&#10;&lt;code&gt;Your site is live at https://&amp;lt;User-name&amp;gt;.github.io/&lt;/code&gt;&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="结束祝各位部署github-actions时不报错报错可联系"&gt;&lt;span&gt;结束，祝各位部署GitHub Actions时不报错，报错可&lt;a href="mailto:2812167783@qq.com"&gt;联系&lt;/a&gt;&lt;/span&gt;&#10; &lt;a href="#%e7%bb%93%e6%9d%9f%e7%a5%9d%e5%90%84%e4%bd%8d%e9%83%a8%e7%bd%b2github-actions%e6%97%b6%e4%b8%8d%e6%8a%a5%e9%94%99%e6%8a%a5%e9%94%99%e5%8f%af%e8%81%94%e7%b3%bb" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;</description></item><item><title>Arch Linux自动登录</title><link>https://blog.sparkzh.top/posts/auto-login-arch/</link><pubDate>Mon, 12 Feb 2024 22:18:02 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/auto-login-arch/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="arch-linux怎么自动登录而且是免密的应该会有一些人会这样想毕竟如果用户名的密码过长而且密码错以后又要重输想必是让人血压升高的问题今天教程来了"&gt;&lt;span&gt;Arch Linux怎么自动登录，而且是免密的，应该会有一些人会这样想，毕竟如果用户名的密码过长，而且密码错以后又要重输，想必是让人血压升高的问题。今天，教程来了&lt;/span&gt;&#10; &lt;a href="#arch-linux%e6%80%8e%e4%b9%88%e8%87%aa%e5%8a%a8%e7%99%bb%e5%bd%95%e8%80%8c%e4%b8%94%e6%98%af%e5%85%8d%e5%af%86%e7%9a%84%e5%ba%94%e8%af%a5%e4%bc%9a%e6%9c%89%e4%b8%80%e4%ba%9b%e4%ba%ba%e4%bc%9a%e8%bf%99%e6%a0%b7%e6%83%b3%e6%af%95%e7%ab%9f%e5%a6%82%e6%9e%9c%e7%94%a8%e6%88%b7%e5%90%8d%e7%9a%84%e5%af%86%e7%a0%81%e8%bf%87%e9%95%bf%e8%80%8c%e4%b8%94%e5%af%86%e7%a0%81%e9%94%99%e4%bb%a5%e5%90%8e%e5%8f%88%e8%a6%81%e9%87%8d%e8%be%93%e6%83%b3%e5%bf%85%e6%98%af%e8%ae%a9%e4%ba%ba%e8%a1%80%e5%8e%8b%e5%8d%87%e9%ab%98%e7%9a%84%e9%97%ae%e9%a2%98%e4%bb%8a%e5%a4%a9%e6%95%99%e7%a8%8b%e6%9d%a5%e4%ba%86" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="当然免密登录也会出现一些安全问题"&gt;&lt;span&gt;当然免密登录也会出现一些安全问题&lt;/span&gt;&#10; &lt;a href="#%e5%bd%93%e7%84%b6%e5%85%8d%e5%af%86%e7%99%bb%e5%bd%95%e4%b9%9f%e4%bc%9a%e5%87%ba%e7%8e%b0%e4%b8%80%e4%ba%9b%e5%ae%89%e5%85%a8%e9%97%ae%e9%a2%98" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="本教程具有一定的时限性具体操作以arch-wiki为准"&gt;&lt;span&gt;本教程具有一定的时限性，具体操作以Arch Wiki为准！&lt;/span&gt;&#10; &lt;a href="#%e6%9c%ac%e6%95%99%e7%a8%8b%e5%85%b7%e6%9c%89%e4%b8%80%e5%ae%9a%e7%9a%84%e6%97%b6%e9%99%90%e6%80%a7%e5%85%b7%e4%bd%93%e6%93%8d%e4%bd%9c%e4%bb%a5arch-wiki%e4%b8%ba%e5%87%86" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="参考arch-wikigetty"&gt;&lt;span&gt;参考Arch Wiki:&lt;a href="https://wiki.archlinuxcn.org/wiki/Getty" target="_blank" rel="external nofollow noopener noreferrer"&gt;Getty&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/span&gt;&#10; &lt;a href="#%e5%8f%82%e8%80%83arch-wikigetty" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;h1 class="heading-element" id="开始操作"&gt;&lt;span&gt;开始操作&lt;/span&gt;&#10; &lt;a href="#%e5%bc%80%e5%a7%8b%e6%93%8d%e4%bd%9c" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;pre&gt;&lt;code&gt;sudo pacman -S util-linux&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;若已安装可不用重新安装&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="写入一个systemd服务文件"&gt;&lt;span&gt;写入一个systemd服务文件:&lt;/span&gt;&#10; &lt;a href="#%e5%86%99%e5%85%a5%e4%b8%80%e4%b8%aasystemd%e6%9c%8d%e5%8a%a1%e6%96%87%e4%bb%b6" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;sudo nvim /etc/systemd/system/getty@tty1.service.d/override.conf&lt;/code&gt;&lt;/pre&gt;&lt;h3 class="heading-element" id="若没有getty1serviced文件夹请创建"&gt;&lt;span&gt;若没有&lt;code&gt;getty@1.service.d&lt;/code&gt;文件夹，请创建:&lt;/span&gt;&#10; &lt;a href="#%e8%8b%a5%e6%b2%a1%e6%9c%89getty1serviced%e6%96%87%e4%bb%b6%e5%a4%b9%e8%af%b7%e5%88%9b%e5%bb%ba" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h3&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir /etc/systemd/system/getty@tty1.service.d&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;将以下代码写入/etc/systemd/system/getty@tty1.service.d/override.conf中:&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;[Service]&#10;ExecStart=&#10;ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;注:这里的username要更改为你的用户名,不能照抄&lt;del&gt;别问我是怎么知道的&lt;/del&gt;&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;del&gt;若你不知道你的用户名，请使用以下命令来查看&lt;/del&gt;&lt;/strong&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;whoami&lt;/code&gt;&lt;/pre&gt;&lt;h2 class="heading-element" id="启动该服务"&gt;&lt;span&gt;启动该服务&lt;/span&gt;&#10; &lt;a href="#%e5%90%af%e5%8a%a8%e8%af%a5%e6%9c%8d%e5%8a%a1" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable getty@tty1&lt;/code&gt;&lt;/pre&gt;&lt;h1 class="heading-element" id="抢救方法如果没有照抄上面的代码可以不看"&gt;&lt;span&gt;抢救方法(如果没有照抄上面的代码,可以不看)&lt;/span&gt;&#10; &lt;a href="#%e6%8a%a2%e6%95%91%e6%96%b9%e6%b3%95%e5%a6%82%e6%9e%9c%e6%b2%a1%e6%9c%89%e7%85%a7%e6%8a%84%e4%b8%8a%e9%9d%a2%e7%9a%84%e4%bb%a3%e7%a0%81%e5%8f%af%e4%bb%a5%e4%b8%8d%e7%9c%8b" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;我们先解析一下服务文件名,从&amp;quot;getty@tty1&amp;quot;中，我们得知这个服务是针对tty1的，对其他tty不受影响(如tty2)&lt;/p&gt;&#10;&lt;h2 class="heading-element" id="切换到其他tty"&gt;&lt;span&gt;切换到其他tty&lt;/span&gt;&#10; &lt;a href="#%e5%88%87%e6%8d%a2%e5%88%b0%e5%85%b6%e4%bb%96tty" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h2&gt;&lt;p&gt;按住&lt;code&gt;Ctrl+shift+&amp;lt;F2&amp;gt;&lt;/code&gt;切换到tty2，然后登录用户，修改刚刚的配置文件&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo nvim /etc/systemd/system/getty@tty1.service.d/override.conf&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;然后将&lt;code&gt;username&lt;/code&gt;改为你的用户名&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="来看看作者是怎么修的"&gt;&lt;span&gt;&lt;del&gt;来看看作者是怎么修的&lt;/del&gt;&lt;/span&gt;&#10; &lt;a href="#%e6%9d%a5%e7%9c%8b%e7%9c%8b%e4%bd%9c%e8%80%85%e6%98%af%e6%80%8e%e4%b9%88%e4%bf%ae%e7%9a%84" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;重启进入liveCD，挂载Arch Linux所在的硬盘，然后修改配置文件&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo vim /mnt/etc/systemd/system/getty@tty1.service.d/override.conf&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;将&lt;code&gt;username&lt;/code&gt;修改为我的用户名，重启&lt;/p&gt;&#10;</description></item><item><title>在Arch Linux上安装AMD显卡驱动</title><link>https://blog.sparkzh.top/posts/install-amd-graphics-on-arch/</link><pubDate>Sat, 27 Jan 2024 20:45:01 +0800</pubDate><author>Spark-CN@outlook.com (Spark)</author><guid>https://blog.sparkzh.top/posts/install-amd-graphics-on-arch/</guid><category domain="https://blog.sparkzh.top/categories/arch-linux/">Arch Linux</category><description>&lt;h1 class="heading-element" id="设备"&gt;&lt;span&gt;设备:&lt;/span&gt;&#10; &lt;a href="#%e8%ae%be%e5%a4%87" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;ul&gt;&#10;&lt;li&gt;显卡：AMD Radeon RX 6500 XT&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h1 class="heading-element" id="参照wiki"&gt;&lt;span&gt;参照Wiki&lt;/span&gt;&#10; &lt;a href="#%e5%8f%82%e7%85%a7wiki" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;如果动手能力及理解能力比较好的话可以参考ArchWiki：&#10;&lt;a href="https://wiki.archlinuxcn.org/wiki/AMDGPU" target="_blank" rel="external nofollow noopener noreferrer"&gt;AMDGPU&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://wiki.archlinuxcn.org/wiki/ATI" target="_blank" rel="external nofollow noopener noreferrer"&gt;ATI&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://arch.icekylin.online/guide/rookie/graphic-driver.html#%E7%8B%AC%E7%AB%8B%E6%98%BE%E5%8D%A1" target="_blank" rel="external nofollow noopener noreferrer"&gt;Arch简明指南-Arch显卡驱动&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;（不推荐！可能更新不及时，不过你可以参考一下那里的查看显卡架构小结）&lt;/p&gt;&#10;&lt;p&gt;Warning：不要查看野教程！！不要查看野教程！！不要查看野教程！！&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="安装"&gt;&lt;span&gt;安装&lt;/span&gt;&#10; &lt;a href="#%e5%ae%89%e8%a3%85" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;如果你碰巧与我使用的显卡是一样的，&lt;del&gt;很好，你仍可能需要参照Wiki&lt;/del&gt;&#10;&lt;mark class="mark-default"&gt;此处以AMD Radeon RX 6500 XT为例，安装AMDGPU驱动，ATI驱动请自行Google和参照Arch Wiki&lt;/mark&gt;&#10;首先需要安装&lt;code&gt;mesa&lt;/code&gt;包，使用以下命令：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -S mesa lib32-mesa # lib32-mesa是对于32位程序，需要开启multilib&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;添加DDX驱动支持：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -S xf86-video-amdgpu&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;在Wiki上所提到的其他软件，可以按需求安装，但是安装后的&lt;code&gt;llvm&lt;/code&gt;和&lt;code&gt;llvm-libs&lt;/code&gt;是没有&lt;code&gt;-git&lt;/code&gt;结尾，否则，请重新安装&lt;code&gt;llvm&lt;/code&gt;和&lt;code&gt;llvm-libs&lt;/code&gt;：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;sudo pacman -S llvm llvm-libs&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;如果遇到有包依赖，请卸载掉(因为这些包大概都可能是以&lt;code&gt;-git&lt;/code&gt;)结尾的，安装好&lt;code&gt;llvm&lt;/code&gt;和&lt;code&gt;llvm-libs&lt;/code&gt;后再安装回刚刚卸载的包(应该是没有&lt;code&gt;-git&lt;/code&gt;结尾的)&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="以下是我求助的图片及帖文"&gt;&lt;span&gt;以下是我求助的图片及帖文&lt;/span&gt;&#10; &lt;a href="#%e4%bb%a5%e4%b8%8b%e6%98%af%e6%88%91%e6%b1%82%e5%8a%a9%e7%9a%84%e5%9b%be%e7%89%87%e5%8f%8a%e5%b8%96%e6%96%87" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;&lt;a href="https://bbs.archlinuxcn.org/viewtopic.php?id=14013" target="_blank" rel="external nofollow noopener noreferrer"&gt;帖文&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://s1.imagehub.cc/images/2024/01/26/1853fdbb328161e95bce6608f155e39a.jpeg" target="_blank" rel="external nofollow noopener noreferrer"&gt;电报中文群组1-图床&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://s1.imagehub.cc/images/2024/01/26/15fadfc09ed8a6f85bb2177d12e7e6a0.png" target="_blank" rel="external nofollow noopener noreferrer"&gt;电报中文群组2-图床&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://pilihu2023-my.sharepoint.com/:i:/g/personal/pilihu_pilihu2023_onmicrosoft_com/EYyv6xJUqHBJnx04Q13hmCQBVg9XeTU1bNJv3iqt06YBOw?e=kYMRs3" target="_blank" rel="external nofollow noopener noreferrer"&gt;电报中文群组1-OneDrive&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&#10;&lt;a href="https://pilihu2023-my.sharepoint.com/:i:/g/personal/pilihu_pilihu2023_onmicrosoft_com/EQ3LrS0CMz1ApN4tsH4ea6MBKeGqIPw7SC-YS9ycU5-SnQ?e=vBQIed" target="_blank" rel="external nofollow noopener noreferrer"&gt;电报中文群组2-OneDrive&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/p&gt;&#10;</description></item></channel></rss>