summaryrefslogtreecommitdiff
path: root/emacs-config.org
diff options
context:
space:
mode:
Diffstat (limited to 'emacs-config.org')
-rw-r--r--emacs-config.org59
1 files changed, 59 insertions, 0 deletions
diff --git a/emacs-config.org b/emacs-config.org
index 748cb5a..e50c80a 100644
--- a/emacs-config.org
+++ b/emacs-config.org
@@ -1517,6 +1517,65 @@ Increase image resolution.
(setq-default doc-view-resolution 400)
#+end_src
+** Abbrev
+Enable for modes.
+#+begin_src elisp
+ (dolist (hook '(org-mode-hook
+ c-mode-hook))
+ (add-hook hook #'abbrev-mode))
+#+end_src
+
+Org-mode abbrev table.
+#+begin_src elisp
+ (with-eval-after-load 'abbrev
+ (define-abbrev-table
+ 'org-mode-abbrev-table '(("eq" "" +skeleton-org-math-frag))))
+#+end_src
+
+C-mode abbrev table.
+#+begin_src elisp
+ (with-eval-after-load 'abbrev
+ (define-abbrev-table
+ 'c-mode-abbrev-table '(("if" "" +skeleton-c-if-statement)
+ ("while" "" +skeleton-c-while-loop)
+ ("for" "" +skeleton-c-for-loop))))
+#+end_src
+
+*** Org Skeleton Templates
+#+begin_src elisp
+ (define-skeleton +skeleton-org-math-frag
+ "Org LaTeX math fragment skeleton."
+ > "\\[" \n _ \n "\\]")
+#+end_src
+
+*** C Skeleton Templates
+#+begin_src elisp
+ (define-skeleton +skeleton-c-if-statement
+ "C `if' statement skeleton."
+ nil
+ > "if ("_") {" \n
+ > @ _ \n
+ > -2 "}")
+#+end_src
+
+#+begin_src elisp
+ (define-skeleton +skeleton-c-while-loop
+ "C `while' statement skeleton."
+ nil
+ > "while ("_") {" \n
+ > @ _ \n
+ > -2 "}")
+#+end_src
+
+#+begin_src elisp
+ (define-skeleton +skeleton-c-for-loop
+ "C `for loop' skeleton."
+ nil
+ > "for (int i=0; i < "_"; ++i) {" \n
+ > @ _ \n
+ > -2 "}")
+#+end_src
+
* Global Keybindings
Unlock previously unusable keybinding.
#+begin_src elisp