.emacs-all 8.5 KB

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