.emacs-all 7.8 KB

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