feat: Initial commit

This commit is contained in:
Danilo Cesa 2026-05-19 00:33:39 +08:00
parent 7d63f8e6ab
commit 6b20c727c0
6 changed files with 1017 additions and 0 deletions

53
config/default.yml Normal file
View File

@ -0,0 +1,53 @@
# espanso configuration file
# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/config.schema.json
# For a complete introduction, visit the official docs at: https://espanso.org/docs/
# You can use this file to define the global configuration options for espanso.
# These are the parameters that will be used by default on every application,
# but you can also override them on a per-application basis.
# To make customization easier, this file contains some of the commonly used
# parameters. Feel free to uncomment and tune them to fit your needs!
# --- Toggle key
# Customize the key used to disable and enable espanso (when double tapped)
# Available options: CTRL, SHIFT, ALT, CMD, OFF
# You can also specify the key variant, such as LEFT_CTRL, RIGHT_SHIFT, etc...
# toggle_key: ALT
# You can also disable the toggle key completely with
# toggle_key: OFF
# --- Injection Backend
# Espanso supports multiple ways of injecting text into applications. Each of
# them has its quirks, therefore you may want to change it if you are having problems.
# By default, espanso uses the "Auto" backend which should work well in most cases,
# but you may want to try the "Clipboard" or "Inject" backend in case of issues.
# backend: Clipboard
# --- Auto-restart
# Enable/disable the config auto-reload after a file change is detected.
# auto_restart: false
# --- Clipboard threshold
# Because injecting long texts char-by-char is a slow operation, espanso automatically
# uses the clipboard if the text is longer than 'clipboard_threshold' characters.
# clipboard_threshold: 100
# --- Regex Buffer Size
# The maximum number of characters to hold in memory for regex triggers.
# This value determines the maximum length of a regex trigger that can be
# matched by espanso and by default have 30 chars.
# It's advisable to keep this value reasonably low.
# You might want to increase this value if you have very long triggers,
# at the cost of higher memory usage.
# max_regex_buffer_size: 30
# For a list of all the available options, visit the official docs at: https://espanso.org/docs/
search_shortcut: ALT+SHIFT+SPACE

BIN
match/.DS_Store vendored Normal file

Binary file not shown.

40
match/base.yml Normal file
View File

@ -0,0 +1,40 @@
# 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.
# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.json
matches:
# Simple text replacement
- trigger: ":espanso"
replace: "Hi there!"
# 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: "%m/%d/%Y"
# Print the output of a shell command
- trigger: ":shell"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "echo 'Hello from your shell'"
# And much more! For more information, visit the docs: https://espanso.org/docs/

249
match/docker.yml Normal file
View File

@ -0,0 +1,249 @@
# Docker Snippets for Espanso
matches:
# === Core Docker Commands ===
- trigger: "}dckr"
replace: "docker run $1$ $2$ $3$ $4$"
vars:
- name: image
type: choice
params:
values: ["$|$", "nginx", "postgres:15", "redis:alpine", "node:20"]
- name: mode
type: choice
params:
values: ["", "-d", "-it"]
- name: ports
type: choice
params:
values: ["", "-p 8080:80", "-p 3000:3000", "-p 5432:5432"]
- name: volumes
type: choice
params:
values:
["", "-v $(pwd):/app", "-v ~/data:/var/lib/postgresql/data", ""]
- trigger: "}dckb"
replace: "docker build -t $1$ $2$"
vars:
- name: tag
type: choice
params:
values: ["$|$", "my-app:v1", "my-app:latest"]
- name: context
type: choice
params:
values: [".", "/path/to/build/context", ""]
- trigger: "}dckp"
replace: "docker push $1$"
vars:
- name: image
type: choice
params:
values: ["$|$", "my-app:v1", "registry.example.com/my-app:latest"]
- trigger: "}dckpl"
replace: "docker pull $1$"
vars:
- name: image
type: choice
params:
values: ["$|$", "nginx:latest", "postgres:15-alpine"]
- trigger: "}dckps"
replace: "docker ps $1$"
vars:
- name: option
type: choice
params:
values:
["", "-a", "--format \"table {{.Names}}\t{{.Image}}\t{{.Ports}}\""]
- trigger: "}dckim"
replace: "docker images"
- trigger: "}dckstop"
replace: "docker stop $1$"
vars:
- name: target
type: choice
params:
values: ["$|$", "<container-name>", "$(docker ps -q)"]
- trigger: "}dckstopa"
replace: "docker stop $(docker ps -q)"
label: Stop ALL running containers (use with caution!)
- trigger: "}dckrm"
replace: "docker rm $1$"
vars:
- name: target
type: choice
params:
values: ["$|$", "<container-name>", "$(docker ps -aq)"]
- trigger: "}dckrmi"
replace: "docker rmi $1$"
vars:
- name: target
type: choice
params:
values: ["$|$", "<image-name>", "$(docker images -q)"]
- trigger: "}dcklog"
replace: "docker logs -f $1$"
vars:
- name: container
type: choice
params:
values: ["$|$", "<container-name>"]
- trigger: "}dckex"
replace: "docker exec -it $1$ $2$"
vars:
- name: container
type: choice
params:
values: ["$|$", "<container-name>"]
- name: command
type: choice
params:
values: ["sh", "bash", "/bin/bash", ""]
- trigger: "}dckprune"
replace: "docker system prune -f"
- trigger: "}dckpruneall"
replace: "docker system prune -a --volumes -f"
label: Remove ALL unused Docker resources (irreversible!)
- trigger: "}dckinspect"
replace: "docker inspect $1$"
vars:
- name: target
type: choice
params:
values: ["$|$", "<container-name>", "<image-name>"]
# === Docker Compose Commands ===
- trigger: "}dckcu"
replace: "docker compose up $1$ $2$"
vars:
- name: option
type: choice
params:
values: ["", "-d", "--build"]
- name: service
type: choice
params:
values: ["$|$", "", "web", "db", "redis"]
- trigger: "}dckcd"
replace: "docker compose down $1$"
vars:
- name: option
type: choice
params:
values: ["", "--volumes", "--rmi all"]
- trigger: "}dckcl"
replace: "docker compose logs -f $1$"
vars:
- name: service
type: choice
params:
values: ["$|$", "web", "db", ""]
- trigger: "}dckex"
replace: "docker compose exec $1$ $2$"
vars:
- name: service
type: choice
params:
values: ["$|$", "web", "db"]
- name: command
type: choice
params:
values: ["sh", "bash", "python manage.py migrate", ""]
- trigger: "}dckcb"
replace: "docker compose build $1$"
vars:
- name: service
type: choice
params:
values: ["$|$", "web", "db", ""]
# === Dockerfile Snippets ===
- trigger: "}dckfile"
replace: |
FROM $1$
WORKDIR /app
COPY . .
RUN $2$
EXPOSE 80
CMD ["$3$"]
vars:
- name: base_image
type: choice
params:
values: ["$|$", "alpine:latest", "ubuntu:22.04"]
- name: install_cmd
type: choice
params:
values:
[
"apt update && apt install -y <package>",
"apk add --no-cache <package>",
"pip install -r requirements.txt",
"",
]
- name: start_cmd
type: choice
params:
values:
["nginx -g 'daemon off;'", "python app.py", "node server.js", ""]
- trigger: "}dckfile-node"
replace: |
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
- trigger: "}dckfile-py"
replace: |
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "app.py"]
# === Common Config Snippets ===
- trigger: "}dckignore"
replace: |
.git
node_modules
.env
*.log
Dockerfile
.dockerignore
dist/
build/
- trigger: "}dckenv"
replace: "ENV $1$=$2$"
vars:
- name: key
type: choice
params:
values: ["$|$", "NODE_ENV", "PORT", "DB_HOST", "DEBUG"]
- name: value
type: choice
params:
values: ["production", "3000", "localhost", "true", ""]

515
match/git.yml Normal file
View File

@ -0,0 +1,515 @@
# Git Snippets for Espanso
matches:
# === BASIC COMMANDS ===
# Git init
- trigger: "}ginit"
replace: "git init"
# Git clone
- trigger: "}gclone"
replace: "git clone $1$"
# Git status
- trigger: "}gst"
replace: "git status"
# Git add
- trigger: "}ga"
#replace: "git add $1$"
vars:
- name: "dot"
type: "choice"
params:
values:
- ". "
- ""
- name: "file"
type: "choice"
params:
values:
- "$|$"
- " <filename>"
replace: "git add {{dot}}{{file}}"
# Git commit
- trigger: "}gcs"
replace: 'git commit -m "$|$"'
# Git commit with amend
- trigger: "}gca"
replace: 'git commit --amend -m "$|$"'
# Git commit all
- trigger: "}gcaa"
replace: 'git commit -am "$|$"'
# Git push
- trigger: "}gp"
#replace: "git push $1$ $2$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "--force"
- "--tags"
- name: "remote_branch"
type: "choice"
params:
values:
- ""
- "origin main"
- "origin master"
- "origin HEAD"
replace: "git push {{option}} {{remote_branch}}"
# Git pull
- trigger: "}gl"
#replace: "git pull $1$ $2$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "--rebase"
- name: "remote_branch"
type: "choice"
params:
values:
- ""
- "origin main"
- "origin master"
replace: "git pull {{option}} {{remote_branch}}"
# Git fetch
- trigger: "}gf"
#replace: "git fetch $1$"
vars:
- name: "remote"
type: "choice"
params:
values:
- ""
- "origin"
- "--all"
replace: "git fetch {{remote}}"
# Git log
- trigger: "}glg"
replace: "git log --oneline --graph --all"
# Git diff
- trigger: "}gd"
#replace: "git diff $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "--staged"
- "HEAD~1"
replace: "git diff {{option}}"
# Git checkout
- trigger: "}gco"
#replace: "git checkout $1$"
vars:
- name: "what"
type: "choice"
params:
values:
- ""
- "-b "
- "-- "
- name: "target"
type: "choice"
params:
values:
- "$|$"
- "main"
- "master"
- "develop"
replace: "git checkout {{what}}{{target}}"
# Git branch
- trigger: "}gb"
#replace: "git branch $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "-d "
- "-D "
- "-a"
- "-r"
- name: "branch"
type: "choice"
params:
values:
- "$|$"
- "feature/"
- "bugfix/"
- "hotfix/"
replace: "git branch {{option}}{{branch}}"
# Git merge
- trigger: "}gm"
#replace: "git merge $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "--no-ff "
- "--squash "
- "--abort"
- name: "branch"
type: "choice"
params:
values:
- "$|$"
- "main"
- "master"
- "develop"
replace: "git merge {{option}}{{branch}}"
# Git rebase
- trigger: "}gr"
#replace: "git rebase $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "-i "
- "--abort"
- "--continue"
- "--skip"
- name: "target"
type: "choice"
params:
values:
- "$|$"
- "main"
- "master"
- "HEAD~3"
replace: "git rebase {{option}}{{target}}"
# Git stash
- trigger: "}gstash"
#replace: "git stash $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- 'push -m "$|$"'
- "pop"
- "list"
- "drop"
replace: "git stash {{option}}"
# Git remote
- trigger: "}gr"
#replace: "git remote $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- "-v"
- "add origin "
- "remove "
- name: "url"
type: "choice"
params:
values:
- "$|$"
- "https://github.com/user/repo.git"
replace: "git remote {{option}}{{url}}"
# Git reset
- trigger: "}greset"
#replace: "git reset $1$ $2$"
vars:
- name: "mode"
type: "choice"
params:
values:
- "--soft "
- "--hard "
- ""
- name: "target"
type: "choice"
params:
values:
- "HEAD~1"
- "HEAD~2"
- "HEAD~3"
- "$|$"
replace: "git reset {{mode}}{{target}}"
# Git clean
- trigger: "}gclean"
#replace: "git clean -fd $1$"
vars:
- name: "dry"
type: "choice"
params:
values:
- ""
- "-n"
replace: "git clean -fd{{dry}}"
# Git show
- trigger: "}gshow"
#replace: "git show $1$"
vars:
- name: "ref"
type: "choice"
params:
values:
- "HEAD"
- "HEAD~1"
- "$|$"
- "<commit-hash>"
replace: "git show {{ref}}"
# Git cherry-pick
- trigger: "}gcp"
#replace: "git cherry-pick $1$"
vars:
- name: "option"
type: "choice"
params:
values:
- ""
- "-x "
- "--continue"
- "--abort"
- name: "commit"
type: "choice"
params:
values:
- "$|$"
- "<commit-hash>"
- "HEAD~1"
replace: "git cherry-pick {{option}}{{commit}}"
# Git revert
- trigger: "}grev"
#replace: "git revert $1$"
vars:
- name: "commit"
type: "choice"
params:
values:
- "HEAD"
- "HEAD~1"
- "$|$"
- "<commit-hash>"
replace: "git revert {{commit}}"
# Git bisect
- trigger: "}gbisect"
#replace: "git bisect $1$"
vars:
- name: "action"
type: "choice"
params:
values:
- "start"
- "good"
- "bad"
- "reset"
- "log"
replace: "git bisect {{action}}"
# Git blame
- trigger: "}gblame"
#replace: "git blame $1$"
vars:
- name: "file"
type: "choice"
params:
values:
- "$|$"
- "<filename>"
replace: "git blame {{file}}"
# Git reflog
- trigger: "}grl"
#replace: "git reflog"
replace: "git reflog"
# Git config
- trigger: "}gconf"
#replace: "git config --global $1$ $2$"
vars:
- name: "key"
type: "choice"
params:
values:
- "user.name"
- "user.email"
- "core.editor"
- "init.defaultBranch"
- name: "value"
type: "choice"
params:
values:
- "$|$"
- "Your Name"
- "your.email@example.com"
- "vim"
- "main"
replace: 'git config --global {{key}} "{{value}}"'
# === COMMIT MESSAGE CONVENTIONS ===
# Conventional Commits
- trigger: "}gcc"
vars:
- name: "type"
type: "choice"
params:
values:
- "feat"
- "fix"
- "docs"
- "style"
- "refactor"
- "perf"
- "test"
- "chore"
- "revert"
- name: "scope"
type: "choice"
params:
values:
- ""
- "(auth)"
- "(api)"
- "(db)"
- "(ui)"
- "(cli)"
replace: "{{type}}{{scope}}: "
# Fix typo in commit
- trigger: "}gfix"
replace: "fixup! $|$"
# Squash commit
- trigger: "}gsquash"
replace: "squash! $|$"
# === BRANCH NAMING CONVENTIONS ===
# Feature branch
- trigger: "}gbf"
replace: "feature/$|$-{{mydate}}"
vars:
- name: "mydate"
type: "date"
params:
format: "%Y-%m-%d"
# Bugfix branch
- trigger: "}gbb"
replace: "bugfix/$|$-{{mydate}}"
vars:
- name: "mydate"
type: "date"
params:
format: "%Y-%m-%d"
# Hotfix branch
- trigger: "}gbh"
replace: "hotfix/$|$-{{mydate}}"
vars:
- name: "mydate"
type: "date"
params:
format: "%Y-%m-%d"
# Release branch
- trigger: "}gbr"
replace: "release/v$1$.$2$.$3$"
vars:
- name: "major"
type: "choice"
params:
values: ["0", "1", "2"]
- name: "minor"
type: "choice"
params:
values: ["0", "1", "2"]
- name: "patch"
type: "choice"
params:
values: ["0", "1", "2"]
# === TROUBLESHOOTING ===
# Discard local changes (CAREFUL!)
- trigger: "}gdc"
replace: "git checkout -- $1$"
vars:
- name: "file"
type: "choice"
params:
values:
- "."
- "$|$"
- "<filename>"
# Undo last commit (keep changes)
- trigger: "}gundo"
replace: "git reset --soft HEAD~1"
# Undo last commit (discard changes)
- trigger: "}gundohard"
replace: "git reset --hard HEAD~1"
# Remove untracked files (CAREFUL!)
- trigger: "}grmuntracked"
replace: "git clean -fd"
# See what branch you're on
- trigger: "}gcurrbranch"
replace: "git branch --show-current"
# List all branches with last commit
- trigger: "}gbrl"
replace: "git branch -vva"
# Find deleted branches
- trigger: "}gbrd"
replace: "git branch --merged | egrep -v \"(^\\*|main|master|develop)\""
# === GIT IGNORE ===
# Add to .gitignore
- trigger: "gignore"
replace: 'echo "$1$" >> .gitignore'
# Common .gitignore entries
- trigger: "ignode"
replace: "node_modules/\n.env\nnpm-debug.log"
- trigger: "igpython"
replace: "__pycache__/\n*.pyc\n.env\nvenv/\n.venv/\n*.egg-info/"
- trigger: "igidea"
replace: ".idea/\n*.iml\n.vscode/\n.DS_Store"
- trigger: "igbuild"
replace: "dist/\nbuild/\n*.o\n*.obj\n*.exe\n*.dll\n*.so\n*.dylib"

160
match/sql.yml Normal file
View File

@ -0,0 +1,160 @@
# SQL Snippets for Espanso
matches:
# Basic SELECT statement
- trigger: "}sqls"
replace: |
SELECT
[columns]
FROM
[table]
[WHERE conditions]
[ORDER BY column]
[LIMIT n];
# SELECT with common clauses
- trigger: "}sqlsel"
replace: |
SELECT
$1$ -- columns
FROM
$2$ -- table
$3$ -- optional: WHERE, GROUP BY, etc.
$4$; -- optional: semicolon or other ending
# INSERT statement
- trigger: "}sqli"
replace: |
INSERT INTO
[table] ([columns])
VALUES
([values]);
# UPDATE statement
- trigger: "}sqlu"
replace: |
UPDATE
[table]
SET
[column] = [value]
[WHERE conditions];
# DELETE statement
- trigger: "}sqld"
replace: |
DELETE FROM
[table]
[WHERE conditions];
# CREATE TABLE
- trigger: "}sqlct"
replace: |
CREATE TABLE [table] (
[column1] [type] [constraints],
[column2] [type] [constraints],
...
);
# Common WHERE clauses
- trigger: "}sqlw"
replace: |
WHERE
[conditions]
# JOIN patterns
- trigger: "}sqlj"
replace: |
[table1]
[JOIN_TYPE] JOIN [table2]
ON [table1].[key] = [table2].[key]
# Aggregate functions
- trigger: "}sqlagg"
replace: |
SELECT
[GROUP_BY_COLUMN],
COUNT(*) as count,
SUM([numeric_column]) as total,
AVG([numeric_column]) as average,
MAX([column]) as max_value,
MIN([column]) as min_value
FROM
[table]
GROUP BY
[GROUP_BY_COLUMN]
# Subquery pattern
- trigger: "}sqlsub"
replace: |
SELECT
[columns]
FROM
[table1]
WHERE [column] IN (
SELECT [column]
FROM [table2]
WHERE [conditions]
)
# Common SQL comments
- trigger: "}sqlc"
replace: "-- $|$"
- trigger: "}sqlcb"
replace: "/* $|$ */"
# Transaction wrapper
- trigger: "}sqltr"
replace: |
BEGIN TRANSACTION;
$|$
COMMIT;
-- ROLLBACK; -- uncomment to rollback instead
# CTE (Common Table Expression)
- trigger: "}sqlcte"
replace: |
WITH [cte_name] AS (
SELECT
[columns]
FROM
[table]
WHERE
[conditions]
)
SELECT
[columns]
FROM
[cte_name];
# CASE statement
- trigger: "}sqlcase"
replace: |
CASE
WHEN [condition1] THEN [result1]
WHEN [condition2] THEN [result2]
ELSE [default_result]
END as [alias]
# Window functions pattern
- trigger: "}sqlwin"
replace: |
SELECT
[columns],
[function]() OVER (
PARTITION BY [partition_column]
ORDER BY [order_column]
[ROWS/RANGE frame]
) as [alias]
FROM
[table]
# Placeholders guide (use these in your templates):
# [columns] - list of columns (comma-separated or *)
# [table] - table name(s)
# [conditions] - WHERE clause conditions
# [JOIN_TYPE] - INNER, LEFT, RIGHT, FULL, CROSS
# [numeric_column] - column with numeric values for aggregates
# [GROUP_BY_COLUMN] - column to group by
# $1$, $2$ etc. - tab stops (use Tab to navigate)
# $|$ - final cursor position