因为 espanso 可以调用 shell 脚本所以约等于一个小号的 raycast 。espanso 只是一个文本扩展器软件,它有个搜索框很方便,我日常使用它来记住一些比较常用的 shell 命令,代码片段,这只是它的特别用法。
brew install gh espanso
gh auth login
~/Library/Application Support/espanso/match/promats.yml)
# how to use this config
## 1. install gh in your system run gh auth
## 2. set editor in gh eg: gh config set editor "zed -w" ps: you can use vscode "code -w --disable-extensions"
## 3. $: echo hello | run gh gist create -d "llm prompt"
## 4. get your and change your gist id $: gh gist ls --filter prompt
global_vars:
- name: gist_id
type: echo
params:
echo: b94d3e90a752b849757d2a078fbf293a
#echo: f3171d580fab61b8a3ec76d9514863f6 # test
# 1. Get the gist list
- name: gist_list
type: shell
params:
cmd: "gh gist view {{gist_id}} --files"
# 2. Format the list for the choice menu
- name: gist_options
type: shell
params:
cmd: |
echo "{{gist_list}}" | while read -r line; do
echo "$line"
done
matches:
- trigger: ":prompt-view"
label: "Select LLM prompt from GitHub Gist"
replace: "{{prompt}}"
search_terms:
- prompt
- llm
- ai
vars:
# 3. Show the choice menu to the user
- name: gist_choice
type: choice
params:
values: "{{gist_options}}"
# 4. Get the content of the chosen gist
- name: prompt
type: shell
params:
cmd: gh gist view "{{gist_id}}" -r -f "{{gist_choice}}"
- trigger: ":prompt-edit"
label: "edit LLM prompt to GitHub Gist"
replace: "{{output}}"
search_terms:
- prompt
- llm
- ai
- edit
vars:
# 3. Show the choice menu to the user
- name: gist_choice
type: choice
params:
values: "{{gist_options}}"
# 4. Get the content of the chosen gist
- name: output
type: shell
params:
cmd: gh gist edit "{{gist_id}}" -f "{{gist_choice}}"
- trigger: ":prompt-add"
label: "add LLM prompt to GitHub Gist"
replace: "{{output}}"
search_terms:
- prompt
- llm
- ai
- add
vars:
- name: file
type: form
params:
layout: |
请输入文件名[[name]] 示例: claude_user#role#coding#claude
请输入 prompt 内容:
[[content]]
fields:
content:
multiline: true
- name: carete_file_in_tmp
type: shell
params:
cmd: echo "{{file.content}}" > /tmp/prompt
- name: add
type: shell
params:
cmd: gh gist edit "{{gist_id}}" -a "{{file.name}}" /tmp/prompt
- name: output
type: shell
params:
cmd: gh gist view "{{gist_id}}" --files | grep "{{file.name}}" && echo "{{file.name}} create faild" || echo "file {{file.name}} create success"
trim: false
- trigger: ":prompt-del"
label: "del LLM prompt for GitHub Gist"
replace: "{{output}}"
search_terms:
- prompt
- llm
- ai
- del
vars:
# 3. Show the choice menu to the user
- name: gist_choice
type: choice
params:
values: "{{gist_options}}"
# 4. Get the content of the chosen gist
- name: delete
type: shell
params:
cmd: gh gist edit "{{gist_id}}" -r "{{gist_choice}}"
- name: output
type: shell
params:
cmd: gh gist view "{{gist_id}}" --files | grep "{{gist_choice}}" && echo "{{gist_choice}} is delete" || echo "file {{gist_choice}} is exist"
trim: false