(Emacs)~yasnipet -> snippets

Now creating a system to use skeleton and abbrev to replace yasnippet
This commit is contained in:
2020-09-27 21:45:03 +01:00
parent 9afc74f0fe
commit 1da0fda75b

View File

@@ -830,12 +830,29 @@ Use hydras for stuff that I use often, currently buffer manipulation
("p" dx:paste-section) ("p" dx:paste-section)
("TAB" evil-toggle-fold))) ("TAB" evil-toggle-fold)))
#+end_src #+end_src
** Yasnippet ** Snippets
*** Preamble *** Snippets Preamble
Yasnippet is a great package for snippets, which I use heavily in Snippets are a system by which pieces of code can be inserted via
programming and org-mode. I setup here the global mode for yasnippet prefixes. For example, an 'if' snippet would work by first inserting
and a collection of snippets for ease of use. the word 'if' then pressing some _expansion key_ such as TAB. This
will insert a set of text that may be have some components that need
to be further filled by the user.
The popular solution is Yasnippet. Yasnippet is a great package for
snippets, which I use heavily in programming and org-mode. I setup
here the global mode for yasnippet and a collection of snippets for
ease of use.
However, Emacs provides its own 'auto typing' facilities. Abbrevs and
skeletons make up the popular solution within Emacs default. Abbrevs
are for simple expressions wherein there is only one user input (say,
getting today's time which only requires you asking for it). They
provide a lot of inbuilt functionality and are quite useful.
Skeletons, on the other hand, are for higher level insertions
*** Yasnippet default *** Yasnippet default
:PROPERTIES:
:header-args:emacs-lisp: :tangle no
:END:
Setup global mode after evil mode has been loaded Setup global mode after evil mode has been loaded
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
@@ -850,6 +867,9 @@ Setup global mode after evil mode has been loaded
(yas-load-directory (no-littering-expand-etc-file-name "yasnippet/snippets"))) (yas-load-directory (no-littering-expand-etc-file-name "yasnippet/snippets")))
#+end_src #+end_src
*** Yasnippet snippets *** Yasnippet snippets
:PROPERTIES:
:header-args:emacs-lisp: :tangle no
:END:
Collection of snippets, activate after yasnippet has been loaded. Collection of snippets, activate after yasnippet has been loaded.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet-snippets (use-package yasnippet-snippets