.emacs-all 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. ;;; PACKAGES
  2. ;; Bootstrap Straight Package Manager
  3. (defvar bootstrap-version)
  4. (let ((bootstrap-file
  5. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  6. (bootstrap-version 5))
  7. (unless (file-exists-p bootstrap-file)
  8. (with-current-buffer
  9. (url-retrieve-synchronously
  10. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  11. 'silent 'inhibit-cookies)
  12. (goto-char (point-max))
  13. (eval-print-last-sexp)))
  14. (load bootstrap-file nil 'nomessage))
  15. ;; packages to install and load
  16. (straight-use-package 'auto-complete)
  17. (straight-use-package '(nano-theme :type git :host github
  18. :repo "rougier/nano-theme"))
  19. (straight-use-package
  20. '(slime-company :type git :host github :repo "anwyn/slime-company"))
  21. (straight-use-package 'sublimity)
  22. (straight-use-package 'dashboard)
  23. (straight-use-package 'all-the-icons)
  24. (straight-use-package 'neotree)
  25. (straight-use-package 'rust-mode)
  26. (straight-use-package 'powerline)
  27. (straight-use-package 'markdown-mode)
  28. (straight-use-package 'moe-theme)
  29. (straight-use-package 'ample-theme)
  30. (straight-use-package 'slime)
  31. (straight-use-package 'ac-slime)
  32. (straight-use-package 'evil)
  33. (straight-use-package 'dimmer)
  34. (straight-use-package 'magit)
  35. (straight-use-package 'diff-hl)
  36. (straight-use-package 'powerline-evil)
  37. (straight-use-package 'rainbow-delimiters)
  38. (straight-use-package 'focus)
  39. (straight-use-package 'solarized-theme)
  40. (straight-use-package 'windresize)
  41. (straight-use-package 'yasnippet)
  42. (straight-use-package
  43. '(janet-mode :type git :host github
  44. :repo "ALSchwalm/janet-mode"))
  45. (require 'yasnippet)
  46. ;; Configure focus
  47. (require 'focus)
  48. (add-to-list 'focus-mode-to-thing '(lisp-mode . paragraph))
  49. ;; rainbow delims
  50. (require 'rainbow-delimiters)
  51. (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
  52. ;; Git stuff
  53. (require 'magit)
  54. (require 'diff-hl)
  55. ;; Just enable diff-hl per buffer,
  56. ;; it seems expensive
  57. ;; (global-diff-hl-mode)
  58. (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
  59. (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
  60. (diff-hl-margin-mode t)
  61. (require 'dimmer)
  62. (setq dimmer-fraction 0.4)
  63. ;; always enable ido mode
  64. (require 'ido)
  65. (ido-mode t)
  66. (require 'evil)
  67. (evil-mode 1)
  68. ;; Enable tab behavior like vi
  69. (straight-use-package '(evil-tabs :type git :host github
  70. :repo "krisajenkins/evil-tabs"))
  71. (require 'evil-tabs)
  72. (global-evil-tabs-mode t)
  73. (require 'auto-complete)
  74. (global-auto-complete-mode t)
  75. (require 'slime)
  76. (require 'ac-slime)
  77. (slime-setup '(slime-fancy ac-slime))
  78. (add-hook 'slime-mode-hook 'set-up-slime-ac)
  79. (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
  80. (eval-after-load "auto-complete"
  81. '(add-to-list 'ac-modes 'slime-repl-mode))
  82. (require 'markdown-mode)
  83. (require 'powerline)
  84. ;;(powerline-default-theme)
  85. ;; Better powerline support for evil mode
  86. (require 'powerline-evil)
  87. (powerline-evil-vim-theme)
  88. (require 'neotree)
  89. (global-set-key [f8] 'neotree-toggle)
  90. (require 'dashboard)
  91. (dashboard-setup-startup-hook)
  92. (require 'all-the-icons)
  93. (require 'sublimity)
  94. (require 'sublimity-scroll)
  95. (require 'sublimity-map) ;; experimental
  96. (require 'sublimity-attractive)
  97. (setq sublimity-scroll-weight 10
  98. sublimity-scroll-drift-length 5)
  99. (setq sublimity-map-size 30)
  100. (setq sublimity-map-fraction 0.3)
  101. (setq sublimity-map-text-scale -9)
  102. (sublimity-map-set-delay 0.1)
  103. (setq sublimity-attractive-centering-width nil)
  104. (setq backup-directory-alist
  105. `((".*" . ,temporary-file-directory)))
  106. (setq auto-save-file-name-transforms
  107. `((".*" ,temporary-file-directory t)))
  108. ;;; Generic options for all OSs
  109. ; Smooth mouse scroll a bit
  110. (setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
  111. (setq mouse-wheel-progressive-speed nil)
  112. ;; normal home/end behavior
  113. (global-set-key (kbd "<home>") 'beginning-of-line)
  114. (global-set-key (kbd "<end>") 'end-of-line)
  115. ;; Custom functions
  116. (defun reload-dot-emacs ()
  117. (interactive)
  118. (load-file (file-truename "~/.emacs")))
  119. (defun sol-dk ()
  120. (interactive)
  121. (load-theme 'solarized-dark))
  122. (defun sol-l ()
  123. (interactive)
  124. (load-theme 'solarized-light))
  125. ;; Keybinds/macros
  126. (global-set-key (kbd "C-c e") 'diff-hl-mode)
  127. (global-set-key (kbd "C-c d") 'dimmer-mode)
  128. (global-set-key (kbd "C-c s") 'sublimity-mode)
  129. (global-set-key (kbd "C-c f") 'focus-mode)
  130. (global-set-key (kbd "C-c r") 'reload-dot-emacs)
  131. (global-set-key (kbd "C-c l") 'display-line-numbers-mode)
  132. (global-set-key (kbd "C-c w") 'windresize)
  133. (global-set-key (kbd "C-c t") 'sol-dk)
  134. (global-set-key (kbd "C-c g") 'sol-l)
  135. (global-set-key (kbd "C-c y") 'evil-mode) ; Quick toggle evil-mode for slime err
  136. (global-set-key (kbd "C-c h") 'tramp-cleanup-connection)
  137. (global-set-key (kbd "C-c C-.") '(lambda ()
  138. (interactive)
  139. (switch-to-buffer "*Messages*")))
  140. (global-set-key (kbd "C-c C-f") 'find-file-at-point)
  141. ;;; Can probably be replaced with
  142. ;;; a yasnippet
  143. (fset 'date-to-point
  144. (kmacro-lambda-form [?\C-u ?\M-! ?d ?a ?t ?e return] 0 "%d"))
  145. ;;; Erc config
  146. (setq erc-nick "speskk")
  147. (setq erc-hide-list '("JOIN" "PART" "QUIT"))
  148. (if (file-exists-p "~/.emacs.d/.erc-auth.el")
  149. (progn
  150. (load "~/.emacs.d/.erc-auth.el")
  151. (defun connect-to-libera-erc () (interactive)
  152. (erc :server "irc.libera.chat" :port "6667"
  153. :nick "speskk" :password *libera-chat*))))
  154. ;; Allow M-up / M-down behavior to switch windows
  155. (windmove-default-keybindings 'meta)
  156. (display-time-mode t)
  157. ;; Perl Config
  158. (setq
  159. perl-indent-parens-as-block 0
  160. perl-indent-level 8)
  161. ;; Set to make mouse focus window
  162. (setq mouse-autoselect-window t
  163. focus-follows-mouse t)
  164. ;; Custom eshell prompt
  165. (setq eshell-prompt-function
  166. (lambda nil
  167. " λ > "))
  168. (setq eshell-prompt-regexp "^ λ > ")
  169. (set-language-environment "UTF-8")
  170. ;; Simple rclone cli wrapper
  171. (load "~/Repos/dotfiles/emacs/elisp/rclone.el")
  172. (global-set-key (kbd "C-c o") 'rclone-post-buffer)
  173. (global-set-key (kbd "C-c C-o") 'rclone-get-org)
  174. ;; Small helper functions
  175. (load "~/Repos/dotfiles/emacs/elisp/helpers.el")
  176. (global-set-key (kbd "C-c p") 'display-full-buffer-path)
  177. ;; Load for macOS
  178. ;;; Slime/etc
  179. (if (eq system-type 'darwin)
  180. (progn
  181. ;; Configure yasnippet
  182. (setq yas-snippet-dirs
  183. '("~/Repos/dotfiles/emacs/yasnippets/"))
  184. (yas-global-mode 1)
  185. (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
  186. (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
  187. ;; Font/themes/etc
  188. (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
  189. ;; Easily set cua mode on/off so that I don't have to
  190. ;; use shift+insert for paste on mac
  191. (global-set-key (kbd "C-c c") 'cua-mode)
  192. ;; Graphic Display
  193. (if (display-graphic-p)
  194. (progn
  195. (load-theme 'solarized-dark t)))))
  196. ;; Load for Windows10
  197. (if (eq system-type 'windows-nt)
  198. (progn
  199. ;; Configure yasnippet
  200. (setq yas-snippet-dirs
  201. '("C:/Users/watsonsi/Documents/Github/dotfiles/emacs/yasnippets/"))
  202. (yas-global-mode 1)
  203. (load "C:/Users/watsonsi/Documents/GitHub/dotfiles/emacs/windows-load/customs.el")
  204. (setq visible-bell 1)
  205. (load-theme 'solarized-light t)))
  206. ;; Load for GUI Linux
  207. (if (eq system-type 'gnu/linux)
  208. (if (display-graphic-p)
  209. (progn
  210. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  211. (setq inferior-lisp-program "/usr/local/bin/sbcl")
  212. (setq yas-snippet-dirs
  213. '("~/Repos/dotfiles/emacs/yasnippets/"))
  214. (yas-global-mode 1)
  215. (straight-use-package 'exwm)
  216. (require 'exwm)
  217. ;(require 'exwm-systemtray)
  218. ;(exwm-systemtray-enable)
  219. (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
  220. (require 'exwm-config-spw)
  221. (exwm-config-spw)
  222. (setq visible-bell 1)
  223. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  224. (load-theme 'solarized-light t))))
  225. ;; Load for Term
  226. (unless (display-graphic-p)
  227. (progn
  228. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  229. (xterm-mouse-mode t)
  230. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  231. (setq inferior-lisp-program "/usr/local/bin/sbcl")))