feat(aspen/emacs): Begin a complete emacs config revamp

I'm still on doom, but without all the cruft I've accumulated over the
last ~6 years it's actually good and fast and nice. Also, the config is
literate now!

The old emacs is still in .emacs.d, since occasionally I want to
reference it, but eventually I'll just get rid of it

Change-Id: Icda840d798594f7e6b188dba044494597d5f6043
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10999
Reviewed-by: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Aspen Smith 2024-02-20 16:31:30 -05:00 committed by aspen
parent 7ecf43a1bd
commit acc2433b65
66 changed files with 2245 additions and 0 deletions

2
users/aspen/emacs/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
custom.el
config.el

1375
users/aspen/emacs/config.org Normal file

File diff suppressed because it is too large Load diff

197
users/aspen/emacs/init.el Normal file
View file

@ -0,0 +1,197 @@
;;; init.el -*- lexical-binding: t; -*-
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a link to Doom's Module Index where all
;; of our modules are listed, including what flags they support.
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c c k' for non-vim users) to view its documentation. This works on
;; flags as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
company ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
;; doom-dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
(vc-gutter +pretty) ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
word-wrap ; soft wrapping with language-aware indent
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
;;debugger ; FIXME stepping through code, to help you add bugs
direnv
docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
(lsp +eglot) ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
pass ; password manager for nerds
;;pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects
terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
;;tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp
:os
(:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
agda ; types of types of types of types...
;;beancount ; mind the GAAP
;;(cc +lsp) ; C > C++ == 1
clojure ; java with a lisp
common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
json ; At least it ain't XML
;;(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
nix ; I hereby declare "nix geht mehr!"
ocaml ; an objective camel
(org ; organize your plain life in plain text
+gnuplot
+present
+pretty)
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
web ; the tubes
yaml ; JSON, but readable
;;zig ; C, but simpler
:email
;;(mu4e +org +gmail)
notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking
irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
:config
literate
(default +bindings +smartparens))

View file

@ -0,0 +1,141 @@
;;; org-config.el -*- lexical-binding: t; -*-
(defun +aspen/org-setup ()
(setq-local truncate-lines -1)
(display-line-numbers-mode -1)
(line-number-mode -1)
(when-let*
((path (buffer-file-name))
(fn (file-name-nondirectory path))
(equal (string-equal fn "config.org")))
(paxedit-mode 1)
(display-line-numbers-mode 1)
(flyspell-mode -1)
(org-config-mode 1)))
(add-hook 'org-mode-hook #'+aspen/org-setup 50)
(defun notes-file (f)
(concat org-directory (if (string-prefix-p "/" f) "" "/") f))
(defun aspen/org-project-tag->key (tag)
(s-replace-regexp "^project__" "" tag))
(defun aspen/org-project-tag->name (tag)
(s-titleized-words
(s-join " " (s-split "_" (aspen/org-project-tag->key tag)))))
(defun aspen/org-project-tag->keys (tag)
(s-join "" (cons "p"
(-map (lambda (s) (substring-no-properties s 0 1))
(s-split "_" (aspen/org-project-tag->key tag))))))
(defun aspen/org-projects->agenda-commands (project-tags)
(cl-loop for tag in project-tags
collect `(,(aspen/org-project-tag->keys tag)
,(aspen/org-project-tag->name tag)
tags-todo
,tag)))
(defun aspen/org-projects ()
(cl-loop for (tag) in
(org-global-tags-completion-table
(directory-files-recursively "~/notes" "\\.org$"))
when (s-starts-with-p "project__" tag)
collect tag))
(comment
(aspen/org-projects->agenda-commands (aspen/org-projects))
)
(setq
org-directory (expand-file-name "~/notes")
+org-dir (expand-file-name "~/notes")
org-default-notes-file (concat org-directory "/inbox.org")
+org-default-todo-file (concat org-directory "/inbox.org")
org-agenda-files (directory-files-recursively
"~/notes" "\\.org$")
org-refile-targets '((org-agenda-files :maxlevel . 3))
org-outline-path-complete-in-steps nil
org-refile-use-outline-path t
org-file-apps `((auto-mode . emacs)
(,(rx (or (and "." (optional "x") (optional "htm") (optional "l") buffer-end)
(and buffer-start "http" (optional "s") "://")))
. "firefox %s")
(,(rx ".pdf" buffer-end) . "apvlv %s")
(,(rx "." (or "png"
"jpg"
"jpeg"
"gif"
"tif"
"tiff")
buffer-end)
. "feh %s"))
org-log-done 'time
org-archive-location "~/notes/trash::* From %s"
org-cycle-separator-lines 2
org-hidden-keywords '(title)
org-tags-column -130
org-ellipsis ""
org-imenu-depth 9
org-capture-templates
`(("t" "Todo" entry
(file +org-default-todo-file)
"* TODO %?\n%i"
:kill-buffer t)
("m" "Email" entry
(file +org-default-todo-file)
"* TODO [[%L][%:subject]] :email:\n%i")
("n" "Notes" entry
(file +org-default-todo-file)
"* %U %?\n%i"
:prepend t
:kill-buffer t)
("c" "Task note" entry
(clock)
"* %U %?\n%i[%l[Context]]\n"
:kill-buffer t
:unnarrowed t)
("p" "Projects")
("px" "Xanthous" entry
(file+headline ,(notes-file "xanthous.org") "Backlog")
"* TODO %?\nContext %a\nIn task: %K")
("pt" "Tvix" entry
(file+headline ,(notes-file "tvix.org") "Tvix TODO")
"* TODO %?\nContext %a\nIn task: %K")
("pw" "Windtunnel" entry
(file+headline ,(notes-file "windtunnel.org") "Inbox")
"* TODO %i%?\nContext: %a\nIn task: %K")
)
org-capture-templates-contexts
`(("px" ((in-file . "/home/aspen/code/depot/users/aspen/xanthous/.*")))
("e" ((in-mode . "notmuch-show-mode"))))
org-deadline-warning-days 1
org-agenda-skip-scheduled-if-deadline-is-shown 'todo
org-todo-keywords '((sequence "TODO(t)" "ACTIVE(a)" "|" "DONE(d)" "RUNNING(r)")
(sequence "NEXT(n)" "WAITING(w)" "LATER(l)" "|" "CANCELLED(c)"))
org-agenda-custom-commands
`(("i" "Inbox" tags "inbox")
("r" "Running jobs" todo "RUNNING")
("w" "@Work" tags-todo "@work")
("n" . "Next...")
("nw" "Next @Work" tags-todo "@work&next")
("nt" "Next tooling" tags-todo "tooling")
("p" . "Project...")
;; ,@(aspen/org-projects->agenda-commands (aspen/org-projects))
)
org-agenda-dim-blocked-tasks nil
org-enforce-todo-dependencies nil
org-babel-clojure-backend 'cider)
(setq whitespace-global-modes '(not org-mode magit-mode vterm-mode))
(setf (alist-get 'file org-link-frame-setup) 'find-file-other-window)

View file

@ -0,0 +1,12 @@
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
(package! dash)
(package! paxedit)
(package! predd
:recipe (:host github :repo "skeeto/predd"))
(package! alert)
(package! flycheck-clojure)
(package! evil-matchit)
(package! string-inflection)
(package! protobuf-mode)

View file

@ -0,0 +1,5 @@
# key: ann
# name: annotation
# expand-env: ((yas-indent-line 'fixed))
# --
{-# ANN ${1:module} ("${2:HLint: ignore ${3:Reduce duplication}}" :: String) #-}

View file

@ -0,0 +1,26 @@
# key: bench
# name: benchmark-module
# expand-env: ((yas-indent-line (quote fixed)))
# --
--------------------------------------------------------------------------------
module ${1:`(if (not buffer-file-name) "Module"
(let ((name (file-name-sans-extension (buffer-file-name)))
(case-fold-search nil))
(if (cl-search "bench/" name)
(replace-regexp-in-string "/" "."
(replace-regexp-in-string "^\/[^A-Z]*" ""
(car (last (split-string name "src")))))
(file-name-nondirectory name))))`} ( benchmark, main ) where
--------------------------------------------------------------------------------
import Bench.Prelude
--------------------------------------------------------------------------------
import ${1:$(s-chop-suffix "Bench" yas-text)}
--------------------------------------------------------------------------------
main :: IO ()
main = defaultMain [benchmark]
--------------------------------------------------------------------------------
benchmark :: Benchmark
benchmark = bgroup "${1:$(->> yas-text (s-chop-suffix "Bench") (s-split ".") -last-item)}" [bench "something dumb" $ nf (1 +) (1 :: Int)]

View file

@ -0,0 +1,5 @@
# key: hh
# name: header
# expand-env: ((yas-indent-line 'fixed))
# --
--------------------------------------------------------------------------------$2

View file

@ -0,0 +1,8 @@
# key: gen
# name: Hedgehog Generator
# expand-env: ((yas-indent-line (quote fixed)))
# --
gen${1:Foo} :: Gen $1
gen$1 = do
$2
pure $1{..}

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Hedgehog Property
# key: hprop
# expand-env: ((yas-indent-line 'fixed))
# --
hprop_${1:somethingIsAlwaysTrue} :: Property
hprop_$1 = property $ do
${2:x} <- forAll ${3:Gen.int $ Range.linear 1 100}
${4:x === x}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: hlint
# uuid: hlint
# expand-env: ((yas-indent-line 'fixed))
# key: hlint
# condition: t
# --
{-# ANN module ("Hlint: ignore $1" :: String) #- }

View file

@ -0,0 +1,4 @@
# key: i
# name: import-i
# --
import ${1:Prelude}

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: inl
# key: inl
# expand-env: ((yas-indent-line 'fixed))
# --
{-# INLINE $1 #-}

View file

@ -0,0 +1,5 @@
# key: inline
# name: inline
# expand-env: ((yas-indent-line 'fixed))
# --
{-# INLINE $1 #-}

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: language pragma
# key: lang
# expand-env: ((yas-indent-line 'fixed))
# --
{-# LANGUAGE $1 #-}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: lens.field
# key: lens
# expand-env: ((yas-indent-line 'fixed))
# --
${1:field} :: Lens' ${2:Source} ${3:Target}
$1 = lens _${4:sourceField} $ \\${2:$(-> yas-text s-word-initials s-downcase)} ${4:$(-> yas-text s-word-initials s-downcase)} -> ${2:$(-> yas-text s-word-initials s-downcase)} { _$4 = ${4:$(-> yas-text s-word-initials s-downcase)} }

View file

@ -0,0 +1,32 @@
# -*- mode: snippet -*-
# key: module
# name: module
# condition: (= (length "module") (current-column))
# expand-env: ((yas-indent-line 'fixed))
# contributor: Luke Hoersten <luke@hoersten.org>
# --
--------------------------------------------------------------------------------
-- |
-- Module : $1
-- Description : $2
-- Maintainer : Griffin Smith <grfn@urbint.com>
-- Maturity : ${3:Draft, Usable, Maintained, OR MatureAF}
--
-- $4
--------------------------------------------------------------------------------
module ${1:`(if (not buffer-file-name) "Module"
(let ((name (file-name-sans-extension (buffer-file-name)))
(case-fold-search nil))
(if (or (cl-search "src/" name)
(cl-search "test/" name))
(replace-regexp-in-string "/" "."
(replace-regexp-in-string "^\/[^A-Z]*" ""
(car (last (split-string name "src")))))
(file-name-nondirectory name))))`}
(
) where
--------------------------------------------------------------------------------
import Prelude
--------------------------------------------------------------------------------
$0

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: shut up, hlint
# key: dupl
# expand-env: ((yas-indent-line 'fixed))
# --
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: test-group
# uuid: test-group
# key: testGroup
# condition: t
# --
testGroup "${1:name}"
[ $0
]

View file

@ -0,0 +1,27 @@
# -*- mode: snippet -*-
# name: test-module
# key: test
# expand-env: ((yas-indent-line 'fixed))
# --
--------------------------------------------------------------------------------
module ${1:`(if (not buffer-file-name) "Module"
(let ((name (file-name-sans-extension (buffer-file-name)))
(case-fold-search nil))
(if (cl-search "test/" name)
(replace-regexp-in-string "/" "."
(replace-regexp-in-string "^\/[^A-Z]*" ""
(car (last (split-string name "src")))))
(file-name-nondirectory name))))`} (main, test) where
--------------------------------------------------------------------------------
import Test.Prelude
--------------------------------------------------------------------------------
import ${1:$(s-chop-suffix "Spec" yas-text)}
--------------------------------------------------------------------------------
main :: IO ()
main = defaultMain test
test :: TestTree
test = testGroup "$1"
[ $0
]

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: undefined
# key: u
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))
# --
undefined$1

View file

@ -0,0 +1,4 @@
# key: at
# name: action-type
# --
export const ${1:FOO_BAR$(->> yas-text s-upcase (s-replace-all '(("-" . "_") (" " . "_"))))}: '${3:ns}/${1:$(-> yas-text s-dashed-words)}' = '$3/${1:$(-> yas-text s-dashed-words)}'$5

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: before
# key: bef
# --
before(function() {
$1
})

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: context
# key: context
# --
context('$1', function() {
$2
})

View file

@ -0,0 +1,6 @@
# key: desc
# name: describe
# --
describe('$1', () => {
$2
})

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: expect
# key: ex
# --
expect($1).$2

View file

@ -0,0 +1,6 @@
# key: f
# name: function
# --
function $1($2) {
$3
}

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: header
# key: hh
# expand-env: ((yas-indent-line 'fixed))
# --
////////////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: it
# key: it
# --
it('$1', () => {
$2
})

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: it-pending
# key: xi
# --
it('$1')$0

View file

@ -0,0 +1,12 @@
# key: module
# name: module
# expand-env: ((yas-indent-line (quote fixed)))
# condition: (= (length "module") (current-column))
# --
/**
* @fileOverview $1
* @name ${2:`(file-name-nondirectory (buffer-file-name))`}
* @author Griffin Smith
* @license Proprietary
*/
$3

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: record
# key: rec
# --
export default class $1 extends Record({
$2
}) {}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: test
# key: test
# --
test('$1', () => {
$2
})

View file

@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: fetchFromGitHub
# uuid: fetchFromGitHub
# key: fetchFromGitHub
# condition: t
# --
fetchFromGitHub {
owner = "$1";
repo = "$2";
rev = "$3";
sha256 = "0000000000000000000000000000000000000000000000000000";
}

View file

@ -0,0 +1,16 @@
# key: pypkg
# name: pythonPackage
# condition: t
# --
${1:pname} = buildPythonPackage rec {
name = "\${pname}-\${version}";
pname = "$1";
version = "${2:1.0.0}";
src = fetchPypi {
inherit pname version;
sha256 = "0000000000000000000000000000000000000000000000000000";
};
propagatedBuildInputs = with pythonSelf; [
$3
];
};

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: sha256
# uuid: sha256
# key: sha256
# condition: t
# --
sha256 = "0000000000000000000000000000000000000000000000000000";

View file

@ -0,0 +1,6 @@
# key: sql
# name: SQL source block
# --
#+BEGIN_SRC sql ${1::async}
$2
#+END_SRC

View file

@ -0,0 +1,13 @@
# -*- mode: snippet -*-
# name: combat
# uuid: combat
# key: combat
# condition: t
# --
| | initiative | max hp | current hp | status | |
|-------------+------------+--------+------------+--------+------|
| Barty Barty | | | | | <--- |
| Hectoroth | | | | | |
| Xanadu | | | | | |
| Aurora | | | | | |
| EFB | | | | | |

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# key: date
# name: date.org
# --
[`(format-time-string "%Y-%m-%d")`]$0

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: date-time
# key: dt
# --
[`(format-time-string "%Y-%m-%d %H:%m:%S")`]

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: description
# key: desc
# --
:DESCRIPTION:
$1
:END:

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: nologdone
# key: nologdone
# --
#+STARTUP: nologdone$0

View file

@ -0,0 +1,6 @@
# key: py
# name: Python source block
# --
#+BEGIN_SRC python
$0
#+END_SRC

View file

@ -0,0 +1,6 @@
# key: reveal
# name: reveal
# condition: t
# --
#+ATTR_REVEAL: :frag ${1:roll-in}
$0

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: transaction
# key: begin
# --
BEGIN;
$0
ROLLBACK;

View file

@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: tests
# uuid: tests
# key: tests
# condition: t
# --
:- begin_tests(${1:name}).
$0
:- end_tests($1).

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: use-module
# uuid: use-module
# key: use
# condition: t
# --
:- use_module(${1:library($2)}${3:, [$4]}).

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: add_column
# key: op.add_column
# --
op.add_column('${1:table}', sa.Column('${2:name}', sa.${3:String()}))$0

View file

@ -0,0 +1,15 @@
# -*- mode: snippet -*-
# name: decorate
# uuid: decorate
# key: decorate
# condition: t
# --
def wrap(inner):
@wraps(inner)
def wrapped(*args, **kwargs):
ret = inner(*args, **kwargs)
return ret
return wrapped
return wrap

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: dunder
# uuid: dunder
# key: du
# condition: t
# --
__$1__$0

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: name
# uuid: name
# key: name
# condition: t
# --
__name__

View file

@ -0,0 +1,7 @@
# key: exec
# name: op.get_bind.execute
# --
op.get_bind().execute(
"""
`(progn (sqlup-mode) "")`$1
""")

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: pdb
# uuid: pdb
# key: pdb
# condition: t
# --
import pdb; pdb.set_trace()

View file

@ -0,0 +1,5 @@
# key: macro_use
# name: #[macro_use]
# --
#[macro_use]
${1:extern crate} ${2:something};$0

View file

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: async test
# uuid: atest
# key: atest
# condition: t
# --
#[tokio::test${1:(flavor = "multi_thread")}]
async fn ${2:test_name}() {
`%`$0
}

View file

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: benchmark
# uuid: benchmark
# key: bench
# condition: t
# --
#[bench]
fn ${1:benchmark_name}(b: &mut Bencher) {
`%`b.iter(|| $0);
}

View file

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: proptest
# uuid: proptest
# key: proptest
# condition: t
# --
#[proptest]
fn ${1:test_name}($2) {
`%`$0
}

View file

@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: test-module
# uuid: test-module
# key: tmod
# condition: t
# --
mod $1 {
use super::*;
$0
}

View file

@ -0,0 +1,9 @@
# key: tests
# name: test module
# --
#[cfg(test)]
mod ${1:tests} {
use super::*;
$0
}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: indent
# key: indent
# --
# expand-env: ((yas-indent-line 'fixed))

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: count(*) group by
# key: countby
# --
SELECT count(*), ${1:column} FROM ${2:table} GROUP BY $1;

View file

@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: variable
# uuid: variable
# key: var
# condition: t
# --
variable "${1:name}" {
type = ${2:string}
${3:default = ${4:default}}
}
$0

View file

@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# name: date
# key: date
# --
`(format-time-string "%Y-%m-%d")`$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: expect-test
# uuid: expect-test
# key: exp
# condition: t
# --
let%expect_test "${1:name}" =
${2:<body>};
[%expect {| $3 |}]

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: module
# uuid: module
# key: mod
# condition: t
# --
module ${1:Name} = struct
$0
end

View file

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: test-module
# uuid: test-module
# key: tmod
# condition: t
# --
let%test_module ${1:_} =
(module struct
$0
end)