aboutsummaryrefslogtreecommitdiff
path: root/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'snippets')
-rw-r--r--snippets/kakoune/command.kak3
-rw-r--r--snippets/kakoune/hook.kak3
-rw-r--r--snippets/nix/mkderivation.nix6
-rw-r--r--snippets/nix/mkshell.nix3
-rw-r--r--snippets/ruby/class.rb9
-rw-r--r--snippets/typescript/function.tsx3
-rw-r--r--snippets/typescript/react-component.tsx7
-rw-r--r--snippets/typescript/react-usestate.snip.kak11
8 files changed, 45 insertions, 0 deletions
diff --git a/snippets/kakoune/command.kak b/snippets/kakoune/command.kak
new file mode 100644
index 0000000..0379632
--- /dev/null
+++ b/snippets/kakoune/command.kak
@@ -0,0 +1,3 @@
+define-command $1 -params $2 -docstring '' %{
+ $3
+}
diff --git a/snippets/kakoune/hook.kak b/snippets/kakoune/hook.kak
new file mode 100644
index 0000000..a26f983
--- /dev/null
+++ b/snippets/kakoune/hook.kak
@@ -0,0 +1,3 @@
+hook global $1 .* %{
+ $2
+}
diff --git a/snippets/nix/mkderivation.nix b/snippets/nix/mkderivation.nix
new file mode 100644
index 0000000..412efb7
--- /dev/null
+++ b/snippets/nix/mkderivation.nix
@@ -0,0 +1,6 @@
+stdenv.mkDerivation {
+ pname = "$1";
+ version = "0.0.0";
+ src = $2;
+ buildInputs = [];
+}
diff --git a/snippets/nix/mkshell.nix b/snippets/nix/mkshell.nix
new file mode 100644
index 0000000..c7ad05b
--- /dev/null
+++ b/snippets/nix/mkshell.nix
@@ -0,0 +1,3 @@
+pkgs.mkShell {
+ buildInputs = with pkgs; [];
+}
diff --git a/snippets/ruby/class.rb b/snippets/ruby/class.rb
new file mode 100644
index 0000000..5b16823
--- /dev/null
+++ b/snippets/ruby/class.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class $1
+ def initialize
+ $2
+ end
+
+ $3
+end
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>'"
+ }
+ }
+}