feat(emacs): snippets

This commit is contained in:
Pavel Korytov 2022-05-03 23:15:31 +03:00
parent c42b693c51
commit 586d0c9cd5
7 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: begin
# key: begin
# --
\begin{${1:environment}}
$0
\end{$1}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: frac
# key: frac
# --
\frac{$1}{$2}$0

View file

@ -0,0 +1,8 @@
# key: init
# name: __init__-py
# condition: (string-match-p "__init__.py" (buffer-file-name))
# --
${1:`(thread-last (directory-files default-directory)
(seq-filter (lambda (s) (string-match-p (rx bos (not (or ?_ ?# ?.)) (* nonl) ".py" eos) s)))
(mapcar (lambda (s) (format "from .%s import *" (substring s 0 (- (length s) 3)))))
(funcall (lambda (ss) (string-join ss "\n"))))`}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ipdb
# key: ipdb
# --
import ipdb; ipdb.set_trace()

View file

@ -1,4 +1,4 @@
# key: prs
# name: private-service
# --
private ${1:service}Service: ${1:$(capitalize yas-text)}Service$0
private ${1:service}Service: ${1:$(format "%s%s" (capitalize (substring yas-text 0 1)) (substring yas-text 1))}Service$0

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: transaction
# key: tran
# --
await this.sequelize.transaction(async (t) => {
$0
});

View file

@ -0,0 +1,4 @@
# key: tt
# name: transaction -
# --
{ transaction: t }$0