.emacs-all 8.7 KB

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