My emacs configuration.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.org 38KB

5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. * General Emacs Configuration
  2. ** Load some libraries
  3. Like notifications
  4. #+BEGIN_SRC emacs-lisp
  5. (load-library "notifications")
  6. (notifications-notify :title "Emacs"
  7. :body "Electronic Macros loading...")
  8. (message "Emacs initializing...")
  9. #+END_SRC
  10. and sclang, if avaliable
  11. #+BEGIN_SRC emacs-lisp
  12. (add-to-list 'load-path "/usr/local/bin/sclang")
  13. (require 'sclang)
  14. #+END_SRC
  15. ** Helper Functions
  16. #+BEGIN_SRC emacs-lisp
  17. (defun wiz-kill-all-buffers ()
  18. (interactive)
  19. (mapc 'kill-buffer (buffer-list)))
  20. (defun wiz-kill-curr-buffer ()
  21. (interactive)
  22. (kill-buffer (current-buffer)))
  23. #+END_SRC
  24. ** Customize file
  25. Makes it so the customize data isn't schlunked in my init.el
  26. #+BEGIN_SRC emacs-lisp
  27. (setq custom-file (concat user-emacs-directory "_customize.el"))
  28. (load custom-file t)
  29. #+END_SRC
  30. ** Startup image
  31. Add a fun image to the emacs startup screen
  32. The variable is used below in Dashboard
  33. #+BEGIN_SRC emacs-lisp
  34. (defvar wiz-startpic (concat user-emacs-directory "pictures/startpic.png"))
  35. (if (file-readable-p wiz-startpic)
  36. (lambda ()
  37. (setq fancy-splash-image wiz-startpic)
  38. (message "Splash image loaded."))
  39. (message "The splash image is unreadable."))
  40. #+END_SRC
  41. ** Notifications
  42. Enable make some tweaks
  43. #+BEGIN_SRC emacs-lisp
  44. (defvar wiz-notifypic (concat user-emacs-directory "pictures/notifypic.png"))
  45. (if (file-readable-p wiz-notifypic)
  46. (setq notifications-application-icon
  47. (concat user-emacs-directory "pictures/notifypic.png")))
  48. #+END_SRC
  49. ** De-clutter
  50. Disable the useless cruft at the top of the screen
  51. #+BEGIN_SRC emacs-lisp
  52. (menu-bar-mode 0)
  53. (tool-bar-mode 0)
  54. (scroll-bar-mode -1)
  55. #+END_SRC
  56. ** Show parenthesis
  57. Shows matching parenthesis
  58. #+BEGIN_SRC emacs-lisp
  59. (require 'paren)
  60. ;; (set-face-background 'show-paren-match "#000")
  61. ;; (set-face-foreground 'show-paren-match "#d9f")
  62. ;; (set-face-attribute 'show-paren-match nil :weight 'extra-bold)
  63. (setq show-paren-delay 0)
  64. (show-paren-mode)
  65. #+END_SRC
  66. ** electric pairs (DISABLED in favor of smartparens)
  67. When you open a code block, close that block.
  68. # #+BEGIN_SRC emacs-lisp
  69. # (setq electric-pair-pairs '(
  70. # (?\( . ?\))
  71. # (?\[ . ?\])
  72. # (?\{ . ?\})
  73. # (?\" . ?\")
  74. # ;; (?\' . ?\')
  75. # ))
  76. # (setq electric-pair-preserve-balance t)
  77. # (electric-pair-mode t)
  78. # #+END_SRC
  79. ** Show columns
  80. #+BEGIN_SRC emacs-lisp
  81. (column-number-mode t)
  82. #+END_SRC
  83. ** Fonts
  84. Set the font to something cool
  85. #+BEGIN_SRC emacs-lisp
  86. ;; (set-default-font "Go Mono-11")
  87. (add-to-list 'default-frame-alist
  88. '(font . "Go Mono-11")
  89. '(font . "Noto Sans Mono CJK JP-11"))
  90. #+END_SRC
  91. ** Transparency
  92. Sets the window's transparency.
  93. The first number in the alpha section applies when the window is
  94. active, the second when it's inactive.
  95. #+BEGIN_SRC emacs-lisp
  96. (defvar wiz-default-transparency 95)
  97. (add-to-list 'default-frame-alist `(alpha . (,wiz-default-transparency . ,wiz-default-transparency)))
  98. ;; Set transparency of emacs
  99. (defun wiz-transparency (value)
  100. "Sets the transparency of the frame window. 0=transparent/100=opaque"
  101. (interactive "nTransparency Value 0 - 100 opaque:")
  102. (set-frame-parameter (selected-frame) 'alpha value))
  103. ;; (set-frame-parameter (selected-frame) 'alpha '(100 . 100))
  104. #+END_SRC
  105. ** Backup files
  106. Edit backup files properties
  107. https://www.emacswiki.org/emacs/BackupDirectory
  108. #+BEGIN_SRC emacs-lisp
  109. (setq
  110. backup-by-copying t ; don't clobber symlinks
  111. backup-directory-alist
  112. `(("." . ,(concat user-emacs-directory "backups"))) ; don't litter my fs tree
  113. delete-old-versions t
  114. kept-new-versions 6
  115. kept-old-versions 2
  116. version-control t) ; use versioned backups
  117. ;; Actually a lot of this doesn't work
  118. (setq
  119. make-backup-files nil
  120. auto-save-default nil)
  121. #+END_SRC
  122. ** Scrolling
  123. #+BEGIN_SRC emacs-lisp
  124. (setq scroll-conservatively 100) ;; don't scroll a metric boatload when bottom is hit
  125. #+END_SRC
  126. ** Shut up Emacs
  127. #+BEGIN_SRC emacs-lisp
  128. (setq ring-bell-function 'ignore) ;;emacs stfu
  129. #+END_SRC
  130. ** Show line numbers
  131. Enable lines when editing files
  132. #+BEGIN_SRC emacs-lisp
  133. (unless (version< emacs-version "26.1")
  134. (setq display-line-numbers-type 'relative)
  135. (add-hook 'text-mode-hook 'display-line-numbers-mode)
  136. (add-hook 'prog-mode-hook 'display-line-numbers-mode)
  137. (add-hook 'sclang-mode-hook 'display-line-numbers-mode)
  138. (add-hook 'conf-mode-hook 'display-line-numbers-mode)
  139. (setq display-line-numbers-grow-only t)
  140. (setq display-line-numbers-width-start 4)
  141. (defun wiz-disable-line-numbers ()
  142. (interactive)
  143. (setq display-line-numbers nil)))
  144. #+END_SRC
  145. ** y or n prompts
  146. #+BEGIN_SRC emacs-lisp
  147. (defalias 'yes-or-no-p 'y-or-n-p) ;; make yes or no prompts ask for y or n
  148. #+END_SRC
  149. ** Customize the terminal
  150. #+BEGIN_SRC emacs-lisp
  151. (defvar wiz-term-shell "/bin/zsh") ;; I like to utilize zsh
  152. (defadvice ansi-term (before force-bash)
  153. (interactive (list wiz-term-shell)))
  154. (ad-activate 'ansi-term)
  155. #+END_SRC
  156. ** Prettify symbols
  157. +=|====> = CoolSword
  158. #+BEGIN_SRC emacs-lisp
  159. (add-to-list 'prettify-symbols-alist '("+=|====>" 🗡️))
  160. (global-prettify-symbols-mode 1)
  161. #+END_SRC
  162. ** Tabs are spaces?!
  163. #+BEGIN_SRC emacs-lisp
  164. (setq-default indent-tabs-mode nil)
  165. (setq-default tab-width 4)
  166. (setq indent-line-function 'insert-tab)
  167. #+END_SRC
  168. ** org-mode
  169. *** General org settings
  170. Auto-indent org files nicely
  171. #+BEGIN_SRC emacs-lisp
  172. (add-hook 'org-mode-hook 'org-indent-mode)
  173. #+END_SRC
  174. Highlight syntax in source blocks
  175. #+BEGIN_SRC emacs-lisp
  176. (setq org-src-fontify-natively t)
  177. #+END_SRC
  178. *** Capture Templates
  179. Set the org mode directory and define some capture templates
  180. #+BEGIN_SRC emacs-lisp
  181. (setq org-directory "~/Documents/org/")
  182. (setq org-agenda-files '("~/Documents/org/"))
  183. (setq org-capture-templates
  184. (quote
  185. (("t" "Todo" entry
  186. (file+olp "todo.org" "Tasks" "Misc")
  187. "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
  188. ("tm" "Music Todo" entry
  189. (file+olp "todo.org" "Tasks" "Music")
  190. "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
  191. ("ts" "Server Todo" entry
  192. (file+olp "todo.org" "Tasks" "Server")
  193. "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
  194. ("tp" "Program Todo" entry
  195. (file+olp "todo.org" "Tasks" "Programming")
  196. "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
  197. ("tb" "Blog Todo" entry
  198. (file+olp "todo.org" "Tasks" "Blog")
  199. "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
  200. ("T" "Thoughts" entry
  201. (file+headline "thoughts.org" "Thoughts")
  202. "** %^{Summary} %t :thoughts:\n")
  203. ("s" "School-related task" entry
  204. (file+olp+prompt "school.org" "Todo")
  205. "** TODO %^{What needs be done}\n DEADLINE: %t\n")
  206. ("d" "Dream Journal" entry
  207. (file+olp+datetree "dreams.org")
  208. "**** Dream\n")
  209. ("m" "Bookmark" entry
  210. (file+olp "links.org" "Refile")
  211. "** [[%^{link}][%^{description}]]\n"))))
  212. #+END_SRC
  213. *** Org templates
  214. <el expands to emacs lisp code block
  215. #+BEGIN_SRC emacs-lisp
  216. (setq org-src-window-setup 'current-window)
  217. (add-to-list 'org-structure-template-alist
  218. '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
  219. #+END_SRC
  220. *** Autocomplete todo entries
  221. #+BEGIN_SRC emacs-lisp
  222. (defun org-summary-todo (n-done n-not-done)
  223. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  224. (let (org-log-done org-log-states)
  225. ; turn off logging
  226. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  227. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  228. #+END_SRC
  229. *** export settings
  230. **** use latexmk
  231. #+BEGIN_SRC emacs-lisp
  232. (setq org-latex-to-pdf-process (list "latexmk -f -pdf %f"))
  233. #+END_SRC
  234. *** Keep diary
  235. #+BEGIN_SRC emacs-lisp
  236. (setq org-agenda-include-diary nil)
  237. (setq org-default-notes-file "notes.org")
  238. #+END_SRC
  239. ** set browser
  240. Default browser should be firefox
  241. #+BEGIN_SRC emacs-lisp
  242. (setq browse-url-generic-program "firefox"
  243. browse-url-browser-program 'browse-url-generic
  244. browse-url-default-browser 'browse-url-generic
  245. browse-url-browser-function 'browse-url-generic
  246. ;; And if I'm stuck like a rock in a hard place...
  247. browse-url-default-windows-browser 'browse-url-firefox)
  248. #+END_SRC
  249. ** Buffers
  250. *** ibuffer
  251. Expert mode to streamline stuff. Don't ask for confirmation of
  252. "dangerous" operations.
  253. The long variable settage is to group different types of buffers
  254. to make it easier to navigate.
  255. #+BEGIN_SRC emacs-lisp
  256. (setq ibuffer-expert 1)
  257. ;; see: ibuffer-filtering-alist
  258. (setq ibuffer-saved-filter-groups
  259. (quote (("default"
  260. ("dired" (mode . dired-mode))
  261. ("erc" (mode . erc-mode))
  262. ;; ("org" (directory . "^~\\/Documents\\/org\\/"))
  263. ("emacs" (or
  264. ;; (directory . "^~\\/\\.emacs\\.d\\/")
  265. (name . "^\\*scratch\\*$")
  266. (name . "^\\*dashboard\\*$")
  267. (mode . customize-mode)
  268. (name . "^\\*Messages\\*$")))))))
  269. (add-hook 'ibuffer-mode-hook
  270. (lambda ()
  271. (ibuffer-switch-to-saved-filter-groups "default")))
  272. ;; Use human readable Size column instead of original one
  273. (define-ibuffer-column size-h
  274. (:name "Size")
  275. (cond
  276. ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
  277. ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
  278. ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
  279. (t (format "%8d" (buffer-size)))))
  280. ;; Modify the default ibuffer-formats
  281. (setq ibuffer-formats
  282. '((mark modified read-only " "
  283. (name 18 18 :left :elide)
  284. " "
  285. (size-h 9 -1 :right)
  286. " "
  287. (mode 16 16 :left :elide)
  288. " "
  289. filename-and-process)))
  290. #+END_SRC
  291. *** scratch buffer
  292. #+BEGIN_SRC emacs-lisp
  293. (defun wiz-scratch-buffer nil
  294. "create a scratch buffer"
  295. (interactive)
  296. (switch-to-buffer (get-buffer-create "*scratch*"))
  297. (lisp-interaction-mode))
  298. #+END_SRC
  299. ** TODO Refresh theme on the fly
  300. Use [[https://github.com/dylanaraps/pywal][wal]] and [[https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Notifications.html][file notifications]] to load a theme on the fly, courtesy of [[https://github.com/dylanaraps/pywal/pull/43][this pull request]].
  301. Note: this requires base16-themes
  302. #+BEGIN_SRC emacs-lisp
  303. (add-to-list 'custom-theme-load-path (concat user-emacs-directory "themes/"))
  304. (defvar wiz-theme-file (concat user-emacs-directory "themes/base16-wal-theme.el"))
  305. (defun wiz-apply-theme ()
  306. (interactive)
  307. (progn
  308. (when (file-exists-p wiz-theme-file)
  309. (load-theme 'base16-wal t))))
  310. (defun theme-callback (event)
  311. (wiz-apply-theme))
  312. ;; (require 'filenotify)
  313. ;; (file-notify-add-watch
  314. ;; wiz-theme-file '(change) 'theme-callback)
  315. ;; Set the theme on startup
  316. ;; (wiz-apply-theme)
  317. #+END_SRC
  318. *** TODO Move this to the base16 config
  319. ** tramp
  320. #+BEGIN_SRC emacs-lisp
  321. (setq tramp-default-method "ssh")
  322. #+END_SRC
  323. ** Flyspell
  324. Enable a spellchecker
  325. #+BEGIN_SRC emacs-lisp
  326. (add-hook 'org-mode-hook 'flyspell-mode)
  327. #+END_SRC
  328. ** calc
  329. #+BEGIN_SRC emacs-lisp
  330. ;; (add-to-list 'evil-emacs-state-modes 'calc-mode)
  331. #+END_SRC
  332. * Package Repo Config
  333. ** Repo Location
  334. Let's start by configuring the repositories
  335. #+BEGIN_SRC emacs-lisp
  336. (require 'package)
  337. (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
  338. ("marmalade" . "https://marmalade-repo.org/packages/")
  339. ;; ("melpa-stable" . "https://stable.melpa.org/packages/")
  340. ("melpa" . "https://melpa.org/packages/")
  341. ("org" . "https://orgmode.org/elpa/")))
  342. (setq package-enable-at-startup nil)
  343. #+END_SRC
  344. ** use-package
  345. use-package for installing packages
  346. https://github.com/jwiegley/use-package
  347. #+BEGIN_SRC emacs-lisp
  348. (unless (package-installed-p 'use-package)
  349. (package-refresh-contents)
  350. (package-install 'use-package))
  351. (eval-when-compile
  352. (require 'use-package))
  353. #+END_SRC
  354. * Package Configuration
  355. ** Keybind-related packages
  356. *** Show key binds
  357. Pops up a screen that helps you navigate and complete commands
  358. #+BEGIN_SRC emacs-lisp
  359. (use-package which-key
  360. :ensure t
  361. :diminish
  362. :init
  363. (which-key-mode))
  364. #+END_SRC
  365. *** General
  366. General binds keys in a more sane way, and it integrates with
  367. =use-package=
  368. #+BEGIN_SRC emacs-lisp
  369. (use-package general
  370. :ensure t
  371. :config
  372. (general-create-definer wiz-leader-def
  373. :keymaps 'override
  374. :states '(normal insert emacs)
  375. :prefix "SPC"
  376. :non-normal-prefix "M-SPC")
  377. ;; Thanks to Jack for the below, smart man
  378. (defun wiz-create-wk-prefix (desc)
  379. "Helper for creating which-key prefix descriptions.
  380. Bind to a key with general to make which-key show DESC
  381. as the prefix's description"
  382. `(:ignore t :wk ,desc))
  383. (defmacro wiz-create-definers (definitions)
  384. "A wrapper for general-create-definer.
  385. For every pair in DEFINITIONS, creates a leader
  386. with name wiz-NAME-def and keybind SPC KEY or M-SPC KEY in normal mode."
  387. `(progn
  388. ,@(mapcan
  389. (lambda (def)
  390. (let ((key (car def))
  391. (name (cdr def)))
  392. `((general-create-definer ,(intern (concat "wiz-" name "-def"))
  393. :keymaps 'override
  394. :states '(normal insert emacs)
  395. :prefix ,(concat "SPC " key)
  396. :non-normal-prefix ,(concat "M-SPC " key))
  397. (wiz-leader-def ,key ',(wiz-create-wk-prefix name)))))
  398. definitions)))
  399. (wiz-create-definers
  400. (("b" . "buffer")
  401. ("f" . "file")
  402. ("h" . "help")
  403. ("l" . "misc")
  404. ("SPC" . "major")
  405. ("o" . "org")
  406. ("p" . "project")
  407. ("P" . "password")
  408. ("w" . "window"))))
  409. #+END_SRC
  410. **** A few binds
  411. ***** h - help
  412. #+BEGIN_SRC emacs-lisp
  413. (wiz-help-def
  414. "?" 'help-for-help
  415. "k" 'counsel-descbinds
  416. "f" 'counsel-describe-function
  417. "v" 'counsel-describe-variable
  418. "a" 'counsel-apropos
  419. "h" 'help-for-help)
  420. #+END_SRC
  421. ***** b - buffer
  422. #+BEGIN_SRC emacs-lisp
  423. (wiz-buffer-def
  424. "b" 'ibuffer
  425. "S" 'wiz-scratch-buffer
  426. "c" 'wiz-kill-curr-buffer
  427. "C" 'wiz-kill-all-buffers)
  428. #+END_SRC
  429. ***** f - file
  430. #+BEGIN_SRC emacs-lisp
  431. (wiz-file-def
  432. "w" 'save-buffer)
  433. #+END_SRC
  434. ****** Emacs-related
  435. ******* config edit / reload
  436. hit =e= to do that.
  437. #+BEGIN_SRC emacs-lisp
  438. (defun wiz-config-visit ()
  439. (interactive)
  440. (find-file (concat user-emacs-directory "config.org")))
  441. (defun wiz-config-reload ()
  442. (interactive)
  443. (org-babel-load-file
  444. (expand-file-name "config.org" user-emacs-directory)))
  445. (wiz-file-def
  446. "e" '(:ignore t :which-key "emacs files")
  447. "e e" 'wiz-config-visit
  448. "e r" 'wiz-config-reload)
  449. #+END_SRC
  450. ***** l - misc
  451. #+BEGIN_SRC emacs-lisp
  452. (wiz-misc-def
  453. :keymaps 'override
  454. :states 'normal
  455. :prefix "SPC l")
  456. #+END_SRC
  457. ***** w - window
  458. #+BEGIN_SRC emacs-lisp
  459. ;; (wiz-window-def
  460. ;; :keymaps 'override
  461. ;; :states 'normal
  462. ;; :prefix "SPC w")
  463. (wiz-window-def
  464. "o" 'delete-other-windows)
  465. #+END_SRC
  466. ***** ibuffer
  467. #+BEGIN_SRC emacs-lisp
  468. (general-define-key
  469. :keymaps 'override
  470. "C-x b" 'ibuffer)
  471. #+END_SRC
  472. ***** Terminal
  473. #+BEGIN_SRC emacs-lisp
  474. (wiz-leader-def
  475. "RET" 'eshell)
  476. #+END_SRC
  477. ***** Dired
  478. #+BEGIN_SRC emacs-lisp
  479. (wiz-file-def
  480. "d" 'dired)
  481. #+END_SRC
  482. ***** sclang-mode
  483. #+BEGIN_SRC emacs-lisp
  484. ;; (defun wiz-sclang-eval-region () "do nothing for now")
  485. (general-define-key
  486. :keymaps 'sclang-mode-map
  487. "C-c C-d" 'sclang-eval-defun
  488. "C-c C-c" 'sclang-eval-region-or-line)
  489. (wiz-major-def
  490. :keymaps 'sclang-mode-map
  491. "SPC" 'sclang-eval-region-or-line)
  492. #+END_SRC
  493. *** Vim bindings
  494. Let's get some vim up in here.
  495. **** evil
  496. Evil is pretty much the entirety of Vim in Emacs.
  497. [[evil-collection]] provides evil in many different modes.
  498. [[evil-org]] adds nice bindings to org-mode.
  499. #+BEGIN_SRC emacs-lisp
  500. (use-package evil
  501. :ensure t
  502. :after general
  503. :init
  504. (setq evil-want-integration t
  505. evil-want-C-u-scroll t
  506. evil-want-keybinding nil)
  507. (defun wiz-window-split ()
  508. (interactive)
  509. (evil-window-split)
  510. (evil-window-down 1))
  511. (defun wiz-window-vsplit ()
  512. (interactive)
  513. (evil-window-vsplit)
  514. (evil-window-right 1))
  515. :general
  516. (:keymaps 'override
  517. :states 'normal
  518. "U" 'undo-tree-visualize)
  519. (wiz-window-def
  520. "s" 'wiz-window-split
  521. "S" 'wiz-window-vsplit
  522. "v" 'wiz-window-vsplit
  523. "h" 'evil-window-left
  524. "j" 'evil-window-down
  525. "k" 'evil-window-up
  526. "l" 'evil-window-right
  527. "H" 'evil-window-far-left
  528. "J" 'evil-window-move-very-bottom
  529. "K" 'evil-window-move-very-top
  530. "L" 'evil-window-far-right
  531. "<" 'evil-window-decrease-width
  532. ">" 'evil-window-increase-width
  533. "^" 'evil-window-decrease-height
  534. "%" 'evil-window-increase-height
  535. "n" 'evil-window-new
  536. "c" 'evil-window-delete
  537. "w" 'evil-window-next
  538. "W" 'evil-window-prev
  539. "r" 'evil-window-rotate-downwards
  540. "|" 'evil-window-set-width
  541. "_" 'evil-window-set-height)
  542. :config
  543. (evil-mode t))
  544. (use-package evil-collection
  545. :after evil
  546. :ensure t
  547. :config
  548. (evil-collection-init)
  549. (setq evil-shift-width 4))
  550. (use-package evil-org
  551. :ensure t
  552. :after (org evil-collection)
  553. :diminish
  554. :general
  555. (wiz-major-def
  556. :keymaps 'evil-org-mode-map
  557. "e" 'org-export-dispatch
  558. "a" 'org-attach
  559. "6" 'outline-up-heading)
  560. (general-define-key
  561. :states 'normal
  562. :keymaps 'evil-org-mode-map
  563. "^" 'evil-first-non-blank)
  564. :hook (org-mode . evil-org-mode)
  565. :config
  566. (add-hook 'evil-org-mode-hook
  567. (lambda ()
  568. (evil-org-set-key-theme '(textobjects insert navigation
  569. additional shift todo
  570. calendar))))
  571. (require 'evil-org-agenda)
  572. (evil-org-agenda-set-keys))
  573. ;; use c-q to insert single pairs when ya want 'em
  574. (use-package evil-smartparens
  575. :after evil
  576. :ensure t
  577. :hook (smartparens-mode . evil-smartparens-mode)
  578. :general
  579. ;; I'm still not too satisfied with these but whateves
  580. (:keymaps '(insert normal visual)
  581. "M-." 'sp-forward-slurp-sexp
  582. "M-l" 'sp-backward-slurp-sexp
  583. "M-n" 'sp-forward-barf-sexp
  584. "M-h" 'sp-backward-barf-sexp)
  585. :init
  586. ;; Start this shiznit when emacs starts yea boy it's good B)
  587. ;; (smartparens-global-strict-mode)
  588. :config
  589. (require 'smartparens-config))
  590. #+END_SRC
  591. **** evil-surround
  592. You can surround in visual-state with =S<textobject>= or =gS<textobject>=
  593. and in normal-state with =ys<textobject>= or =yS<textobject>=.
  594. You can change a surrounding with =cs<old-textobject><new-textobject>=.
  595. You can delete a surrounding with =ds<textobject>=.
  596. #+BEGIN_SRC emacs-lisp
  597. (use-package evil-surround
  598. :after evil
  599. :ensure t
  600. :diminish
  601. :config
  602. (global-evil-surround-mode 1))
  603. #+END_SRC
  604. **** evil-escape
  605. hit fd to escape pretty much everything
  606. #+BEGIN_SRC emacs-lisp
  607. (use-package evil-escape
  608. :ensure t
  609. :diminish
  610. :config
  611. (setq-default evil-escape-key-sequence "fd")
  612. (evil-escape-mode))
  613. #+END_SRC
  614. **** evil-commentary
  615. [[https://github.com/linktohack/evil-commentary][github here]]
  616. Essentially:
  617. - =gcc= comments out a line
  618. - =gc= comments out the target of a motion
  619. #+BEGIN_SRC emacs-lisp
  620. (use-package evil-commentary
  621. :after evil
  622. :ensure t
  623. :diminish
  624. :hook ((prog-mode . evil-commentary-mode)
  625. (conf-mode . evil-commentary-mode)
  626. (org-mode . evil-commentary-mode)
  627. (tex-mode . evil-commentary-mode)))
  628. #+END_SRC
  629. **** ex extras
  630. #+BEGIN_SRC emacs-lisp
  631. (use-package evil-expat
  632. :ensure t
  633. :diminish)
  634. #+END_SRC
  635. ** Convenience
  636. *** Automagic updates
  637. Keep packages up to date
  638. #+BEGIN_SRC emacs-lisp
  639. (use-package auto-package-update
  640. :ensure t
  641. :config
  642. (setq auto-package-update-delete-old-versions t)
  643. (setq auto-package-update-hide-results t)
  644. ;; Auto update after a week
  645. (auto-package-update-maybe))
  646. #+END_SRC
  647. *** shift-number
  648. Shifts the next number on the given line
  649. #+BEGIN_SRC emacs-lisp
  650. (use-package shift-number
  651. :ensure t
  652. :general (:keymaps 'override
  653. "M-+" 'shift-number-up
  654. "M-_" 'shift-number-down))
  655. #+END_SRC
  656. *** hide minor modes on modeline
  657. Diminish hides minor modes on the modeline.
  658. #+BEGIN_SRC emacs-lisp
  659. (use-package diminish
  660. :ensure t
  661. :config
  662. (diminish 'undo-tree-mode))
  663. #+END_SRC
  664. *** rainbow
  665. Lights up color tokens / delimiters
  666. #+BEGIN_SRC emacs-lisp
  667. (use-package rainbow-mode
  668. :ensure t
  669. :diminish
  670. :hook ((conf-mode . rainbow-mode)
  671. (sass-mode . rainbow-mode)
  672. (web-mode . rainbow-mode)))
  673. (use-package rainbow-delimiters
  674. :ensure t
  675. :hook (prog-mode . rainbow-delimiters-mode))
  676. #+END_SRC
  677. *** Show cursor location (DISABLED)
  678. When a window is changed / opened, the cursor's location is visibly
  679. pinged.
  680. # #+BEGIN_SRC emacs-lisp
  681. # (use-package beacon
  682. # :ensure t
  683. # :diminish
  684. # :init
  685. # (beacon-mode 1))
  686. # #+END_SRC
  687. *** ranger file manager (DISABLED)
  688. Let's not use this for now
  689. # #+BEGIN_SRC emacs-lisp
  690. # (use-package ranger
  691. # :ensure t
  692. # :init
  693. # (ranger-override-dired-mode)
  694. # :general
  695. # (wiz-file-def
  696. # "d" 'ranger)
  697. # :config
  698. # (setq ranger-modify-header t
  699. # ranger-hide-cursor nil
  700. # ranger-literal-preview nil
  701. # ranger-override-dired-mode 'ranger))
  702. # #+END_SRC
  703. *** w3m
  704. #+BEGIN_SRC emacs-lisp
  705. (use-package w3m
  706. :ensure t)
  707. #+END_SRC
  708. ** Autocompletion
  709. *** Fuzzy matching
  710. Ivy, swiper, and counsel all provide fuzzy-matching on different emacs
  711. operations.
  712. #+BEGIN_SRC emacs-lisp
  713. (use-package ivy
  714. :ensure t
  715. :diminish
  716. :general
  717. (wiz-buffer-def
  718. "s" 'ivy-switch-buffer
  719. "v" 'ivy-push-view
  720. "V" 'ivy-pop-view)
  721. :config
  722. (setq ivy-use-virtual-buffers t
  723. ivy-count-format "%d/%d "
  724. ivy-display-style 'fancy))
  725. (use-package swiper
  726. :after ivy
  727. :ensure t
  728. :demand t
  729. :general
  730. (:keymaps 'normal
  731. "/" 'swiper
  732. ;; For some reason, searching with swiper causes these to be reversed.
  733. "n" 'evil-search-previous
  734. "N" 'evil-search-next))
  735. (use-package ivy-rich
  736. :after ivy
  737. :ensure t
  738. :config
  739. (setq ivy-rich-path-style 'abbrev
  740. ivy-virtual-abbreviate 'full
  741. ivy-rich-switch-buffer-align-virtual-buffer t)
  742. (ivy-rich-mode 1))
  743. (use-package ivy-bibtex
  744. :after ivy
  745. :ensure t
  746. :defer t)
  747. (use-package counsel
  748. :ensure t
  749. :demand t
  750. :general
  751. ("M-x" 'counsel-M-x)
  752. (wiz-org-def
  753. "c" 'counsel-org-capture)
  754. (wiz-file-def
  755. "f" 'counsel-find-file))
  756. (use-package counsel-tramp
  757. :after counsel
  758. :ensure t)
  759. (use-package counsel-projectile
  760. :after counsel
  761. :ensure t)
  762. #+END_SRC
  763. *** Code completion
  764. [[https://company-mode.github.io/][company]] comlpetes anything in the buffer
  765. #+BEGIN_SRC emacs-lisp
  766. (use-package company
  767. :ensure t
  768. :hook (after-init . global-company-mode)
  769. :general
  770. (:keymaps 'company-active-map
  771. "C-SPC" 'company-abort)
  772. :config
  773. (setq company-maximum-prefix-length 3
  774. company-idle-delay 0.2))
  775. ;; Documentation popups with company, works best with gui
  776. (when window-system
  777. (use-package company-quickhelp
  778. :ensure t
  779. :after company
  780. :hook (company-mode . company-quickhelp-mode)))
  781. #+END_SRC
  782. ** Snippets
  783. Powered by Yasnippet
  784. Note that the =yasnippet-snippets= file may need to be manually
  785. installed.
  786. #+BEGIN_SRC emacs-lisp
  787. (use-package yasnippet
  788. :ensure t
  789. ;; :hook ((tex-mode . yas-minor-mode)
  790. ;; (php-mode . yas-minor-mode)
  791. ;; (python-mode . yas-minor-mode)
  792. ;; (emacs-lisp-mode . yas-minor-mode)
  793. ;; (c-mode . yas-minor-mode)
  794. ;; (c++-mode . yas-minor-mode)
  795. ;; (org-mode . yas.minor-mode)))
  796. :init
  797. (yas-global-mode))
  798. (use-package yasnippet-snippets
  799. :pin melpa
  800. :after yasnippet
  801. :config
  802. (yas-reload-all))
  803. #+END_SRC
  804. ** Text searching
  805. *** deadgrep
  806. [[https://github.com/Wilfred/deadgrep][deadgrep]] provides a frontend to ripgrep
  807. #+BEGIN_SRC emacs-lisp
  808. (use-package deadgrep
  809. :ensure t
  810. :general
  811. (wiz-misc-def
  812. "d" 'deadgrep))
  813. #+END_SRC
  814. *** avy
  815. use =ga= and =gA= to hint letters n stuff.
  816. #+BEGIN_SRC emacs-lisp
  817. (use-package avy
  818. :ensure t
  819. :general
  820. (:states 'normal
  821. "ga" 'avy-goto-char-in-line
  822. "gA" 'avy-goto-char))
  823. (use-package link-hint
  824. :ensure t
  825. ;; :after avy
  826. :general
  827. (wiz-misc-def
  828. "l" 'link-hint-open-link
  829. "L" 'link-hint-copy-link))
  830. #+END_SRC
  831. ** org-mode
  832. *** Master org package
  833. Keep org-mode up to date straight from the cow's utters.
  834. If the manual is not on your computer, it's [[https://orgmode.org/manual/][here]].
  835. #+BEGIN_SRC emacs-lisp
  836. (use-package org
  837. :ensure t
  838. :ensure org-plus-contrib
  839. :pin org
  840. :general
  841. (wiz-major-def
  842. :keymaps 'org-capture-mode-map
  843. "c" 'org-capture-finalize
  844. "w" 'org-capture-refile
  845. "k" 'org-capture-kill)
  846. (wiz-major-def
  847. :keymaps 'org-mode-map
  848. "e" 'org-export-dispatch)
  849. (wiz-org-def
  850. "a" 'org-agenda
  851. "l" 'org-store-link
  852. "b" 'org-switch))
  853. (use-package org-contacts
  854. :ensure nil
  855. :after org
  856. :custom (org-contacts-files '("~/Documents/org/contacts.org")))
  857. #+END_SRC
  858. *** Pretty bullets
  859. Make bullets look choice
  860. #+BEGIN_SRC emacs-lisp
  861. (use-package org-bullets
  862. :ensure t
  863. :hook (org-mode . org-bullets-mode))
  864. #+END_SRC
  865. *** org-download
  866. For [[https://github.com/abo-abo/org-download][drag n drop]] images n stuff
  867. # #+BEGIN_SRC emacs-lisp
  868. # (use-package org-download
  869. # :after org
  870. # :pin melpa
  871. # :ensure t
  872. # :hook (dired-mode . org-download-enable))
  873. # #+END_SRC
  874. ** Startup splash screen
  875. Show a custom buffer on startup
  876. #+BEGIN_SRC emacs-lisp
  877. (use-package dashboard
  878. :ensure t
  879. :config
  880. (dashboard-setup-startup-hook)
  881. (setq dashboard-banner-logo-title "Electronic Macs")
  882. (setq dashboard-startup-banner wiz-startpic)
  883. (setq dashboard-items '((recents . 5)
  884. (agenda)
  885. (projects . 5)
  886. (bookmarks . 5)
  887. (registers . 5))))
  888. #+END_SRC
  889. ** Tags
  890. make tag files.
  891. #+BEGIN_SRC emacs-lisp
  892. (use-package ggtags
  893. :ensure t)
  894. #+END_SRC
  895. *** TODO: Make tag files do stuff
  896. ** Project Management
  897. TODO: Set this up to actually work well
  898. #+BEGIN_SRC emacs-lisp
  899. (use-package projectile
  900. :ensure t
  901. :diminish
  902. :general
  903. (wiz-leader-def
  904. "p" '(:keymap projectile-command-map)))
  905. #+END_SRC
  906. *** [[https://ox-hugo.scripter.co/][ox-hugo]]
  907. Allows me to write blog entries
  908. See [[https://ox-hugo.scripter.co/doc/auto-export-on-saving/][Here]] for auto export instructions
  909. #+BEGIN_SRC emacs-lisp
  910. (use-package ox-hugo
  911. :ensure t
  912. :after ox)
  913. #+END_SRC
  914. ** pretty-mode
  915. [[https://github.com/pretty-mode/pretty-mode][Redisplay parts of the Emacs buffer as pretty symbols.]]
  916. #+BEGIN_SRC emacs-lisp
  917. (when window-system
  918. (use-package pretty-mode
  919. :ensure t
  920. :config
  921. (global-pretty-mode t)))
  922. #+END_SRC
  923. ** Error checking
  924. #+BEGIN_SRC emacs-lisp
  925. (use-package flycheck
  926. :ensure t
  927. :defer t)
  928. #+END_SRC
  929. ** Programming language specific stuff
  930. *** C / C++
  931. **** Completion
  932. Irony handles enhanced C / C++ operations powered by clang
  933. #+BEGIN_SRC emacs-lisp
  934. (use-package irony
  935. :ensure t
  936. :defer t
  937. :hook ((c++-mode . irony-mode)
  938. (c-mode . irony-mode)
  939. (irony-mode . irony-cdb-autosetup-compile-options)))
  940. (use-package company-irony
  941. :after (company, irony)
  942. :ensure t
  943. :config
  944. (add-to-list 'company-backends 'company-irony))
  945. #+END_SRC
  946. *** Python
  947. **** TODO jedi for autocompletion sources n stuff
  948. #+BEGIN_SRC emacs-lisp
  949. (use-package company-jedi
  950. :ensure t
  951. :defer t
  952. :init
  953. (defun wiz-python-company-mode-hook ()
  954. (add-to-list 'company-backends 'company-jedi))
  955. (add-hook 'python-mode-hook 'wiz-python-company-mode-hook)
  956. (setq python-environment-virtualenv '("virtualenv" "--system-site-packages" "--quiet"))
  957. (setq jedi:environment-root "jedi") ; or any other name you like
  958. (setq jedi:environment-virtualenv
  959. (append python-environment-virtualenv
  960. '("--python" "/usr/bin/python3"))))
  961. #+END_SRC
  962. *** Web Development
  963. **** Web mode
  964. Should give everything you need for a web-dev major mode, except for
  965. company integration.
  966. This might also provide a decent php-mode, but that might require some
  967. testing.
  968. #+BEGIN_SRC emacs-lisp
  969. (use-package web-mode
  970. :pin melpa
  971. :ensure t
  972. :defer t
  973. :hook (web-mode . company-mode)
  974. :init
  975. (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  976. (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
  977. (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
  978. (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
  979. (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
  980. (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
  981. (add-to-list 'auto-mode-alist '("\\.eex\\'" . web-mode))
  982. (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
  983. (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
  984. :config
  985. (setq web-mode-markup-indent-offset 2))
  986. #+END_SRC
  987. **** Web mode completion
  988. Web-mode completion
  989. #+BEGIN_SRC emacs-lisp
  990. (use-package company-web
  991. :ensure t
  992. :hook (web-mode . (lambda ()
  993. (add-to-list 'company-backends 'company-web-html)
  994. (add-to-list 'company-backends 'company-web-jade)
  995. (add-to-list 'company-backends 'company-web-slim))))
  996. #+END_SRC
  997. **** JSON
  998. Just an enhanced json mode
  999. #+BEGIN_SRC emacs-lisp
  1000. (use-package json-mode
  1001. :ensure t
  1002. :mode (("\\.json\\'" . json-mode)
  1003. ("\\manifest.webapp\\'" . json-mode )
  1004. ("\\.tern-project\\'" . json-mode)))
  1005. #+END_SRC
  1006. **** PHP
  1007. Should (at least) include all standard function sources for company in
  1008. addition to some other niceties. See more on their [[https://github.com/arnested/php-extras][GitHub page]].
  1009. #+BEGIN_SRC emacs-lisp
  1010. (use-package php-extras
  1011. :pin marmalade
  1012. :defer t
  1013. :ensure t
  1014. :hook (php-mode . web-mode))
  1015. #+END_SRC
  1016. **** sass
  1017. #+BEGIN_SRC emacs-lisp
  1018. (use-package sass-mode
  1019. :pin melpa
  1020. :ensure t)
  1021. #+END_SRC
  1022. **** request
  1023. Send web requests in emacs
  1024. #+BEGIN_SRC emacs-lisp
  1025. (use-package request
  1026. :pin melpa
  1027. :ensure t)
  1028. #+END_SRC
  1029. *** LaTeX
  1030. **** Completion
  1031. #+BEGIN_SRC emacs-lisp
  1032. (use-package company-auctex
  1033. :ensure t)
  1034. (use-package company-bibtex
  1035. :ensure t
  1036. :config
  1037. (add-to-list 'company-backends 'company-bibtex))
  1038. #+END_SRC
  1039. *** Shell
  1040. Show completions for shell mode buffers
  1041. #+BEGIN_SRC emacs-lisp
  1042. (use-package readline-complete
  1043. :ensure t)
  1044. #+END_SRC
  1045. *** Music stuff
  1046. **** Supercollider
  1047. #+BEGIN_SRC emacs-lisp
  1048. (use-package sclang-snippets
  1049. :ensure t)
  1050. #+END_SRC
  1051. *** OS DSL
  1052. **** Arch Linux PKGBUILD
  1053. #+BEGIN_SRC emacs-lisp
  1054. (use-package pkgbuild-mode
  1055. :ensure t)
  1056. #+END_SRC
  1057. **** Nix
  1058. #+BEGIN_SRC emacs-lisp
  1059. (use-package nix-mode
  1060. :ensure t)
  1061. #+END_SRC
  1062. **** Puppet
  1063. #+BEGIN_SRC emacs-lisp
  1064. (use-package puppet-mode
  1065. :pin melpa
  1066. :ensure t)
  1067. #+END_SRC
  1068. #+RESULTS:
  1069. *** Lisp
  1070. **** Scheme
  1071. #+BEGIN_SRC emacs-lisp
  1072. (use-package geiser
  1073. :ensure t
  1074. :config
  1075. (setq geiser-active-implementations '(guile)))
  1076. #+END_SRC
  1077. ** IRC
  1078. Internet relay chat. It's where hackers go to communicate. Think of it
  1079. like two boats in a shipping channel.
  1080. #+BEGIN_SRC emacs-lisp
  1081. ;; keep ERC up to date
  1082. (use-package erc
  1083. :ensure t
  1084. :defer t
  1085. :general
  1086. (wiz-major-def
  1087. :keymaps 'erc-mode
  1088. "b" 'erc-iswitchb
  1089. "c" 'erc-toggle-interpret-controls
  1090. "d" 'erc-input-action
  1091. "e" 'erc-toggle-ctcp-autoresponse
  1092. "f" 'erc-toggle-flood-control
  1093. "TAB" 'erc-invite-only-mode
  1094. "j" 'erc-join-channel
  1095. "k" 'erc-go-to-log-matches-buffer
  1096. "l" 'erc-save-buffer-in-logs
  1097. "n" 'erc-channel-names
  1098. "o" 'erc-get-channel-names-from-keypress
  1099. "p" 'erc-part-from-channel
  1100. "q" 'erc-quit-from-server
  1101. "r" 'erc-remove-text-properties-region
  1102. "t" 'erc-set-topic
  1103. "u" 'erc-kill-input)
  1104. :init
  1105. (defun wiz-irc-init ()
  1106. "Access the encrypted file storing all of your irc connection
  1107. information. It automatically connects you to a default set of
  1108. servers."
  1109. (interactive)
  1110. (if (file-exists-p
  1111. (concat user-emacs-directory "irc-servers.el.gpg"))
  1112. (load-file (concat user-emacs-directory "irc-servers.el.gpg"))))
  1113. ;; Load the file containing all of my server connection info
  1114. :config
  1115. ;; Enable the modules I want
  1116. (setq erc-modules '(autojoin
  1117. completion
  1118. dcc
  1119. button
  1120. fill
  1121. match
  1122. netsplit
  1123. ring
  1124. list
  1125. log
  1126. readonly
  1127. noncommands
  1128. networks
  1129. move-to-prompt
  1130. notifications
  1131. track
  1132. irccontrols
  1133. move-to-prompt
  1134. menu
  1135. stamp))
  1136. ;; spellchecking :D
  1137. (erc-spelling-mode 1)
  1138. ;; Use my auth-sources pl0x
  1139. (setq erc-prompt-for-nickserv-password nil
  1140. erc-prompt-for-password nil)
  1141. ;; List of places to look for IRC connection info
  1142. ;; irc-servers.el.gpg should now hold most of this information.
  1143. (setq auth-sources `("~/.authinfo.gpg"
  1144. ,(concat user-emacs-directory ".authinfo.gpg")))
  1145. ;; Append this if name is in use
  1146. (setq erc-nick-uniquifier "^")
  1147. ;; De-clutter my shiznit
  1148. (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
  1149. (setq erc-lurker-threshold-time 600)
  1150. ;; Name buffers something logical
  1151. (setq erc-rename-buffers t)
  1152. ;; Interpret mIRC-style color commands in IRC chats
  1153. (setq erc-interpret-mirc-color t)'
  1154. ;; Don't focus buffer on connect
  1155. (setq erc-join-buffer 'bury)
  1156. ;; Change fill to emacs buffer width
  1157. ;; It's a bit buggy, so cuidado, eh?
  1158. ;; Commented because of how bug this is
  1159. ;; (make-variable-buffer-local 'erc-fill-column)
  1160. ;; (add-hook 'window-configuration-change-hook
  1161. ;; '(lambda ()
  1162. ;; (save-excursion
  1163. ;; (walk-windows
  1164. ;; (lambda (w)
  1165. ;; (let ((buffer (window-buffer w)))
  1166. ;; (set-buffer buffer)
  1167. ;; (when (eq major-mode 'erc-mode)
  1168. ;; (setq erc-fill-column (- (window-width w) 2)))))))))
  1169. (setq erc-prompt (lambda () (concat "[" (buffer-name) "]")))
  1170. ;; (defun wiz-erc-mode-hook ()
  1171. ;; (setq erc-fill-column 92))
  1172. (setq erc-fill-column 92)
  1173. ;; (add-hook 'erc-mode-hook 'wiz-erc-mode-hook)
  1174. (setq erc-button-url-regexp
  1175. "\\([-a-zA-Z0-9_=!?#$@~`%&*+\\/:;,]+\\.\\)+[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;,]*[-a-zA-Z0-9\\/]")
  1176. (setq erc-fill-static-center 15
  1177. erc-fill-function 'erc-fill-static
  1178. ;; Logging
  1179. erc-log-insert-log-on-open nil
  1180. erc-log-channels t
  1181. erc-log-channels-directory "~/.irclogs/"
  1182. erc-save-buffer-on-part t
  1183. erc-hide-timestamps nil)
  1184. :config
  1185. (erc-update-modules))
  1186. ;; highlight nicks
  1187. (use-package erc-hl-nicks
  1188. :after erc
  1189. :ensure t
  1190. :defer t
  1191. :init
  1192. (add-to-list 'erc-modules 'hl-nicks)
  1193. :config
  1194. (erc-update-modules))
  1195. ;; Display images as links in a channel
  1196. ;; (use-package erc-image
  1197. ;; :after erc
  1198. ;; :ensure t
  1199. ;; :defer t
  1200. ;; :init
  1201. ;; (add-to-list 'erc-modules 'image)
  1202. ;; :config
  1203. ;; (erc-update-modules))
  1204. ;; (use-package ercn
  1205. ;; :pin melpa
  1206. ;; :after erc
  1207. ;; :ensure t
  1208. ;; :init
  1209. ;; ;; todo config this lol
  1210. ;; (defun do-notify nickname message ())
  1211. ;; :config
  1212. ;; (setq ercn-notify-rules
  1213. ;; '((current-nick . all)
  1214. ;; (keyword . all)
  1215. ;; ;; (pal . ("#emacs"))
  1216. ;; (pal . all)
  1217. ;; (query-buffer . all))))
  1218. (use-package erc-status-sidebar
  1219. :after erc
  1220. :ensure t)
  1221. #+END_SRC
  1222. ** Ledger
  1223. #+BEGIN_SRC emacs-lisp
  1224. (use-package ledger-mode
  1225. :ensure t
  1226. :init
  1227. (setq ledger-clear-whole-transactions 1)
  1228. :config
  1229. (add-to-list 'evil-emacs-state-modes 'ledger-report-mode)
  1230. ;; remove evil mode from ledger reports
  1231. :mode ("\\.dat\\'"
  1232. "\\.ledger\\'")
  1233. ;; :general
  1234. ;; (wiz-file-def
  1235. ;; :keymap 'ledger-mode-map
  1236. ;; "w" 'wiz-ledger-save)
  1237. :preface
  1238. (defun wiz-ledger-save ()
  1239. "Automatically clean the ledger buffer at each save."
  1240. (interactive)
  1241. (save-excursion
  1242. (when (buffer-modified-p)
  1243. (with-demoted-errors (ledger-mode-clean-buffer))
  1244. (save-buffer)))))
  1245. #+END_SRC
  1246. ** pass
  1247. I use [[https://www.passwordstore.org/][=pass=]] for my password management.
  1248. #+BEGIN_SRC emacs-lisp
  1249. (use-package ivy-pass
  1250. :ensure t
  1251. :general
  1252. (wiz-leader-def
  1253. "P" 'ivy-pass))
  1254. #+END_SRC
  1255. ** Git (magit)
  1256. I hear that this is one of those emacs "killer apps"
  1257. See keybindings [[https://github.com/emacs-evil/evil-magit][here.]]
  1258. #+BEGIN_SRC emacs-lisp
  1259. (use-package magit
  1260. :ensure t
  1261. :general
  1262. (wiz-leader-def
  1263. "g" 'magit))
  1264. (use-package evil-magit
  1265. :after (magit evil evil-collection)
  1266. :ensure t)
  1267. #+END_SRC
  1268. ** Docker
  1269. Enables usage of docker from within emacs, and supports dockerfiles
  1270. #+BEGIN_SRC emacs-lisp
  1271. (use-package docker
  1272. :ensure t)
  1273. (use-package dockerfile-mode
  1274. :ensure t
  1275. :pin melpa)
  1276. (use-package docker-compose-mode
  1277. :ensure t
  1278. :pin melpa)
  1279. (use-package docker-tramp
  1280. :ensure t)
  1281. #+END_SRC
  1282. ** Themes
  1283. #+BEGIN_SRC emacs-lisp
  1284. (use-package base16
  1285. :ensure t
  1286. :init
  1287. (load-theme 'base16-black-metal-mayhem))
  1288. #+END_SRC
  1289. * Final Touches
  1290. Display a [[https://xkcd.com/37/][sick ass-message]] on the desktop to verify that dbus is good
  1291. and all is well in the wold
  1292. #+BEGIN_SRC emacs-lisp
  1293. (notifications-notify :title "Emacs"
  1294. :body "Fully loaded & operational!")
  1295. (message "Emacs done initializing.")
  1296. #+END_SRC