From a47ec841a4f577c2c9566aafc882d2e9286fad3d Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Thu, 31 Aug 2023 20:04:17 -0700 Subject: [PATCH] :memo: Added trycatch espanso expansion --- .config/espanso/match/base.yml | 7 ++++++- scripts/trycatch | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 scripts/trycatch diff --git a/.config/espanso/match/base.yml b/.config/espanso/match/base.yml index 8cc92502..53f5105d 100644 --- a/.config/espanso/match/base.yml +++ b/.config/espanso/match/base.yml @@ -108,7 +108,12 @@ matches: replace: "() => {}" - trigger: ";try" - replace: "try {} catch(error) {}" + replace: "{{output}}" + vars: + - name: output + type: shell + params: + cmd: "~/scripts/trycatch ; echo ''" - trigger: ";def" replace: "def():" diff --git a/scripts/trycatch b/scripts/trycatch new file mode 100755 index 00000000..1fa7ec6e --- /dev/null +++ b/scripts/trycatch @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# use in conjunction with espanso to automatically print a javascript +# try/catch statement +cat <