前言: espanso 是一个用 Rust
编写的跨平台文本扩展器(隐私优先),它可以检测您何时键入特定的关键字,并用其他内容替换它(与 Windows 平台下 AutoHotkey 应用的部分功能很像)。它适用于几乎于任何应用程序,支持 Windows、macOS 和 Linux 等系统;如果您也是一位基于电脑码字较多的朋友,那么 Espanso 非常值得您采用,从而节省大量打字时间,以提升效率和幸福感。
- 节省大量打字,扩展常用句子;
- 创建系统范围的代码片段;
- 执行自定义脚本;
- 像专业人士一样使用表情符号;
如何配置 & 使用?
Espanso 的配置,非常之简单;在 Espanso 文档 中,也做了非常详尽的说明;只需修改配置文件如 base.yml
即可;而配置文件目录,在 Mac 环境是:/Users/[username]/Library/Application\ Support/espanso
,如果您安装了该软件,可以通过命令:espanso path
快速获取路径;其目录结构如下:
$CONFIG/
config/
default.yml
match/
base.yml
新增配置就更为简单了,打开 base.yml
文件,按照如下格式,添加配置即可:
- trigger: ":qc"
replace: "倾城之链"
保存之后,当您在任何地方输入::qc
,即可将其转换成:倾城之链;真是高效快捷。
Espanso 配置示例
# espanso match file
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the base matches (aka snippets)
# that will be available in every application when using espanso.
# Matches are substitution rules: when you type the "trigger" string
# it gets replaced by the "replace" string.
matches:
# Simple text replacement
- trigger: ":espanso"
replace: "Hi Looker!"
# NOTE: espanso uses YAML to define matches, so pay attention to the indentation!
# But matches can also be dynamic:
# Print the current date
- trigger: ":date"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%Y/%m/%d"
- trigger: ":now"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%H:%M:%S"
- trigger: ":time"
replace: "{{mydate}}"
vars:
- name: mydate
type: date
params:
format: "%Y 年 %m 月 %d 日"
# Print the output of a shell command
- trigger: ":shell"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo 'Hello from your shell'"
- trigger: ":write"
replace: "{{date}}"
vars:
- name: date
type: date
params:
format: "%Y 年 %m 月 %d 日写于〔深圳福田〕"
# And much more! For more information, visit the docs: https://espanso.org/docs
- trigger: ":log"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo 'console.log()'"
- trigger: ":qc"
replace: "倾城之链"
- trigger: ":nice"
replace: "https://nicelinks.site"
- trigger: ":pz"
replace: "——"
- trigger: ":url"
replace: "https://nicelinks.site/redirect?url="
- trigger: ":tag"
replace: "https://nicelinks.site/tags/"
- trigger: ":theme"
replace: "https://nicelinks.site/theme/"
您可能感兴趣(/有用)的文章: