From 65e3b15b9ce97e9b2610c2c6a77a1e4c1dbb2bf8 Mon Sep 17 00:00:00 2001 From: iGxnon Date: Sun, 28 Jan 2024 18:22:57 +0800 Subject: [PATCH] typos Signed-off-by: iGxnon --- .pre-commit-config.yaml | 6 ++++++ course/basic/process_control/switch.md | 2 +- course/engineering/build-system.md | 2 +- course/environment/install-environment.md | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c4a9bd22 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +fail_fast: false +repos: + - repo: https://github.com/crate-ci/typos + rev: v1.16.0 + hooks: + - id: typos diff --git a/course/basic/process_control/switch.md b/course/basic/process_control/switch.md index f7a01ee7..88e6b0af 100644 --- a/course/basic/process_control/switch.md +++ b/course/basic/process_control/switch.md @@ -202,7 +202,7 @@ const result = switch (color) { switch 的分支可以标记为 `inline` 来要求编译器生成该分支对应的所有可能分支: ```zig -// 这段函数用来判断一个结构体的字段是否是 optinal,同时它也是 comptime 的 +// 这段函数用来判断一个结构体的字段是否是 optional,同时它也是 comptime 的 // 故我们可以在下面使用inline 来要求编译器帮我们展开这个switch fn isFieldOptional(comptime T: type, field_index: usize) !bool { const fields = @typeInfo(T).Struct.fields; diff --git a/course/engineering/build-system.md b/course/engineering/build-system.md index c10c66b6..086ff870 100644 --- a/course/engineering/build-system.md +++ b/course/engineering/build-system.md @@ -829,7 +829,7 @@ void frame() { refresh(); } -// set the value fo the board for a particular (x,y,r) piece +// set the value of the board for a particular (x,y,r) piece void set_piece(int x, int y, int r, int v) { for (int i = 0; i < 8; i += 2) { board[NUM(r, i * 2) + y][NUM(r, (i * 2) + 2) + x] = v; diff --git a/course/environment/install-environment.md b/course/environment/install-environment.md index 0f04d96e..259ee2f8 100644 --- a/course/environment/install-environment.md +++ b/course/environment/install-environment.md @@ -17,7 +17,7 @@ outline: deep 修改方法为: -1. 打开 widnows 设置中的 **时间和语言**,进入 **语言和区域**。 +1. 打开 windows 设置中的 **时间和语言**,进入 **语言和区域**。 2. 点击下方的管理语言设置,在新打开的窗口中点击 **管理**。 3. 点击下方的 **更改系统区域设置**,勾选下方的 “使用 unicode UTF-8 提供全球语言支持” 4. 重启计算机。