.emacs-all 8.8 KB

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