From 93f676c92132b50fd7ecc32aac05442fd2916018 Mon Sep 17 00:00:00 2001 From: FangcatChina Date: Fri, 31 Jul 2026 14:33:20 +0800 Subject: Merge #16, migrate Actions to GIthub --- .gitea/workflows/mkdocs-deploy.yml | 60 ------------------------- .gitea/workflows/mkdocs-deploy.yml.disabled | 60 +++++++++++++++++++++++++ .github/workflows/mkdocs-deploy.yml | 60 +++++++++++++++++++++++++ .github/workflows/sync_to_gitea.yml | 15 ------- .github/workflows/sync_to_gitea.yml.disabled | 15 +++++++ docs/applications/vim.md | 66 +++++++++++++++------------- mkdocs.yml | 1 + 7 files changed, 172 insertions(+), 105 deletions(-) delete mode 100644 .gitea/workflows/mkdocs-deploy.yml create mode 100644 .gitea/workflows/mkdocs-deploy.yml.disabled create mode 100644 .github/workflows/mkdocs-deploy.yml delete mode 100644 .github/workflows/sync_to_gitea.yml create mode 100644 .github/workflows/sync_to_gitea.yml.disabled diff --git a/.gitea/workflows/mkdocs-deploy.yml b/.gitea/workflows/mkdocs-deploy.yml deleted file mode 100644 index efdbf7b..0000000 --- a/.gitea/workflows/mkdocs-deploy.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Deploy MkDocs to Another Repository - -on: - push: - branches: - - main - paths: - - 'docs/**' - - 'mkdocs.yml' - - 'overrides/**' - - '.gitea/workflows/mkdocs-deploy.yml' - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.13' - cache: '' # No Cache - - - name: Install MkDocs dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Build MkDocs site - run: mkdocs build --strict - env: - DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} - - - name: Deploy to target repository - env: - TARGET_REPO: https://github.com/LinuxCabin/handbook-site - TARGET_BRANCH: gh-pages - DEPLOY_TOKEN: ${{ secrets.DEPLOY_KEY }} - CUSTOM_DOMAIN: hb.091209.xyz - run: | - cd site - echo "${{ env.CUSTOM_DOMAIN }}" > CNAME # 创建 CNAME 文件 - git init - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add . - git commit -m "Deploy site $(date -u '+%Y-%m-%d %H:%M:%S UTC')" - git push --force https://x-access-token:${DEPLOY_TOKEN}@${TARGET_REPO#https://} HEAD:${TARGET_BRANCH} \ No newline at end of file diff --git a/.gitea/workflows/mkdocs-deploy.yml.disabled b/.gitea/workflows/mkdocs-deploy.yml.disabled new file mode 100644 index 0000000..efdbf7b --- /dev/null +++ b/.gitea/workflows/mkdocs-deploy.yml.disabled @@ -0,0 +1,60 @@ +name: Deploy MkDocs to Another Repository + +on: + push: + branches: + - main + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'overrides/**' + - '.gitea/workflows/mkdocs-deploy.yml' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: '' # No Cache + + - name: Install MkDocs dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Build MkDocs site + run: mkdocs build --strict + env: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + + - name: Deploy to target repository + env: + TARGET_REPO: https://github.com/LinuxCabin/handbook-site + TARGET_BRANCH: gh-pages + DEPLOY_TOKEN: ${{ secrets.DEPLOY_KEY }} + CUSTOM_DOMAIN: hb.091209.xyz + run: | + cd site + echo "${{ env.CUSTOM_DOMAIN }}" > CNAME # 创建 CNAME 文件 + git init + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Deploy site $(date -u '+%Y-%m-%d %H:%M:%S UTC')" + git push --force https://x-access-token:${DEPLOY_TOKEN}@${TARGET_REPO#https://} HEAD:${TARGET_BRANCH} \ No newline at end of file diff --git a/.github/workflows/mkdocs-deploy.yml b/.github/workflows/mkdocs-deploy.yml new file mode 100644 index 0000000..1df857d --- /dev/null +++ b/.github/workflows/mkdocs-deploy.yml @@ -0,0 +1,60 @@ +name: Deploy MkDocs to Another Repository + +on: + push: + branches: + - main + paths: + - 'docs/**' + - 'mkdocs.yml' + - 'overrides/**' + - '.github/workflows/mkdocs-deploy.yml' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + cache: 'pip' + + - name: Install MkDocs dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Build MkDocs site + run: mkdocs build --strict + env: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + + - name: Deploy to target repository + env: + TARGET_REPO: https://github.com/LinuxCabin/handbook-site + TARGET_BRANCH: gh-pages + DEPLOY_TOKEN: ${{ secrets.DEPLOY_KEY }} + CUSTOM_DOMAIN: hb.091209.xyz + run: | + cd site + echo "${{ env.CUSTOM_DOMAIN }}" > CNAME + git init + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Deploy site $(date -u '+%Y-%m-%d %H:%M:%S UTC')" + git push --force https://x-access-token:${DEPLOY_TOKEN}@${TARGET_REPO#https://} HEAD:${TARGET_BRANCH} \ No newline at end of file diff --git a/.github/workflows/sync_to_gitea.yml b/.github/workflows/sync_to_gitea.yml deleted file mode 100644 index b42a7d2..0000000 --- a/.github/workflows/sync_to_gitea.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Sync to Gitea -on: - push: - branches: [ main ] - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Trigger Gitea mirror sync - env: - GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - run: | - curl -X POST \ - "https://git.13-trixie.top/api/v1/repos/LinuxCabin/linux-handbook/mirror-sync?token=${{ secrets.GITEA_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/sync_to_gitea.yml.disabled b/.github/workflows/sync_to_gitea.yml.disabled new file mode 100644 index 0000000..b42a7d2 --- /dev/null +++ b/.github/workflows/sync_to_gitea.yml.disabled @@ -0,0 +1,15 @@ +name: Sync to Gitea +on: + push: + branches: [ main ] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Trigger Gitea mirror sync + env: + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + run: | + curl -X POST \ + "https://git.13-trixie.top/api/v1/repos/LinuxCabin/linux-handbook/mirror-sync?token=${{ secrets.GITEA_TOKEN }}" \ No newline at end of file diff --git a/docs/applications/vim.md b/docs/applications/vim.md index c54d719..02b4111 100644 --- a/docs/applications/vim.md +++ b/docs/applications/vim.md @@ -1,11 +1,12 @@ -# vim +# Vim -`vim` 是一款终端文本编辑器, 几乎所有的Linux发行版都会预装 -第一次使用vim的人,最大的感受一定是: 反人类 -vim 虽然前期学起来困难, 但是上限极高,一旦熟练你很难接受其他的编辑器(我自己是这样的) +`vim` 是一款终端文本编辑器, 几乎所有的Linux发行版都会预装。 -话虽如此,在终端用vim 改个配置文件依旧是很多Linux玩家的日常 -所以我们有必要稍微学习一下如何使用vim完成以下基础的操作 +第一次使用vim的人,最大的感受一定是: 反人类。 +Vim 虽然前期学起来困难, 但是上限极高,一旦熟练你很难接受其他的编辑器(我自己是这样的)。 + +话虽如此,在终端用Vim改个配置文件依旧是很多Linux玩家的日常 +所以我们有必要稍微学习一下如何使用Vim完成以下基础的操作。 --- @@ -31,11 +32,11 @@ vim 虽然前期学起来困难, 但是上限极高,一旦熟练你很难接 ## 模式的转换 -我们可以将 **NORMAL** 视作 vim 模式的中心枢纽 -因为**所有的模式下,按esc键都能变成普通模式** -并且 普通模式 只需要按一个键就可以切换到各种模式 +我们可以将 **NORMAL** 视作 vim 模式的中心枢纽。 +因为**所有的模式下,按esc键都能变成普通模式**。 +并且 普通模式 只需要按一个键就可以切换到各种模式。 -所以我们只需要记住下面的内容即可 (对于新手来说) +所以我们只需要记住下面的内容即可 (对于新手来说): 当你处于非普通模式的时候: @@ -46,19 +47,17 @@ vim 虽然前期学起来困难, 但是上限极高,一旦熟练你很难接 - i -> 进入插入模式 - : -> 进入命令模式(没错这里就是打个冒号) ---- - ## 一般流程 - 打开文件 -```bash -# 使用 vim 打开你需要编辑的文件 -# 语法是 vim 路径 -vim /path/to/file -``` + ```bash + # 使用 vim 打开你需要编辑的文件 + # 语法是 vim 路径 + vim /path/to/file + ``` -打开之后就是普通模式 + 打开之后就是普通模式。 - 移动 这个时候如果不是空的文件,你一般需要移动 @@ -66,20 +65,27 @@ vim /path/to/file 或者用这个**超人类语法** -> h j k l (分别对应 左 下 上 右 的方向键) - 进入插入模式进行编辑 -按下 `i` 键, **看到左下角出现INSERT** -然后就是正常的编辑工作 + + 按下 `i` 键, **看到左下角出现INSERT**,然后就是正常的编辑工作 - 保存修改 -我们需要使用命令模式保存修改,所以第一步是先按 Esc 回到普通模式 -这个时候你会发现左下角的INSERT消失了 -然后按 `:` 进入命令模式 -> 你会看到左下角出现 冒号 -输入 `w` (表示我要将修改写入文件, 也就是 write) -回车 (这个时候你已经保存了修改) -输入 `q` (表示我要退出vim, 也就是quit) -回车 -这个时候你已经成功使用 vim 完成了编辑工作 + 我们需要使用命令模式保存修改,所以第一步是先按 Esc 回到普通模式。 + + 这个时候你会发现左下角的INSERT消失了, + + 然后按 `:` 进入命令模式 -> 你会看到左下角出现冒号 + + 输入 `w` (表示我要将修改写入文件, 也就是 write) + + 回车 (这个时候你已经保存了修改) + + 输入 `q` (表示我要退出vim, 也就是quit) + + 回车 + + 这个时候你已经成功使用 vim 完成了编辑工作 -> 当然命令模式是可以一次执行多个命令的, 可以直接 `:wq` 表示保存并退出文件 + > 当然命令模式是可以一次执行多个命令的, 可以直接 `:wq` 表示保存并退出文件 --- @@ -87,4 +93,4 @@ vim /path/to/file > 这里补充一些教程,但是入门的话使用当前的文档足矣 -[蛋老师bilibili教程](https://www.bilibili.com/video/BV13t4y1t7Wg?t=87.5) +[蛋老师Bilibili教程](https://www.bilibili.com/video/BV13t4y1t7Wg?t=87.5) diff --git a/mkdocs.yml b/mkdocs.yml index 98be5bb..ec2e3b6 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -164,6 +164,7 @@ nav: - compatibility/windows/steam.md # - 跨发行版: - 应用: + - applications/vim.md - applications/zsh.md - applications/openclaw.md - 开发相关: -- cgit v1.3