├── autocorrect-popclip ├── autocorrect.png ├── autocorrect.sh └── Config.plist ├── LICENSE └── README.md /autocorrect-popclip/autocorrect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TomBener/autocorrect-popclip/HEAD/autocorrect-popclip/autocorrect.png -------------------------------------------------------------------------------- /autocorrect-popclip/autocorrect.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | export LANG='en_US.UTF-8' && /bin/echo -n "$POPCLIP_TEXT" | \ 3 | sed 's/“/「/g; s/”/」/g' | \ 4 | /opt/homebrew/bin/autocorrect --stdin 5 | -------------------------------------------------------------------------------- /autocorrect-popclip/Config.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Actions 6 | 7 | 8 | After 9 | paste-result 10 | Image File 11 | autocorrect.png 12 | Requirements 13 | 14 | copy 15 | 16 | Shell Script File 17 | autocorrect.sh 18 | Stoppable 19 | 20 | Title 21 | Formatting CJK 22 | 23 | 24 | Extension Identifier 25 | com.tomben.autocorrect.extension 26 | Extension Name 27 | AutoCorrect 28 | Extension Description 29 | Improve copywriting, correct spaces, words, punctuations between CJK (Chinese, Japanese, Korean). 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022–2024 Tom Ben 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoCorrect Extension for PopClip 2 | 3 | 基于 [AutoCorrect](https://github.com/huacnlee/autocorrect) 实现的 PopClip 插件,用于「自动纠正」或「检查并建议」文案,给 CJK(中文、日语、韩语)与英文混写的场景,补充正确的空格,纠正单词,同时尝试以安全的方式自动纠正标点符号等等。除此之外,也将简体中文使用的弯引号 `“`、`”` 分别转换为直角引号 `「`、`」`。 4 | 5 | ## 安装 6 | 7 | 1. **安装 PopClip** 8 | 9 | - 前往 [官网](https://www.popclip.app) 下载,免费版可以使用 250 次,[付费](https://www.popclip.app/buy) 解锁无限使用次数。 10 | 11 | 2. **安装 AutoCorrect** 12 | 13 | - 通过 [Homebrew](https://brew.sh) 安装: 14 | 15 | ```shell 16 | brew install autocorrect 17 | ``` 18 | 19 | - 或者使用 [Curl](https://curl.se) 安装: 20 | 21 | ```shell 22 | curl -sSL https://git.io/JcGER | bash 23 | ``` 24 | 25 | 3. **安装 AutoCorrect Extension for PopClip** 26 | 27 | 鼠标选中下方 6 行 YAML 代码块后,PopClip 开启状态下会自动弹出提示 `Install Extension "AutoCorrect"`,点击即可安装。 28 | 29 | ```yaml 30 | # popclip AutoCorrect 31 | name: AutoCorrect 32 | title: Formatting CJK 33 | icon: square CJK 34 | applescript: do shell script "export LANG='en_US.UTF-8' && /bin/echo -n '{popclip text}' | sed 's/“/「/g; s/”/」/g' | /opt/homebrew/bin/autocorrect --stdin" 35 | after: paste-result 36 | ``` 37 | 38 | 在 Apple Silicon Mac 上,使用 Homebrew 安装的 AutoCorrect 路径为 `/opt/homebrew/bin/autocorrect`。如果你的 Mac 中 AutoCorrect 不安装在此位置,可以在终端中输入 `which autocorrect`,然后用输出结果替换上方的 `/opt/homebrew/bin/autocorrect`。请注意,可执行文件的路径**不可省略**。 39 | 40 | 或者直接下载 Releases 中的 [autocorrect-popclip.popclipext.zip](https://github.com/TomBener/autocorrect-popclip/releases),解压之后双击安装。 41 | 42 | ## 使用效果 43 | 44 | ![demo](https://p15.p3.n0.cdn.getcloudapp.com/items/5zuPjPbb/f877d3ec-3d4a-4e2d-a07f-8716f80c23e9.gif) 45 | 46 | ## 相关项目 47 | 48 | [盘古之白 PopClip 插件](https://github.com/mousepotato/pangu-space.popclipext) 49 | 50 | ## Credits 51 | 52 | Pete and Nick on [PopClip Forum](https://forum.popclip.app/t/shell-script-not-working/1100) 53 | 54 | ## License 55 | 56 | [MIT license](LICENSE) 57 | --------------------------------------------------------------------------------