diff options
Diffstat (limited to 'snippets/typescript')
| -rw-r--r-- | snippets/typescript/function.tsx | 3 | ||||
| -rw-r--r-- | snippets/typescript/react-component.tsx | 7 | ||||
| -rw-r--r-- | snippets/typescript/react-usestate.snip.kak | 11 |
3 files changed, 21 insertions, 0 deletions
diff --git a/snippets/typescript/function.tsx b/snippets/typescript/function.tsx new file mode 100644 index 0000000..ac1b290 --- /dev/null +++ b/snippets/typescript/function.tsx @@ -0,0 +1,3 @@ +const $1 = ($2) => { + $3 +}; diff --git a/snippets/typescript/react-component.tsx b/snippets/typescript/react-component.tsx new file mode 100644 index 0000000..5a2723b --- /dev/null +++ b/snippets/typescript/react-component.tsx @@ -0,0 +1,7 @@ +type $1Prop = { + $2 +} + +export const $1 = ({ }: $1Prop) => { + return <div>$3</div>; +}; diff --git a/snippets/typescript/react-usestate.snip.kak b/snippets/typescript/react-usestate.snip.kak new file mode 100644 index 0000000..8b2d232 --- /dev/null +++ b/snippets/typescript/react-usestate.snip.kak @@ -0,0 +1,11 @@ +prompt 'Name: ' %{ + set-register n %val{text} + prompt 'Initial value: ' %{ + set-register v %val{text} + evaluate-commands %sh{ + st=$(echo "$kak_reg_n" | sed 's/^[A-Z]/\L\0/') + setst="set$(echo "$kak_reg_n" | sed 's/^[a-z]/\U\0/')" + echo "execute-keys '<esc>,iconst [$st, $setst] = useState($kak_reg_v);<esc>'" + } + } +} |
