diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 0000000..6c6a80e --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,3 @@ +{ + "ignorePatterns": ["_sources/*.json", "secrets/*.yaml"] +} diff --git a/.zed/settings.json b/.zed/settings.json index ff63d82..2f8a134 100644 --- a/.zed/settings.json +++ b/.zed/settings.json @@ -7,6 +7,38 @@ "arguments": ["-"] } } + }, + "JSON": { + "formatter": { + "external": { + "command": "oxfmt", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + } + }, + "Markdown": { + "formatter": { + "external": { + "command": "oxfmt", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + } + }, + "YAML": { + "formatter": { + "external": { + "command": "oxfmt", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + } + }, + "TOML": { + "formatter": { + "external": { + "command": "oxfmt", + "arguments": ["--stdin-filepath", "{buffer_path}"] + } + } } } } diff --git a/flake/perSystem.nix b/flake/perSystem.nix index c972461..7d2c42a 100644 --- a/flake/perSystem.nix +++ b/flake/perSystem.nix @@ -33,6 +33,7 @@ just nvfetcher alejandra + oxfmt lua-language-server ]; diff --git a/pkgs/rime-all/default.custom.yaml b/pkgs/rime-all/default.custom.yaml index bad6da4..4505e22 100644 --- a/pkgs/rime-all/default.custom.yaml +++ b/pkgs/rime-all/default.custom.yaml @@ -29,36 +29,12 @@ patch: - { when: has_menu, accept: minus, send: Page_Up } - { when: has_menu, accept: equal, send: Page_Down } - - { - when: always, - toggle: ascii_punct, - accept: Control+Shift+3, - } # 切换中英标点 - - { - when: always, - toggle: ascii_punct, - accept: Control+Shift+numbersign, - } # 切换中英标点 - - { - when: always, - toggle: traditionalization, - accept: Control+Shift+4, - } # 切换简繁 - - { - when: always, - toggle: traditionalization, - accept: Control+Shift+dollar, - } # 切换简繁 - - { - when: always, - toggle: full_shape, - accept: Control+Shift+5, - } # 切换全半角 - - { - when: always, - toggle: full_shape, - accept: Control+Shift+percent, - } # 切换全半角 + - { when: always, toggle: ascii_punct, accept: Control+Shift+3 } # 切换中英标点 + - { when: always, toggle: ascii_punct, accept: Control+Shift+numbersign } # 切换中英标点 + - { when: always, toggle: traditionalization, accept: Control+Shift+4 } # 切换简繁 + - { when: always, toggle: traditionalization, accept: Control+Shift+dollar } # 切换简繁 + - { when: always, toggle: full_shape, accept: Control+Shift+5 } # 切换全半角 + - { when: always, toggle: full_shape, accept: Control+Shift+percent } # 切换全半角 # 将小键盘 0~9 . 映射到主键盘,数字金额大写的 Lua 如 R1234.5678 可使用小键盘输入 - { accept: KP_0, send: 0, when: composing } diff --git a/treefmt.nix b/treefmt.nix index 3037b6b..3e00dd3 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,43 +1,18 @@ { - perSystem = { - pkgs, - lib, - ... - }: { + perSystem = {lib, ...}: { treefmt = { programs = { alejandra = { enable = true; excludes = ["_sources/*.nix"]; }; - biome = { + oxfmt = let + oxfmtConfig = with lib; + pipe ./.oxfmtrc.json [builtins.readFile builtins.fromJSON]; + in { enable = true; - includes = ["*.json"]; - excludes = ["_sources/*.json"]; - settings = { - formatter.indentStyle = "space"; - javascript.formatter.enabled = false; - css.formatter.enabled = false; - }; - }; - dprint = { - enable = true; - includes = [ - "*.md" - "*.toml" - "*.yaml" - ]; - excludes = ["secrets/*.yaml"]; - settings = { - plugins = pkgs.dprint-plugins.getPluginList ( - plugins: - with plugins; [ - dprint-plugin-toml - dprint-plugin-markdown - g-plane-pretty_yaml - ] - ); - }; + includes = ["*.json" "*.md" "*.toml" "*.yaml"]; + excludes = oxfmtConfig.ignorePatterns; }; just = { enable = true; @@ -45,10 +20,7 @@ }; typos = let config = with lib; - pipe ./.typos.toml [ - builtins.readFile - fromTOML - ]; + pipe ./.typos.toml [builtins.readFile fromTOML]; in { enable = true; includes = ["*"];