.emacs-all 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. ;; Bootstrap Straight Package Manager
  2. (defvar bootstrap-version)
  3. (let ((bootstrap-file
  4. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  5. (bootstrap-version 5))
  6. (unless (file-exists-p bootstrap-file)
  7. (with-current-buffer
  8. (url-retrieve-synchronously
  9. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  10. 'silent 'inhibit-cookies)
  11. (goto-char (point-max))
  12. (eval-print-last-sexp)))
  13. (load bootstrap-file nil 'nomessage))
  14. ;; packages to install and load
  15. (straight-use-package 'auto-complete)
  16. (straight-use-package '(nano-theme :type git :host github
  17. :repo "rougier/nano-theme"))
  18. (straight-use-package
  19. '(slime-company :type git :host github :repo "anwyn/slime-company"))
  20. (straight-use-package 'sublimity)
  21. (straight-use-package 'all-the-icons)
  22. (straight-use-package 'neotree)
  23. (straight-use-package 'rust-mode)
  24. (straight-use-package 'markdown-mode)
  25. (straight-use-package 'moe-theme)
  26. (straight-use-package 'ample-theme)
  27. (straight-use-package 'slime)
  28. (straight-use-package 'ac-slime)
  29. (straight-use-package 'evil)
  30. (straight-use-package 'dimmer)
  31. (straight-use-package 'magit)
  32. (straight-use-package 'diff-hl)
  33. (straight-use-package 'rainbow-delimiters)
  34. (straight-use-package 'focus)
  35. (straight-use-package 'solarized-theme)
  36. (straight-use-package 'windresize)
  37. (straight-use-package 'yasnippet)
  38. (straight-use-package
  39. '(janet-mode :type git :host github
  40. :repo "ALSchwalm/janet-mode"))
  41. (straight-use-package
  42. '(puppet-mode :type git :host github
  43. :repo "voxpupuli/puppet-mode"))
  44. (straight-use-package
  45. '(pico8-mode :type git :host github
  46. :repo "Kaali/pico8-mode"))
  47. (straight-use-package
  48. '(fzf :type git :host github
  49. :repo "bling/fzf.el"))
  50. ;; Mastodon
  51. (straight-use-package
  52. '(mastodon
  53. :type git :host nil
  54. :repo "https://codeberg.org/martianh/mastodon.el"))
  55. ;; Gopher browser
  56. (straight-use-package 'elpher)
  57. (straight-use-package 'xterm-color)
  58. (defun display-ansi-colors ()
  59. (interactive)
  60. (let ((inhibit-read-only t))
  61. (ansi-color-apply-on-region (point-min) (point-max))))
  62. ;;; Terminal in emacs via vterm lib
  63. (straight-use-package
  64. '(vterm :type git :host github
  65. :repo "akermu/emacs-libvterm"))
  66. ;;; Vterm config
  67. (setq vterm-buffer-name-string "%s")
  68. (add-hook 'vterm-mode-hook
  69. (lambda ()
  70. (set (make-local-variable 'buffer-face-mode-face) 'fixed-pitch)
  71. (buffer-face-mode t)))
  72. (global-set-key (kbd "C-<escape>") 'vterm-send-escape)
  73. (global-set-key (kbd "C-c C-s") 'vterm-send-C-r)
  74. (global-set-key (kbd "C-c C-u") 'vterm-send-C-u)
  75. (global-set-key (kbd "C-c C-d") 'vterm-send-C-d)
  76. ;;; Syntax highlights for uxn-tal
  77. (straight-use-package
  78. '(tal-mode :type git :host github
  79. :repo "rafapaezbas/uxntal-mode"))
  80. ;;; Cursor highlighter
  81. (straight-use-package
  82. '(beacon :type git :host github
  83. :repo "Malabarba/beacon"))
  84. (global-set-key (kbd "C-c B") 'beacon-mode)
  85. ;; Vimperator like hints for
  86. ;; file navigationaki2o/emacs-pophint
  87. (straight-use-package
  88. '(pophint :type git :host github
  89. :repo "aki2o/emacs-pophint"))
  90. (global-set-key (kbd "C-c f") 'pophint:do-flexibly)
  91. ;;; Code folding
  92. (add-hook 'prog-mode-hook 'hs-minor-mode)
  93. (global-set-key (kbd "C-c a") 'hs-toggle-hiding)
  94. ;;; Error checking
  95. (global-set-key (kbd "C-c 2 e") 'flymake-mode)
  96. ;; System monitor
  97. ;; (straight-use-package
  98. ;; '(symon :type git :host github
  99. ;; :repo "zk-phi/symon"))
  100. ;; For whatever reason, using straight to build this
  101. ;; package results in bugs on Linux (not OSX). I'm assuming
  102. ;; because straight is building from git and there is a regression.
  103. ;; As such -- MELPA config
  104. (require 'package)
  105. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  106. (package-install 'symon)
  107. (symon-mode 1)
  108. (straight-use-package
  109. '(telephone-line :type git :host github
  110. :repo "dbordak/telephone-line"))
  111. (telephone-line-mode 1)
  112. ;;; Indent highlighting
  113. (straight-use-package
  114. '(highlight-indent-guides
  115. :type git :host github
  116. :repo "DarthFennec/highlight-indent-guides"))
  117. (setq highlight-indent-guides-method 'character)
  118. (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
  119. ;; Org mode
  120. ;; Get src block tabs to work how I expect
  121. (setq org-src-tab-acts-natively t)
  122. (setq org-src-preserve-indentation nil
  123. org-edit-src-content-indentation 0)
  124. (require 'yasnippet)
  125. ;; Configure focus
  126. (require 'focus)
  127. (add-to-list 'focus-mode-to-thing '(lisp-mode . paragraph))
  128. ;; rainbow delims
  129. (require 'rainbow-delimiters)
  130. (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
  131. ;; Git stuff
  132. (require 'magit)
  133. (require 'diff-hl)
  134. ;; Just enable diff-hl per buffer,
  135. ;; it seems expensive
  136. ;; (global-diff-hl-mode)
  137. (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
  138. (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
  139. (diff-hl-margin-mode t)
  140. (require 'dimmer)
  141. (setq dimmer-fraction 0.4)
  142. ;; always enable ido mode
  143. (require 'ido)
  144. (ido-mode t)
  145. (require 'evil)
  146. (evil-mode 1)
  147. ;; Enable tab behavior like vi
  148. (straight-use-package '(evil-tabs :type git :host github
  149. :repo "krisajenkins/evil-tabs"))
  150. (require 'evil-tabs)
  151. (global-evil-tabs-mode t)
  152. (require 'auto-complete)
  153. (global-auto-complete-mode t)
  154. (require 'slime)
  155. (require 'ac-slime)
  156. (slime-setup '(slime-fancy ac-slime))
  157. (add-hook 'slime-mode-hook 'set-up-slime-ac)
  158. (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
  159. (eval-after-load "auto-complete"
  160. '(add-to-list 'ac-modes 'slime-repl-mode))
  161. (require 'markdown-mode)
  162. (require 'neotree)
  163. (global-set-key [f8] 'neotree-toggle)
  164. (require 'all-the-icons)
  165. (require 'sublimity)
  166. (require 'sublimity-scroll)
  167. (require 'sublimity-map) ;; experimental
  168. (require 'sublimity-attractive)
  169. (setq sublimity-scroll-weight 10
  170. sublimity-scroll-drift-length 5)
  171. (setq sublimity-map-size 40)
  172. (setq sublimity-map-fraction 0.3)
  173. (setq sublimity-map-text-scale -5)
  174. (sublimity-map-set-delay 0.1)
  175. (setq sublimity-attractive-centering-width nil)
  176. (setq backup-directory-alist
  177. `((".*" . ,temporary-file-directory)))
  178. (setq auto-save-file-name-transforms
  179. `((".*" ,temporary-file-directory t)))
  180. ;;; Generic options for all OSs
  181. ; Smooth mouse scroll a bit
  182. (setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
  183. (setq mouse-wheel-progressive-speed nil)
  184. ;; normal home/end behavior
  185. (global-set-key (kbd "<home>") 'beginning-of-line)
  186. (global-set-key (kbd "<end>") 'end-of-line)
  187. (defun sol-dk ()
  188. (interactive)
  189. (load-theme 'solarized-dark))
  190. (defun sol-l ()
  191. (interactive)
  192. (load-theme 'solarized-light))
  193. ;; Keybinds/macros
  194. ;;(global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers magit-status-mode-map)
  195. (global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers)
  196. (global-set-key (kbd "C-c ;") 'comment-line)
  197. (global-set-key (kbd "C-c b") 'fzf-switch-buffer)
  198. (global-set-key (kbd "C-c z") 'fzf-find-file)
  199. (global-set-key (kbd "C-c e") '(lambda ()
  200. (interactive)
  201. (diff-hl-mode)
  202. (diff-hl-flydiff-mode)))
  203. (global-set-key (kbd "C-c d") 'slime-describe-symbol)
  204. (global-set-key (kbd "C-c M-r") 'slime-restart-inferior-lisp)
  205. (global-set-key (kbd "C-c D") 'dimmer-mode)
  206. (global-set-key (kbd "C-c S") 'sublimity-mode)
  207. (global-set-key (kbd "C-c s") 'flyspell-correct-word-before-point)
  208. (global-set-key (kbd "C-c F") 'focus-mode)
  209. (global-set-key (kbd "C-c r") '(lambda ()
  210. (interactive)
  211. (load-file (file-truename "~/.emacs"))))
  212. (global-set-key (kbd "C-c C-e") '(lambda ()
  213. (interactive)
  214. (find-file (file-truename "~/.emacs"))
  215. (with-current-buffer (buffer-name)
  216. (emacs-lisp-mode))))
  217. (global-set-key (kbd "C-c l") 'display-line-numbers-mode)
  218. (global-set-key (kbd "C-c w") 'window-swap-states)
  219. (global-set-key (kbd "C-c C-w") 'windresize)
  220. (global-set-key (kbd "C-c W") 'whitespace-mode)
  221. (global-set-key (kbd "C-c t") 'sol-dk)
  222. (global-set-key (kbd "C-c y") 'sol-l)
  223. (global-set-key (kbd "C-c g") 'magit)
  224. (global-set-key (kbd "C-c C-.") '(lambda ()
  225. (interactive)
  226. (switch-to-buffer "*Messages*")))
  227. (global-set-key (kbd "C-c C-f") 'find-file-at-point)
  228. ;;; Can probably be replaced with
  229. ;;; a yasnippet
  230. (fset 'date-to-point
  231. (kmacro-lambda-form [?\C-u ?\M-! ?d ?a ?t ?e return] 0 "%d"))
  232. ;;; Erc config
  233. (setq erc-nick "speskk")
  234. (setq erc-hide-list '("JOIN" "PART" "QUIT"))
  235. (if (file-exists-p "~/.emacs.d/.erc-auth.el")
  236. (progn
  237. (load "~/.emacs.d/.erc-auth.el")
  238. (defun connect-to-libera-erc () (interactive)
  239. (erc :server "irc.libera.chat" :port "6667"
  240. :nick "speskk" :password *libera-chat*))))
  241. ;; Allow M-up / M-down behavior to switch windows
  242. (windmove-default-keybindings 'meta)
  243. (display-time-mode t)
  244. ;; Perl Config
  245. (setq
  246. perl-indent-parens-as-block 0
  247. perl-indent-level 8)
  248. ;; Set to make mouse focus window
  249. (setq mouse-autoselect-window t
  250. focus-follows-mouse t)
  251. ;; Custom eshell prompt
  252. (setq eshell-prompt-function
  253. (lambda nil
  254. " λ > "))
  255. (setq eshell-prompt-regexp "^ λ > ")
  256. (set-language-environment "UTF-8")
  257. ;; Simple rclone cli wrapper
  258. (load "~/Repos/dotfiles/emacs/elisp/rclone.el")
  259. (global-set-key (kbd "C-c o") 'rclone-post-buffer)
  260. (global-set-key (kbd "C-c C-o") 'rclone-get-org)
  261. (global-set-key (kbd "C-c C-P") 'post-region-to-pb)
  262. (global-set-key (kbd "C-c 2 p") 'display-pb)
  263. ;; Small helper functions
  264. (load "~/Repos/dotfiles/emacs/elisp/helpers.el")
  265. (global-set-key (kbd "C-c p") 'display-full-buffer-path)
  266. ;; Disable bars
  267. (menu-bar-mode -1)
  268. (tool-bar-mode -1)
  269. (scroll-bar-mode -1)
  270. ;; Load for macOS
  271. ;;; Slime/etc
  272. (if (eq system-type 'darwin)
  273. (progn
  274. ;; Configure yasnippet
  275. (setq yas-snippet-dirs
  276. '("~/Repos/dotfiles/emacs/yasnippets/"))
  277. (yas-global-mode 1)
  278. (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
  279. (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
  280. ;; Font/themes/etc
  281. (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
  282. ;; Easily set cua mode on/off so that I don't have to
  283. ;; use shift+insert for paste on mac
  284. (global-set-key (kbd "C-c c") 'cua-mode)
  285. (global-set-key (kbd "C-c n") 'toggle-frame-fullscreen)
  286. ;; Graphic Display
  287. (if (display-graphic-p)
  288. (progn
  289. (load-theme 'solarized-dark t)))))
  290. ;; Load for GUI Linux
  291. (if (eq system-type 'gnu/linux)
  292. (if (display-graphic-p)
  293. (progn
  294. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  295. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))
  296. ;; https://emacs.stackexchange.com/questions/332/how-can-i-find-the-path-to-an-executable-with-emacs-lisp
  297. (setq yas-snippet-dirs
  298. '("~/Repos/dotfiles/emacs/yasnippets/"))
  299. (yas-global-mode 1)
  300. (if (file-exists-p "~/.enable_exwm")
  301. (progn
  302. (straight-use-package 'exwm)
  303. (require 'exwm)
  304. (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
  305. (require 'exwm-config-spw)
  306. (exwm-config-spw)))
  307. (setq visible-bell 1)
  308. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  309. (load-theme 'solarized-light t))))
  310. ;; Load for Term
  311. (unless (display-graphic-p)
  312. (progn
  313. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  314. (xterm-mouse-mode t)
  315. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  316. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))))