.emacs-all 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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 C-q") #'mu-magit-kill-buffers magit-status-mode-map)
  160. (global-set-key (kbd "C-c C-q") #'mu-magit-kill-buffers)
  161. (global-set-key (kbd "C-c ;") 'comment-line)
  162. (global-set-key (kbd "C-c b") 'fzf-switch-buffer)
  163. (global-set-key (kbd "C-c z") 'fzf-find-file)
  164. (global-set-key (kbd "C-c e") 'diff-hl-mode)
  165. (global-set-key (kbd "C-c d") 'slime-describe-symbol)
  166. (global-set-key (kbd "C-c M-r") 'slime-restart-inferior-lisp)
  167. (global-set-key (kbd "C-c D") 'dimmer-mode)
  168. (global-set-key (kbd "C-c s") 'sublimity-mode)
  169. (global-set-key (kbd "C-c f") 'focus-mode)
  170. (global-set-key (kbd "C-c r") 'reload-dot-emacs)
  171. (global-set-key (kbd "C-c l") 'display-line-numbers-mode)
  172. (global-set-key (kbd "C-c w") 'windresize)
  173. (global-set-key (kbd "C-c t") 'sol-dk)
  174. (global-set-key (kbd "C-c y") 'sol-l) ; Quick toggle evil-mode for slime err
  175. (global-set-key (kbd "C-c g") 'magit)
  176. (global-set-key (kbd "C-c h") 'tramp-cleanup-connection)
  177. (global-set-key (kbd "C-c C-.") '(lambda ()
  178. (interactive)
  179. (switch-to-buffer "*Messages*")))
  180. (global-set-key (kbd "C-c C-f") 'find-file-at-point)
  181. ;;; Can probably be replaced with
  182. ;;; a yasnippet
  183. (fset 'date-to-point
  184. (kmacro-lambda-form [?\C-u ?\M-! ?d ?a ?t ?e return] 0 "%d"))
  185. ;;; Erc config
  186. (setq erc-nick "speskk")
  187. (setq erc-hide-list '("JOIN" "PART" "QUIT"))
  188. (if (file-exists-p "~/.emacs.d/.erc-auth.el")
  189. (progn
  190. (load "~/.emacs.d/.erc-auth.el")
  191. (defun connect-to-libera-erc () (interactive)
  192. (erc :server "irc.libera.chat" :port "6667"
  193. :nick "speskk" :password *libera-chat*))))
  194. ;; Allow M-up / M-down behavior to switch windows
  195. (windmove-default-keybindings 'meta)
  196. (display-time-mode t)
  197. ;; Perl Config
  198. (setq
  199. perl-indent-parens-as-block 0
  200. perl-indent-level 8)
  201. ;; Set to make mouse focus window
  202. (setq mouse-autoselect-window t
  203. focus-follows-mouse t)
  204. ;; Custom eshell prompt
  205. (setq eshell-prompt-function
  206. (lambda nil
  207. " λ > "))
  208. (setq eshell-prompt-regexp "^ λ > ")
  209. (set-language-environment "UTF-8")
  210. ;; Simple rclone cli wrapper
  211. (load "~/Repos/dotfiles/emacs/elisp/rclone.el")
  212. (global-set-key (kbd "C-c o") 'rclone-post-buffer)
  213. (global-set-key (kbd "C-c C-o") 'rclone-get-org)
  214. ;; Small helper functions
  215. (load "~/Repos/dotfiles/emacs/elisp/helpers.el")
  216. (global-set-key (kbd "C-c p") 'display-full-buffer-path)
  217. ;; Disable bars
  218. (menu-bar-mode -1)
  219. (tool-bar-mode -1)
  220. (scroll-bar-mode -1)
  221. ;; Load for macOS
  222. ;;; Slime/etc
  223. (if (eq system-type 'darwin)
  224. (progn
  225. ;; Configure yasnippet
  226. (setq yas-snippet-dirs
  227. '("~/Repos/dotfiles/emacs/yasnippets/"))
  228. (yas-global-mode 1)
  229. (setq inferior-lisp-program "/opt/homebrew/bin/sbcl")
  230. (load (expand-file-name "~/.local/opt/quicklisp/slime-helper.el"))
  231. ;; Font/themes/etc
  232. (load "/Users/swatson/Repos/dotfiles/emacs/mac-load/customs.el")
  233. ;; Easily set cua mode on/off so that I don't have to
  234. ;; use shift+insert for paste on mac
  235. (global-set-key (kbd "C-c c") 'cua-mode)
  236. (global-set-key (kbd "C-c n") 'toggle-frame-fullscreen)
  237. ;; Graphic Display
  238. (if (display-graphic-p)
  239. (progn
  240. (load-theme 'solarized-dark t)))))
  241. ;; Load for Windows10
  242. (if (eq system-type 'windows-nt)
  243. (progn
  244. ;; Configure yasnippet
  245. (setq yas-snippet-dirs
  246. '("C:/Users/watsonsi/Documents/Github/dotfiles/emacs/yasnippets/"))
  247. (yas-global-mode 1)
  248. (load "C:/Users/watsonsi/Documents/GitHub/dotfiles/emacs/windows-load/customs.el")
  249. (setq visible-bell 1)
  250. (load-theme 'solarized-light t)))
  251. ;; Load for GUI Linux
  252. (if (eq system-type 'gnu/linux)
  253. (if (display-graphic-p)
  254. (progn
  255. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  256. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))
  257. ;; https://emacs.stackexchange.com/questions/332/how-can-i-find-the-path-to-an-executable-with-emacs-lisp
  258. (setq yas-snippet-dirs
  259. '("~/Repos/dotfiles/emacs/yasnippets/"))
  260. (yas-global-mode 1)
  261. (if (file-exists-p "~/.enable_exwm")
  262. (progn
  263. (straight-use-package 'exwm)
  264. (require 'exwm)
  265. (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
  266. (require 'exwm-config-spw)
  267. (exwm-config-spw)))
  268. (setq visible-bell 1)
  269. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  270. (load-theme 'solarized-light t))))
  271. ;; Load for Term
  272. (unless (display-graphic-p)
  273. (progn
  274. (load "~/Repos/dotfiles/emacs/linux-load/customs.el")
  275. (xterm-mouse-mode t)
  276. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  277. (setq inferior-lisp-program (locate-file "sbcl" exec-path exec-suffixes 1))))