.emacs-all 9.4 KB

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