Переглянути джерело

Added yasnippets for all configs and a few example snippets

Simon Watson 3 роки тому
батько
коміт
e545250d7d

+ 21 - 0
emacs/.emacs-all

@@ -39,6 +39,9 @@
 (straight-use-package 'focus)
 (straight-use-package 'solarized-theme)
 (straight-use-package 'windresize)
+(straight-use-package 'yasnippet)
+
+(require 'yasnippet)
 
 ;; Configure focus
 (require 'focus)
@@ -160,6 +163,11 @@
 ;;; Slime/etc
 (if (eq system-type 'darwin)
     (progn
+      ;; Configure yasnippet
+      (setq yas-snippet-dirs
+	    '("~/Repos/dotfiles/emacs/yasnippets/"))
+      (yas-global-mode 1)
+      
       (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
       (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
       (load "/Users/swatson/.emacs.d/.erc-auth.el")
@@ -182,6 +190,11 @@
 ;; Load for Windows10
 (if (eq system-type 'windows-nt)
     (progn
+      ;; Configure yasnippet
+      (setq yas-snippet-dirs
+	    '("C:/Users/watsonsi/Documents/Github/dotfiles/emacs/yasnippets/"))
+      (yas-global-mode 1)
+
       (load "C:/Users/watsonsi/Documents/GitHub/dotfiles/emacs/windows-load/customs.el")
       (setq visible-bell 1)
       (load-theme 'solarized-light t)))
@@ -190,6 +203,14 @@
 (if (eq system-type 'gnu/linux)
     (if (display-graphic-p)
 	(progn
+	  (setq yas-snippet-dirs
+	    '("~/Repos/dotfiles/emacs/yasnippets/"))
+	  (yas-global-mode 1)
+
+	  ;; Set to make mouse focus window
+	  (setq mouse-autoselect-window t
+		focus-follows-mouse t)
+	  
 	  (straight-use-package 'exwm)
 	  (require 'exwm)
 

+ 4 - 0
emacs/yasnippets/eshell-mode/for

@@ -0,0 +1,4 @@
+#name : Eshell for loop
+#key : for
+# --
+for f in ${1:*} { ${2:echo} "$f"; $3} $0

+ 5 - 0
emacs/yasnippets/eshell-mode/ll

@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: exa list 
+# key: /ll
+# --
+exa -lah

+ 5 - 0
emacs/yasnippets/lisp-mode/defun

@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: defun elisp 
+# key: /df
+# --
+(defun ${1:fun-name} ()