.emacs-all 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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. (beacon-mode)
  85. (global-set-key (kbd "C-c B") 'beacon-mode)
  86. ;; Vimperator like hints for
  87. ;; file navigationaki2o/emacs-pophint
  88. (straight-use-package
  89. '(pophint :type git :host github
  90. :repo "aki2o/emacs-pophint"))
  91. (global-set-key (kbd "C-c f") 'pophint:do-flexibly)
  92. ;;; Code folding
  93. (add-hook 'prog-mode-hook 'hs-minor-mode)
  94. (global-set-key (kbd "C-c a") 'hs-toggle-hiding)
  95. ;;; Error checking
  96. (global-set-key (kbd "C-c 2 e") 'flymake-mode)
  97. ;; System monitor
  98. ;; (straight-use-package
  99. ;; '(symon :type git :host github
  100. ;; :repo "zk-phi/symon"))
  101. ;; For whatever reason, using straight to build this
  102. ;; package results in bugs on Linux (not OSX). I'm assuming
  103. ;; because straight is building from git and there is a regression.
  104. ;; As such -- MELPA config
  105. ;; This config is likely redudant and I can use the straight
  106. ;; MELPA interface, but it's working and I'm too lazy to change it
  107. (require 'package)
  108. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  109. (package-install 'symon)
  110. (symon-mode 1)
  111. (straight-use-package
  112. '(telephone-line :type git :host github
  113. :repo "dbordak/telephone-line"))
  114. (telephone-line-mode 1)
  115. ;;; Indent highlighting
  116. (straight-use-package
  117. '(highlight-indent-guides
  118. :type git :host github
  119. :repo "DarthFennec/highlight-indent-guides"))
  120. (setq highlight-indent-guides-method 'character)
  121. (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
  122. ;; Org mode
  123. ;; Get src block tabs to work how I expect
  124. (setq org-src-tab-acts-natively t)
  125. (setq org-src-preserve-indentation nil
  126. org-edit-src-content-indentation 0)
  127. ;; tramp
  128. (setq tramp-default-method "ssh")
  129. ;; Ivy
  130. ;; (straight-use-package 'ivy)
  131. ;; (ivy-mode)
  132. ;; (setq ivy-use-virtual-buffers t)
  133. ;; (setq enable-recursive-minibuffers t)
  134. ;; (require 'ido)
  135. (ido-mode t)
  136. (require 'yasnippet)
  137. ;; Configure focus
  138. (require 'focus)
  139. (add-to-list 'focus-mode-to-thing '(lisp-mode . paragraph))
  140. ;; rainbow delims
  141. (require 'rainbow-delimiters)
  142. (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
  143. ;; Git stuff
  144. (require 'magit)
  145. (require 'diff-hl)
  146. ;; Just enable diff-hl per buffer,
  147. ;; it seems expensive
  148. ;; (global-diff-hl-mode)
  149. (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
  150. (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
  151. (diff-hl-margin-mode t)
  152. (require 'dimmer)
  153. (setq dimmer-fraction 0.4)
  154. (require 'evil)
  155. (evil-mode 1)
  156. ;; Enable tab behavior like vi
  157. (straight-use-package '(evil-tabs :type git :host github
  158. :repo "krisajenkins/evil-tabs"))
  159. (require 'evil-tabs)
  160. (global-evil-tabs-mode t)
  161. (require 'auto-complete)
  162. (global-auto-complete-mode t)
  163. (require 'slime)
  164. (require 'ac-slime)
  165. (slime-setup '(slime-fancy ac-slime))
  166. (add-hook 'slime-mode-hook 'set-up-slime-ac)
  167. (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
  168. (eval-after-load "auto-complete"
  169. '(add-to-list 'ac-modes 'slime-repl-mode))
  170. (require 'markdown-mode)
  171. (require 'neotree)
  172. (global-set-key [f8] 'neotree-toggle)
  173. (require 'all-the-icons)
  174. (require 'sublimity)
  175. (require 'sublimity-scroll)
  176. (require 'sublimity-map) ;; experimental
  177. (require 'sublimity-attractive)
  178. (setq sublimity-scroll-weight 10
  179. sublimity-scroll-drift-length 5)
  180. (setq sublimity-map-size 40)
  181. (setq sublimity-map-fraction 0.3)
  182. (setq sublimity-map-text-scale -5)
  183. (sublimity-map-set-delay 0.1)
  184. (setq sublimity-attractive-centering-width nil)
  185. (setq backup-directory-alist
  186. `((".*" . ,temporary-file-directory)))
  187. (setq auto-save-file-name-transforms
  188. `((".*" ,temporary-file-directory t)))
  189. ;;; Generic options for all OSs
  190. ; Smooth mouse scroll a bit
  191. (setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
  192. (setq mouse-wheel-progressive-speed nil)
  193. ;; normal home/end behavior
  194. (global-set-key (kbd "<home>") 'beginning-of-line)
  195. (global-set-key (kbd "<end>") 'end-of-line)
  196. (defun sol-dk ()
  197. (interactive)
  198. (load-theme 'solarized-dark))
  199. (defun sol-l ()
  200. (interactive)
  201. (load-theme 'solarized-light))
  202. ;; Keybinds/macros
  203. ;;(global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers magit-status-mode-map)
  204. (global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers)
  205. (global-set-key (kbd "C-c ;") 'comment-line)
  206. (global-set-key (kbd "C-c b") 'fzf-switch-buffer)
  207. (global-set-key (kbd "C-c z") '(lambda ()
  208. (interactive)
  209. (switch-to-buffer "*scratch*")
  210. (fzf-find-file)))
  211. (global-set-key (kbd "C-c e") '(lambda ()
  212. (interactive)
  213. (diff-hl-mode)
  214. (diff-hl-flydiff-mode)))
  215. (global-set-key (kbd "C-c d") 'slime-describe-symbol)
  216. (global-set-key (kbd "C-c M-r") 'slime-restart-inferior-lisp)
  217. (global-set-key (kbd "C-c D") 'dimmer-mode)
  218. (global-set-key (kbd "C-c S") 'sublimity-mode)
  219. (global-set-key (kbd "C-c s") 'flyspell-correct-word-before-point)
  220. (global-set-key (kbd "C-c F") 'focus-mode)
  221. (global-set-key (kbd "C-c r") '(lambda ()
  222. (interactive)
  223. (load-file (file-truename "~/.emacs"))))
  224. (global-set-key (kbd "C-c C-e") '(lambda ()
  225. (interactive)
  226. (find-file (file-truename "~/.emacs"))
  227. (with-current-buffer (buffer-name)
  228. (emacs-lisp-mode))))
  229. (global-set-key (kbd "C-c l") 'display-line-numbers-mode)
  230. (global-set-key (kbd "C-c w") 'window-swap-states)
  231. (global-set-key (kbd "C-c C-w") 'windresize)
  232. (global-set-key (kbd "C-c W") 'whitespace-mode)
  233. (global-set-key (kbd "C-c t") 'sol-dk)
  234. (global-set-key (kbd "C-c y") 'sol-l)
  235. (global-set-key (kbd "C-c g") 'magit)
  236. (global-set-key (kbd "C-c C-.") '(lambda ()
  237. (interactive)
  238. (switch-to-buffer "*Messages*")))
  239. (global-set-key (kbd "C-c C-f") 'find-file-at-point)
  240. ;;; Erc config
  241. (setq erc-nick "speskk")
  242. (setq erc-hide-list '("JOIN" "PART" "QUIT"))
  243. (if (file-exists-p "~/.emacs.d/.erc-auth.el")
  244. (progn
  245. (load "~/.emacs.d/.erc-auth.el")
  246. (defun connect-to-libera-erc () (interactive)
  247. (erc :server "irc.libera.chat" :port "6667"
  248. :nick "speskk" :password *libera-chat*))))
  249. ;; Allow M-up / M-down behavior to switch windows
  250. (windmove-default-keybindings 'meta)
  251. (display-time-mode t)
  252. ;; Perl Config
  253. (setq
  254. perl-indent-parens-as-block 0
  255. perl-indent-level 8)
  256. ;; Set to make mouse focus window
  257. (setq mouse-autoselect-window t
  258. focus-follows-mouse t)
  259. ;; Custom eshell prompt
  260. (setq eshell-prompt-function
  261. (lambda nil
  262. " λ > "))
  263. (setq eshell-prompt-regexp "^ λ > ")
  264. (set-language-environment "UTF-8")
  265. ;; Simple rclone cli wrapper
  266. (load "~/Repos/dotfiles/emacs/elisp/rclone.el")
  267. (global-set-key (kbd "C-c o") 'rclone-post-buffer)
  268. (global-set-key (kbd "C-c C-o") 'rclone-get-org)
  269. (global-set-key (kbd "C-c C-P") 'post-region-to-pb)
  270. (global-set-key (kbd "C-c 2 p") 'display-pb)
  271. ;; Small helper functions
  272. (load "~/Repos/dotfiles/emacs/elisp/helpers.el")
  273. (global-set-key (kbd "C-c p") 'display-full-buffer-path)
  274. ;; Disable bars
  275. (menu-bar-mode -1)
  276. (tool-bar-mode -1)
  277. (scroll-bar-mode -1)
  278. ;; Load for macOS
  279. ;;; Slime/etc
  280. (if (eq system-type 'darwin)
  281. (progn
  282. ;; Configure yasnippet
  283. (setq yas-snippet-dirs
  284. '("~/Repos/dotfiles/emacs/yasnippets/"))
  285. (yas-global-mode 1)
  286. (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
  287. (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
  288. ;; Font/themes/etc
  289. (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
  290. ;; Easily set cua mode on/off so that I don't have to
  291. ;; use shift+insert for paste on mac
  292. (global-set-key (kbd "C-c c") 'cua-mode)
  293. (global-set-key (kbd "C-c n") 'toggle-frame-fullscreen)
  294. ;; Graphic Display
  295. (if (display-graphic-p)
  296. (progn
  297. (load-theme 'solarized-dark t)))))
  298. ;; Load for GUI Linux
  299. (if (eq system-type 'gnu/linux)
  300. (if (display-graphic-p)
  301. (progn
  302. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  303. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))
  304. ;; https://emacs.stackexchange.com/questions/332/how-can-i-find-the-path-to-an-executable-with-emacs-lisp
  305. (setq yas-snippet-dirs
  306. '("~/Repos/dotfiles/emacs/yasnippets/"))
  307. (yas-global-mode 1)
  308. (if (file-exists-p "~/.enable_exwm")
  309. (progn
  310. (straight-use-package 'exwm)
  311. (require 'exwm)
  312. (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
  313. (require 'exwm-config-spw)
  314. (exwm-config-spw)))
  315. (setq visible-bell 1)
  316. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  317. (load-theme 'solarized-light t))))
  318. ;; Load for Term
  319. (unless (display-graphic-p)
  320. (progn
  321. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  322. (xterm-mouse-mode t)
  323. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  324. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))))