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 <