.emacs-all 8.2 KB

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