.emacs-all 8.9 KB

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