(use-package yasnippet-snippets
:defer 2
:hook (prog-mode . yas-minor-mode)
:config
(yas-define-snippets 'js-mode
'(("clg" "console.log('$1: %s (%s)',$2);" "pX console.log()")
("cle" "console.error('$1: %s (%s)',$2);" "pX console.error()")
("Js" "JSON.stringify($1)" "pX JSON Stringification")
("i" "if ($1) {\n$2\n\t} else {\n$3\n\t}\n" "Standard if")
("time" "`(current-time-string)`" "Current Time")
("if" "if ($1) {\n\t$2\n}" "pX if")))
(yas-define-snippets 'sh-mode
'(("if" "if [ $1 ] ; then\n\t$2\nelse\n\t$3\nfi " "pX if"))))
Optional:
(use-package company
:defer 2
:after prog-mode
:hook (prog-mode . company-mode)
:bind (:map company-active-map
([(tab)] . company-auto-complete))
:custom
(company-dabbrev-ignore-case t)
(company-etags-ignore-case t)
(company-selection-wrap-around t)
(company-minimum-prefix-length 1)
(company-idle-delay 0.0)
:config
(eval-after-load 'company
'(add-to-list 'company-backends '(company-yasnippet company-dabbrev-code company-capf))))