|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392 |
- * General Emacs Configuration
- ** Load some libraries
- Like notifications
- #+BEGIN_SRC emacs-lisp
- (load-library "notifications")
- (notifications-notify :title "Emacs"
- :body "Electronic Macros loading...")
- (message "Emacs initializing...")
- #+END_SRC
- and sclang, if avaliable
- #+BEGIN_SRC emacs-lisp
- (add-to-list 'load-path "/usr/local/bin/sclang")
- (require 'sclang)
- #+END_SRC
- ** Helper Functions
- #+BEGIN_SRC emacs-lisp
- (defun wiz-kill-all-buffers ()
- (interactive)
- (mapc 'kill-buffer (buffer-list)))
-
- (defun wiz-kill-curr-buffer ()
- (interactive)
- (kill-buffer (current-buffer)))
- #+END_SRC
- ** Customize file
- Makes it so the customize data isn't schlunked in my init.el
- #+BEGIN_SRC emacs-lisp
- (setq custom-file (concat user-emacs-directory "_customize.el"))
- (load custom-file t)
- #+END_SRC
- ** Startup image
- Add a fun image to the emacs startup screen
- The variable is used below in Dashboard
- #+BEGIN_SRC emacs-lisp
- (defvar wiz-startpic (concat user-emacs-directory "pictures/startpic.png"))
-
- (if (file-readable-p wiz-startpic)
- (lambda ()
- (setq fancy-splash-image wiz-startpic)
- (message "Splash image loaded."))
- (message "The splash image is unreadable."))
- #+END_SRC
-
- ** Notifications
- Enable make some tweaks
- #+BEGIN_SRC emacs-lisp
- (defvar wiz-notifypic (concat user-emacs-directory "pictures/notifypic.png"))
-
- (if (file-readable-p wiz-notifypic)
- (setq notifications-application-icon
- (concat user-emacs-directory "pictures/notifypic.png")))
- #+END_SRC
- ** De-clutter
- Disable the useless cruft at the top of the screen
-
- #+BEGIN_SRC emacs-lisp
- (menu-bar-mode 0)
- (tool-bar-mode 0)
- (scroll-bar-mode -1)
- #+END_SRC
-
- ** Show parenthesis
- Shows matching parenthesis
- #+BEGIN_SRC emacs-lisp
- (require 'paren)
- ;; (set-face-background 'show-paren-match "#000")
- ;; (set-face-foreground 'show-paren-match "#d9f")
- ;; (set-face-attribute 'show-paren-match nil :weight 'extra-bold)
- (setq show-paren-delay 0)
- (show-paren-mode)
- #+END_SRC
-
- ** electric pairs (DISABLED in favor of smartparens)
- When you open a code block, close that block.
- # #+BEGIN_SRC emacs-lisp
- # (setq electric-pair-pairs '(
- # (?\( . ?\))
- # (?\[ . ?\])
- # (?\{ . ?\})
- # (?\" . ?\")
- # ;; (?\' . ?\')
- # ))
- # (setq electric-pair-preserve-balance t)
- # (electric-pair-mode t)
- # #+END_SRC
- ** Show columns
- #+BEGIN_SRC emacs-lisp
- (column-number-mode t)
- #+END_SRC
-
- ** Fonts
- Set the font to something cool
- #+BEGIN_SRC emacs-lisp
- ;; (set-default-font "Go Mono-11")
- (add-to-list 'default-frame-alist
- '(font . "Go Mono-11")
- '(font . "Noto Sans Mono CJK JP-11"))
- #+END_SRC
-
- ** Transparency
- Sets the window's transparency.
-
- The first number in the alpha section applies when the window is
- active, the second when it's inactive.
- #+BEGIN_SRC emacs-lisp
- (defvar wiz-default-transparency 95)
- (add-to-list 'default-frame-alist `(alpha . (,wiz-default-transparency . ,wiz-default-transparency)))
- ;; Set transparency of emacs
- (defun wiz-transparency (value)
- "Sets the transparency of the frame window. 0=transparent/100=opaque"
- (interactive "nTransparency Value 0 - 100 opaque:")
- (set-frame-parameter (selected-frame) 'alpha value))
-
- ;; (set-frame-parameter (selected-frame) 'alpha '(100 . 100))
- #+END_SRC
- ** Backup files
- Edit backup files properties
- https://www.emacswiki.org/emacs/BackupDirectory
- #+BEGIN_SRC emacs-lisp
- (setq
- backup-by-copying t ; don't clobber symlinks
- backup-directory-alist
- `(("." . ,(concat user-emacs-directory "backups"))) ; don't litter my fs tree
- delete-old-versions t
- kept-new-versions 6
- kept-old-versions 2
- version-control t) ; use versioned backups
- ;; Actually a lot of this doesn't work
- (setq
- make-backup-files nil
- auto-save-default nil)
- #+END_SRC
- ** Scrolling
- #+BEGIN_SRC emacs-lisp
- (setq scroll-conservatively 100) ;; don't scroll a metric boatload when bottom is hit
- #+END_SRC
- ** Shut up Emacs
- #+BEGIN_SRC emacs-lisp
- (setq ring-bell-function 'ignore) ;;emacs stfu
- #+END_SRC
-
- ** Show line numbers
- Enable lines when editing files
- #+BEGIN_SRC emacs-lisp
- (unless (version< emacs-version "26.1")
- (setq display-line-numbers-type 'relative)
-
- (add-hook 'text-mode-hook 'display-line-numbers-mode)
- (add-hook 'prog-mode-hook 'display-line-numbers-mode)
- (add-hook 'sclang-mode-hook 'display-line-numbers-mode)
- (add-hook 'conf-mode-hook 'display-line-numbers-mode)
-
- (setq display-line-numbers-grow-only t)
- (setq display-line-numbers-width-start 4)
-
- (defun wiz-disable-line-numbers ()
- (interactive)
- (setq display-line-numbers nil)))
-
-
- #+END_SRC
-
- ** y or n prompts
- #+BEGIN_SRC emacs-lisp
- (defalias 'yes-or-no-p 'y-or-n-p) ;; make yes or no prompts ask for y or n
- #+END_SRC
-
- ** Customize the terminal
- #+BEGIN_SRC emacs-lisp
- (defvar wiz-term-shell "/bin/zsh") ;; I like to utilize zsh
- (defadvice ansi-term (before force-bash)
- (interactive (list wiz-term-shell)))
- (ad-activate 'ansi-term)
- #+END_SRC
-
- ** Prettify symbols
- +=|====> = CoolSword
- #+BEGIN_SRC emacs-lisp
- (add-to-list 'prettify-symbols-alist '("+=|====>" 🗡️))
- (global-prettify-symbols-mode 1)
- #+END_SRC
-
- ** Tabs are spaces?!
- #+BEGIN_SRC emacs-lisp
- (setq-default indent-tabs-mode nil)
- (setq-default tab-width 4)
- (setq indent-line-function 'insert-tab)
- #+END_SRC
-
- ** org-mode
- *** General org settings
- Auto-indent org files nicely
- #+BEGIN_SRC emacs-lisp
- (add-hook 'org-mode-hook 'org-indent-mode)
- #+END_SRC
-
- Highlight syntax in source blocks
- #+BEGIN_SRC emacs-lisp
- (setq org-src-fontify-natively t)
- #+END_SRC
- *** Capture Templates
- Set the org mode directory and define some capture templates
- #+BEGIN_SRC emacs-lisp
- (setq org-directory "~/Documents/org/")
- (setq org-agenda-files '("~/Documents/org/"))
- (setq org-capture-templates
- (quote
- (("t" "Todo" entry
- (file+olp "todo.org" "Tasks" "Misc")
- "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
- ("tm" "Music Todo" entry
- (file+olp "todo.org" "Tasks" "Music")
- "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
- ("ts" "Server Todo" entry
- (file+olp "todo.org" "Tasks" "Server")
- "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
- ("tp" "Program Todo" entry
- (file+olp "todo.org" "Tasks" "Programming")
- "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
- ("tb" "Blog Todo" entry
- (file+olp "todo.org" "Tasks" "Blog")
- "** TODO %^{Thing to do}\nDEADLINE: %t\nadded: %t\n")
- ("T" "Thoughts" entry
- (file+headline "thoughts.org" "Thoughts")
- "** %^{Summary} %t :thoughts:\n")
- ("s" "School-related task" entry
- (file+olp+prompt "school.org" "Todo")
- "** TODO %^{What needs be done}\n DEADLINE: %t\n")
- ("d" "Dream Journal" entry
- (file+olp+datetree "dreams.org")
- "**** Dream\n")
- ("m" "Bookmark" entry
- (file+olp "links.org" "Refile")
- "** [[%^{link}][%^{description}]]\n"))))
- #+END_SRC
-
- *** Org templates
- <el expands to emacs lisp code block
- #+BEGIN_SRC emacs-lisp
- (setq org-src-window-setup 'current-window)
- (add-to-list 'org-structure-template-alist
- '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
- #+END_SRC
- *** Autocomplete todo entries
- #+BEGIN_SRC emacs-lisp
- (defun org-summary-todo (n-done n-not-done)
- "Switch entry to DONE when all subentries are done, to TODO otherwise."
- (let (org-log-done org-log-states)
- ; turn off logging
- (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
- (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
- #+END_SRC
- *** export settings
- **** use latexmk
- #+BEGIN_SRC emacs-lisp
- (setq org-latex-to-pdf-process (list "latexmk -f -pdf %f"))
-
- #+END_SRC
- *** Keep diary
- #+BEGIN_SRC emacs-lisp
- (setq org-agenda-include-diary nil)
- (setq org-default-notes-file "notes.org")
- #+END_SRC
- ** set browser
- Default browser should be firefox
- #+BEGIN_SRC emacs-lisp
- (setq browse-url-generic-program "firefox"
- browse-url-browser-program 'browse-url-generic
- browse-url-default-browser 'browse-url-generic
- browse-url-browser-function 'browse-url-generic
- ;; And if I'm stuck like a rock in a hard place...
- browse-url-default-windows-browser 'browse-url-firefox)
- #+END_SRC
- ** Buffers
- *** ibuffer
- Expert mode to streamline stuff. Don't ask for confirmation of
- "dangerous" operations.
-
- The long variable settage is to group different types of buffers
- to make it easier to navigate.
-
- #+BEGIN_SRC emacs-lisp
- (setq ibuffer-expert 1)
- ;; see: ibuffer-filtering-alist
- (setq ibuffer-saved-filter-groups
- (quote (("default"
- ("dired" (mode . dired-mode))
- ("erc" (mode . erc-mode))
- ;; ("org" (directory . "^~\\/Documents\\/org\\/"))
- ("emacs" (or
- ;; (directory . "^~\\/\\.emacs\\.d\\/")
- (name . "^\\*scratch\\*$")
- (name . "^\\*dashboard\\*$")
- (mode . customize-mode)
- (name . "^\\*Messages\\*$")))))))
-
- (add-hook 'ibuffer-mode-hook
- (lambda ()
- (ibuffer-switch-to-saved-filter-groups "default")))
-
- ;; Use human readable Size column instead of original one
- (define-ibuffer-column size-h
- (:name "Size")
- (cond
- ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
- ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
- ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
- (t (format "%8d" (buffer-size)))))
-
- ;; Modify the default ibuffer-formats
- (setq ibuffer-formats
- '((mark modified read-only " "
- (name 18 18 :left :elide)
- " "
- (size-h 9 -1 :right)
- " "
- (mode 16 16 :left :elide)
- " "
- filename-and-process)))
-
- #+END_SRC
- *** scratch buffer
- #+BEGIN_SRC emacs-lisp
- (defun wiz-scratch-buffer nil
- "create a scratch buffer"
- (interactive)
- (switch-to-buffer (get-buffer-create "*scratch*"))
- (lisp-interaction-mode))
- #+END_SRC
- ** TODO Refresh theme on the fly
- 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]].
-
- Note: this requires base16-themes
- #+BEGIN_SRC emacs-lisp
- (add-to-list 'custom-theme-load-path (concat user-emacs-directory "themes/"))
- (defvar wiz-theme-file (concat user-emacs-directory "themes/base16-wal-theme.el"))
- (defun wiz-apply-theme ()
- (interactive)
- (progn
- (when (file-exists-p wiz-theme-file)
- (load-theme 'base16-wal t))))
-
- (defun theme-callback (event)
- (wiz-apply-theme))
-
- ;; (require 'filenotify)
- ;; (file-notify-add-watch
- ;; wiz-theme-file '(change) 'theme-callback)
-
- ;; Set the theme on startup
- ;; (wiz-apply-theme)
- #+END_SRC
- *** TODO Move this to the base16 config
- ** tramp
- #+BEGIN_SRC emacs-lisp
- (setq tramp-default-method "ssh")
- #+END_SRC
- ** Flyspell
- Enable a spellchecker
- #+BEGIN_SRC emacs-lisp
- (add-hook 'org-mode-hook 'flyspell-mode)
- #+END_SRC
- ** calc
- #+BEGIN_SRC emacs-lisp
- ;; (add-to-list 'evil-emacs-state-modes 'calc-mode)
- #+END_SRC
- * Package Repo Config
- ** Repo Location
- Let's start by configuring the repositories
- #+BEGIN_SRC emacs-lisp
- (require 'package)
-
- (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
- ("marmalade" . "https://marmalade-repo.org/packages/")
- ;; ("melpa-stable" . "https://stable.melpa.org/packages/")
- ("melpa" . "https://melpa.org/packages/")
- ("org" . "https://orgmode.org/elpa/")))
- (setq package-enable-at-startup nil)
- #+END_SRC
-
- ** use-package
- use-package for installing packages
- https://github.com/jwiegley/use-package
-
- #+BEGIN_SRC emacs-lisp
- (unless (package-installed-p 'use-package)
- (package-refresh-contents)
- (package-install 'use-package))
-
- (eval-when-compile
- (require 'use-package))
- #+END_SRC
-
- * Package Configuration
- ** Keybind-related packages
- *** Show key binds
- Pops up a screen that helps you navigate and complete commands
- #+BEGIN_SRC emacs-lisp
- (use-package which-key
- :ensure t
- :diminish
- :init
- (which-key-mode))
- #+END_SRC
- *** General
- General binds keys in a more sane way, and it integrates with
- =use-package=
- #+BEGIN_SRC emacs-lisp
- (use-package general
- :ensure t
- :config
- (general-create-definer wiz-leader-def
- :keymaps 'override
- :states '(normal insert emacs)
- :prefix "SPC"
- :non-normal-prefix "M-SPC")
- ;; Thanks to Jack for the below, smart man
- (defun wiz-create-wk-prefix (desc)
- "Helper for creating which-key prefix descriptions.
- Bind to a key with general to make which-key show DESC
- as the prefix's description"
- `(:ignore t :wk ,desc))
-
- (defmacro wiz-create-definers (definitions)
- "A wrapper for general-create-definer.
- For every pair in DEFINITIONS, creates a leader
- with name wiz-NAME-def and keybind SPC KEY or M-SPC KEY in normal mode."
- `(progn
- ,@(mapcan
- (lambda (def)
- (let ((key (car def))
- (name (cdr def)))
- `((general-create-definer ,(intern (concat "wiz-" name "-def"))
- :keymaps 'override
- :states '(normal insert emacs)
- :prefix ,(concat "SPC " key)
- :non-normal-prefix ,(concat "M-SPC " key))
- (wiz-leader-def ,key ',(wiz-create-wk-prefix name)))))
- definitions)))
-
- (wiz-create-definers
- (("b" . "buffer")
- ("f" . "file")
- ("h" . "help")
- ("l" . "misc")
- ("SPC" . "major")
- ("o" . "org")
- ("p" . "project")
- ("P" . "password")
- ("w" . "window"))))
-
- #+END_SRC
- **** A few binds
- ***** h - help
- #+BEGIN_SRC emacs-lisp
- (wiz-help-def
- "?" 'help-for-help
- "k" 'counsel-descbinds
- "f" 'counsel-describe-function
- "v" 'counsel-describe-variable
- "a" 'counsel-apropos
- "h" 'help-for-help)
- #+END_SRC
- ***** b - buffer
- #+BEGIN_SRC emacs-lisp
- (wiz-buffer-def
- "b" 'ibuffer
- "S" 'wiz-scratch-buffer
- "c" 'wiz-kill-curr-buffer
- "C" 'wiz-kill-all-buffers)
- #+END_SRC
- ***** f - file
- #+BEGIN_SRC emacs-lisp
- (wiz-file-def
- "w" 'save-buffer)
-
- #+END_SRC
-
- ****** Emacs-related
- ******* config edit / reload
- hit =e= to do that.
- #+BEGIN_SRC emacs-lisp
- (defun wiz-config-visit ()
- (interactive)
- (find-file (concat user-emacs-directory "config.org")))
- (defun wiz-config-reload ()
- (interactive)
- (org-babel-load-file
- (expand-file-name "config.org" user-emacs-directory)))
- (wiz-file-def
- "e" '(:ignore t :which-key "emacs files")
- "e e" 'wiz-config-visit
- "e r" 'wiz-config-reload)
- #+END_SRC
-
- ***** l - misc
- #+BEGIN_SRC emacs-lisp
- (wiz-misc-def
- :keymaps 'override
- :states 'normal
- :prefix "SPC l")
- #+END_SRC
-
- ***** w - window
- #+BEGIN_SRC emacs-lisp
- ;; (wiz-window-def
- ;; :keymaps 'override
- ;; :states 'normal
- ;; :prefix "SPC w")
-
- (wiz-window-def
- "o" 'delete-other-windows)
- #+END_SRC
-
- ***** ibuffer
- #+BEGIN_SRC emacs-lisp
- (general-define-key
- :keymaps 'override
- "C-x b" 'ibuffer)
- #+END_SRC
- ***** Terminal
- #+BEGIN_SRC emacs-lisp
- (wiz-leader-def
- "RET" 'eshell)
- #+END_SRC
-
- ***** Dired
- #+BEGIN_SRC emacs-lisp
- (wiz-file-def
- "d" 'dired)
- #+END_SRC
-
- ***** sclang-mode
- #+BEGIN_SRC emacs-lisp
- ;; (defun wiz-sclang-eval-region () "do nothing for now")
- (general-define-key
- :keymaps 'sclang-mode-map
- "C-c C-d" 'sclang-eval-defun
- "C-c C-c" 'sclang-eval-region-or-line)
- (wiz-major-def
- :keymaps 'sclang-mode-map
- "SPC" 'sclang-eval-region-or-line)
- #+END_SRC
- *** Vim bindings
- Let's get some vim up in here.
- **** evil
- Evil is pretty much the entirety of Vim in Emacs.
-
- [[evil-collection]] provides evil in many different modes.
-
- [[evil-org]] adds nice bindings to org-mode.
- #+BEGIN_SRC emacs-lisp
- (use-package evil
- :ensure t
- :after general
- :init
- (setq evil-want-integration t
- evil-want-C-u-scroll t
- evil-want-keybinding nil)
- (defun wiz-window-split ()
- (interactive)
- (evil-window-split)
- (evil-window-down 1))
- (defun wiz-window-vsplit ()
- (interactive)
- (evil-window-vsplit)
- (evil-window-right 1))
- :general
- (:keymaps 'override
- :states 'normal
- "U" 'undo-tree-visualize)
- (wiz-window-def
- "s" 'wiz-window-split
- "S" 'wiz-window-vsplit
- "v" 'wiz-window-vsplit
- "h" 'evil-window-left
- "j" 'evil-window-down
- "k" 'evil-window-up
- "l" 'evil-window-right
- "H" 'evil-window-far-left
- "J" 'evil-window-move-very-bottom
- "K" 'evil-window-move-very-top
- "L" 'evil-window-far-right
- "<" 'evil-window-decrease-width
- ">" 'evil-window-increase-width
- "^" 'evil-window-decrease-height
- "%" 'evil-window-increase-height
- "n" 'evil-window-new
- "c" 'evil-window-delete
- "w" 'evil-window-next
- "W" 'evil-window-prev
- "r" 'evil-window-rotate-downwards
- "|" 'evil-window-set-width
- "_" 'evil-window-set-height)
- :config
- (evil-mode t))
-
- (use-package evil-collection
- :after evil
- :ensure t
- :config
- (evil-collection-init)
- (setq evil-shift-width 4))
-
- (use-package evil-org
- :ensure t
- :after (org evil-collection)
- :diminish
- :general
- (wiz-major-def
- :keymaps 'evil-org-mode-map
- "e" 'org-export-dispatch
- "a" 'org-attach
- "6" 'outline-up-heading)
- (general-define-key
- :states 'normal
- :keymaps 'evil-org-mode-map
- "^" 'evil-first-non-blank)
- :hook (org-mode . evil-org-mode)
- :config
- (add-hook 'evil-org-mode-hook
- (lambda ()
- (evil-org-set-key-theme '(textobjects insert navigation
- additional shift todo
- calendar))))
- (require 'evil-org-agenda)
- (evil-org-agenda-set-keys))
-
- ;; use c-q to insert single pairs when ya want 'em
- (use-package evil-smartparens
- :after evil
- :ensure t
- :hook (smartparens-mode . evil-smartparens-mode)
- :general
- ;; I'm still not too satisfied with these but whateves
- (:keymaps '(insert normal visual)
- "M-." 'sp-forward-slurp-sexp
- "M-l" 'sp-backward-slurp-sexp
- "M-n" 'sp-forward-barf-sexp
- "M-h" 'sp-backward-barf-sexp)
- :init
- ;; Start this shiznit when emacs starts yea boy it's good B)
- ;; (smartparens-global-strict-mode)
- :config
- (require 'smartparens-config))
- #+END_SRC
-
- **** evil-surround
- You can surround in visual-state with =S<textobject>= or =gS<textobject>=
- and in normal-state with =ys<textobject>= or =yS<textobject>=.
- You can change a surrounding with =cs<old-textobject><new-textobject>=.
- You can delete a surrounding with =ds<textobject>=.
- #+BEGIN_SRC emacs-lisp
- (use-package evil-surround
- :after evil
- :ensure t
- :diminish
- :config
- (global-evil-surround-mode 1))
- #+END_SRC
- **** evil-escape
- hit fd to escape pretty much everything
- #+BEGIN_SRC emacs-lisp
- (use-package evil-escape
- :ensure t
- :diminish
- :config
- (setq-default evil-escape-key-sequence "fd")
- (evil-escape-mode))
- #+END_SRC
- **** evil-commentary
- [[https://github.com/linktohack/evil-commentary][github here]]
- Essentially:
- - =gcc= comments out a line
- - =gc= comments out the target of a motion
- #+BEGIN_SRC emacs-lisp
- (use-package evil-commentary
- :after evil
- :ensure t
- :diminish
- :hook ((prog-mode . evil-commentary-mode)
- (conf-mode . evil-commentary-mode)
- (org-mode . evil-commentary-mode)
- (tex-mode . evil-commentary-mode)))
- #+END_SRC
- **** ex extras
- #+BEGIN_SRC emacs-lisp
- (use-package evil-expat
- :ensure t
- :diminish)
- #+END_SRC
- ** Convenience
- *** Automagic updates
- Keep packages up to date
- #+BEGIN_SRC emacs-lisp
- (use-package auto-package-update
- :ensure t
- :config
- (setq auto-package-update-delete-old-versions t)
- (setq auto-package-update-hide-results t)
- ;; Auto update after a week
- (auto-package-update-maybe))
- #+END_SRC
-
- *** shift-number
- Shifts the next number on the given line
- #+BEGIN_SRC emacs-lisp
- (use-package shift-number
- :ensure t
- :general (:keymaps 'override
- "M-+" 'shift-number-up
- "M-_" 'shift-number-down))
- #+END_SRC
- *** hide minor modes on modeline
- Diminish hides minor modes on the modeline.
- #+BEGIN_SRC emacs-lisp
- (use-package diminish
- :ensure t
- :config
- (diminish 'undo-tree-mode))
- #+END_SRC
- *** rainbow
- Lights up color tokens / delimiters
- #+BEGIN_SRC emacs-lisp
- (use-package rainbow-mode
- :ensure t
- :diminish
- :hook ((conf-mode . rainbow-mode)
- (sass-mode . rainbow-mode)
- (web-mode . rainbow-mode)))
-
- (use-package rainbow-delimiters
- :ensure t
- :hook (prog-mode . rainbow-delimiters-mode))
- #+END_SRC
- *** Show cursor location (DISABLED)
- When a window is changed / opened, the cursor's location is visibly
- pinged.
- # #+BEGIN_SRC emacs-lisp
- # (use-package beacon
- # :ensure t
- # :diminish
- # :init
- # (beacon-mode 1))
- # #+END_SRC
- *** ranger file manager (DISABLED)
- Let's not use this for now
- # #+BEGIN_SRC emacs-lisp
- # (use-package ranger
- # :ensure t
- # :init
- # (ranger-override-dired-mode)
- # :general
- # (wiz-file-def
- # "d" 'ranger)
- # :config
- # (setq ranger-modify-header t
- # ranger-hide-cursor nil
- # ranger-literal-preview nil
- # ranger-override-dired-mode 'ranger))
- # #+END_SRC
- *** w3m
- #+BEGIN_SRC emacs-lisp
- (use-package w3m
- :ensure t)
- #+END_SRC
-
- ** Autocompletion
- *** Fuzzy matching
- Ivy, swiper, and counsel all provide fuzzy-matching on different emacs
- operations.
- #+BEGIN_SRC emacs-lisp
- (use-package ivy
- :ensure t
- :diminish
- :general
- (wiz-buffer-def
- "s" 'ivy-switch-buffer
- "v" 'ivy-push-view
- "V" 'ivy-pop-view)
- :config
- (setq ivy-use-virtual-buffers t
- ivy-count-format "%d/%d "
- ivy-display-style 'fancy))
-
- (use-package swiper
- :after ivy
- :ensure t
- :demand t
- :general
- (:keymaps 'normal
- "/" 'swiper
- ;; For some reason, searching with swiper causes these to be reversed.
- "n" 'evil-search-previous
- "N" 'evil-search-next))
-
- (use-package ivy-rich
- :after ivy
- :ensure t
- :config
- (setq ivy-rich-path-style 'abbrev
- ivy-virtual-abbreviate 'full
- ivy-rich-switch-buffer-align-virtual-buffer t)
- (ivy-rich-mode 1))
-
- (use-package ivy-bibtex
- :after ivy
- :ensure t
- :defer t)
- (use-package counsel
- :ensure t
- :demand t
- :general
- ("M-x" 'counsel-M-x)
- (wiz-org-def
- "c" 'counsel-org-capture)
- (wiz-file-def
- "f" 'counsel-find-file))
-
- (use-package counsel-tramp
- :after counsel
- :ensure t)
-
- (use-package counsel-projectile
- :after counsel
- :ensure t)
-
- #+END_SRC
- *** Code completion
- [[https://company-mode.github.io/][company]] comlpetes anything in the buffer
-
- #+BEGIN_SRC emacs-lisp
- (use-package company
- :ensure t
- :hook (after-init . global-company-mode)
- :general
- (:keymaps 'company-active-map
- "C-SPC" 'company-abort)
- :config
- (setq company-maximum-prefix-length 3
- company-idle-delay 0.2))
-
- ;; Documentation popups with company, works best with gui
- (when window-system
- (use-package company-quickhelp
- :ensure t
- :after company
- :hook (company-mode . company-quickhelp-mode)))
- #+END_SRC
- ** Snippets
- Powered by Yasnippet
-
- Note that the =yasnippet-snippets= file may need to be manually
- installed.
- #+BEGIN_SRC emacs-lisp
- (use-package yasnippet
- :ensure t
- ;; :hook ((tex-mode . yas-minor-mode)
- ;; (php-mode . yas-minor-mode)
- ;; (python-mode . yas-minor-mode)
- ;; (emacs-lisp-mode . yas-minor-mode)
- ;; (c-mode . yas-minor-mode)
- ;; (c++-mode . yas-minor-mode)
- ;; (org-mode . yas.minor-mode)))
- :init
- (yas-global-mode))
-
- (use-package yasnippet-snippets
- :pin melpa
- :after yasnippet
- :config
- (yas-reload-all))
- #+END_SRC
- ** Text searching
- *** deadgrep
- [[https://github.com/Wilfred/deadgrep][deadgrep]] provides a frontend to ripgrep
- #+BEGIN_SRC emacs-lisp
- (use-package deadgrep
- :ensure t
- :general
- (wiz-misc-def
- "d" 'deadgrep))
- #+END_SRC
- *** avy
- use =ga= and =gA= to hint letters n stuff.
- #+BEGIN_SRC emacs-lisp
- (use-package avy
- :ensure t
- :general
- (:states 'normal
- "ga" 'avy-goto-char-in-line
- "gA" 'avy-goto-char))
-
- (use-package link-hint
- :ensure t
- ;; :after avy
- :general
- (wiz-misc-def
- "l" 'link-hint-open-link
- "L" 'link-hint-copy-link))
- #+END_SRC
- ** org-mode
- *** Master org package
- Keep org-mode up to date straight from the cow's utters.
- If the manual is not on your computer, it's [[https://orgmode.org/manual/][here]].
- #+BEGIN_SRC emacs-lisp
- (use-package org
- :ensure t
- :ensure org-plus-contrib
- :pin org
- :general
- (wiz-major-def
- :keymaps 'org-capture-mode-map
- "c" 'org-capture-finalize
- "w" 'org-capture-refile
- "k" 'org-capture-kill)
- (wiz-major-def
- :keymaps 'org-mode-map
- "e" 'org-export-dispatch)
- (wiz-org-def
- "a" 'org-agenda
- "l" 'org-store-link
- "b" 'org-switch))
-
- (use-package org-contacts
- :ensure nil
- :after org
- :custom (org-contacts-files '("~/Documents/org/contacts.org")))
- #+END_SRC
- *** Pretty bullets
- Make bullets look choice
- #+BEGIN_SRC emacs-lisp
- (use-package org-bullets
- :ensure t
- :hook (org-mode . org-bullets-mode))
- #+END_SRC
- *** org-download
- For [[https://github.com/abo-abo/org-download][drag n drop]] images n stuff
- # #+BEGIN_SRC emacs-lisp
- # (use-package org-download
- # :after org
- # :pin melpa
- # :ensure t
- # :hook (dired-mode . org-download-enable))
- # #+END_SRC
- ** Startup splash screen
- Show a custom buffer on startup
- #+BEGIN_SRC emacs-lisp
- (use-package dashboard
- :ensure t
- :config
- (dashboard-setup-startup-hook)
- (setq dashboard-banner-logo-title "Electronic Macs")
- (setq dashboard-startup-banner wiz-startpic)
- (setq dashboard-items '((recents . 5)
- (agenda)
- (projects . 5)
- (bookmarks . 5)
- (registers . 5))))
- #+END_SRC
-
- ** Tags
- make tag files.
- #+BEGIN_SRC emacs-lisp
- (use-package ggtags
- :ensure t)
- #+END_SRC
-
- *** TODO: Make tag files do stuff
- ** Project Management
- TODO: Set this up to actually work well
- #+BEGIN_SRC emacs-lisp
- (use-package projectile
- :ensure t
- :diminish
- :general
- (wiz-leader-def
- "p" '(:keymap projectile-command-map)))
- #+END_SRC
- *** [[https://ox-hugo.scripter.co/][ox-hugo]]
- Allows me to write blog entries
-
- See [[https://ox-hugo.scripter.co/doc/auto-export-on-saving/][Here]] for auto export instructions
- #+BEGIN_SRC emacs-lisp
- (use-package ox-hugo
- :ensure t
- :after ox)
- #+END_SRC
- ** pretty-mode
- [[https://github.com/pretty-mode/pretty-mode][Redisplay parts of the Emacs buffer as pretty symbols.]]
- #+BEGIN_SRC emacs-lisp
- (when window-system
- (use-package pretty-mode
- :ensure t
- :config
- (global-pretty-mode t)))
- #+END_SRC
- ** Error checking
- #+BEGIN_SRC emacs-lisp
- (use-package flycheck
- :ensure t
- :defer t)
- #+END_SRC
- ** Programming language specific stuff
- *** C / C++
- **** Completion
- Irony handles enhanced C / C++ operations powered by clang
- #+BEGIN_SRC emacs-lisp
- (use-package irony
- :ensure t
- :defer t
- :hook ((c++-mode . irony-mode)
- (c-mode . irony-mode)
- (irony-mode . irony-cdb-autosetup-compile-options)))
-
- (use-package company-irony
- :after (company, irony)
- :ensure t
- :config
- (add-to-list 'company-backends 'company-irony))
- #+END_SRC
- *** Python
- **** TODO jedi for autocompletion sources n stuff
- #+BEGIN_SRC emacs-lisp
- (use-package company-jedi
- :ensure t
- :defer t
- :init
- (defun wiz-python-company-mode-hook ()
- (add-to-list 'company-backends 'company-jedi))
- (add-hook 'python-mode-hook 'wiz-python-company-mode-hook)
- (setq python-environment-virtualenv '("virtualenv" "--system-site-packages" "--quiet"))
- (setq jedi:environment-root "jedi") ; or any other name you like
- (setq jedi:environment-virtualenv
- (append python-environment-virtualenv
- '("--python" "/usr/bin/python3"))))
- #+END_SRC
- *** Web Development
- **** Web mode
- Should give everything you need for a web-dev major mode, except for
- company integration.
-
- This might also provide a decent php-mode, but that might require some
- testing.
- #+BEGIN_SRC emacs-lisp
- (use-package web-mode
- :pin melpa
- :ensure t
- :defer t
- :hook (web-mode . company-mode)
- :init
- (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.eex\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
- (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
- :config
- (setq web-mode-markup-indent-offset 2))
-
- #+END_SRC
- **** Web mode completion
- Web-mode completion
- #+BEGIN_SRC emacs-lisp
- (use-package company-web
- :ensure t
- :hook (web-mode . (lambda ()
- (add-to-list 'company-backends 'company-web-html)
- (add-to-list 'company-backends 'company-web-jade)
- (add-to-list 'company-backends 'company-web-slim))))
- #+END_SRC
- **** JSON
- Just an enhanced json mode
- #+BEGIN_SRC emacs-lisp
- (use-package json-mode
- :ensure t
- :mode (("\\.json\\'" . json-mode)
- ("\\manifest.webapp\\'" . json-mode )
- ("\\.tern-project\\'" . json-mode)))
- #+END_SRC
- **** PHP
- Should (at least) include all standard function sources for company in
- addition to some other niceties. See more on their [[https://github.com/arnested/php-extras][GitHub page]].
- #+BEGIN_SRC emacs-lisp
- (use-package php-extras
- :pin marmalade
- :defer t
- :ensure t
- :hook (php-mode . web-mode))
- #+END_SRC
- **** sass
- #+BEGIN_SRC emacs-lisp
- (use-package sass-mode
- :pin melpa
- :ensure t)
- #+END_SRC
- **** request
- Send web requests in emacs
- #+BEGIN_SRC emacs-lisp
- (use-package request
- :pin melpa
- :ensure t)
- #+END_SRC
- *** LaTeX
- **** Completion
- #+BEGIN_SRC emacs-lisp
- (use-package company-auctex
- :ensure t)
- (use-package company-bibtex
- :ensure t
- :config
- (add-to-list 'company-backends 'company-bibtex))
- #+END_SRC
- *** Shell
- Show completions for shell mode buffers
- #+BEGIN_SRC emacs-lisp
- (use-package readline-complete
- :ensure t)
- #+END_SRC
-
- *** Music stuff
- **** Supercollider
- #+BEGIN_SRC emacs-lisp
- (use-package sclang-snippets
- :ensure t)
- #+END_SRC
- *** OS DSL
- **** Arch Linux PKGBUILD
- #+BEGIN_SRC emacs-lisp
- (use-package pkgbuild-mode
- :ensure t)
- #+END_SRC
- **** Nix
- #+BEGIN_SRC emacs-lisp
- (use-package nix-mode
- :ensure t)
- #+END_SRC
- **** Puppet
- #+BEGIN_SRC emacs-lisp
- (use-package puppet-mode
- :pin melpa
- :ensure t)
- #+END_SRC
-
- #+RESULTS:
-
- *** Lisp
- **** Scheme
- #+BEGIN_SRC emacs-lisp
- (use-package geiser
- :ensure t
- :config
- (setq geiser-active-implementations '(guile)))
- #+END_SRC
-
- ** IRC
- Internet relay chat. It's where hackers go to communicate. Think of it
- like two boats in a shipping channel.
- #+BEGIN_SRC emacs-lisp
- ;; keep ERC up to date
- (use-package erc
- :ensure t
- :defer t
- :general
- (wiz-major-def
- :keymaps 'erc-mode
- "b" 'erc-iswitchb
- "c" 'erc-toggle-interpret-controls
- "d" 'erc-input-action
- "e" 'erc-toggle-ctcp-autoresponse
- "f" 'erc-toggle-flood-control
- "TAB" 'erc-invite-only-mode
- "j" 'erc-join-channel
- "k" 'erc-go-to-log-matches-buffer
- "l" 'erc-save-buffer-in-logs
- "n" 'erc-channel-names
- "o" 'erc-get-channel-names-from-keypress
- "p" 'erc-part-from-channel
- "q" 'erc-quit-from-server
- "r" 'erc-remove-text-properties-region
- "t" 'erc-set-topic
- "u" 'erc-kill-input)
- :init
- (defun wiz-irc-init ()
- "Access the encrypted file storing all of your irc connection
- information. It automatically connects you to a default set of
- servers."
- (interactive)
- (if (file-exists-p
- (concat user-emacs-directory "irc-servers.el.gpg"))
- (load-file (concat user-emacs-directory "irc-servers.el.gpg"))))
- ;; Load the file containing all of my server connection info
- :config
- ;; Enable the modules I want
- (setq erc-modules '(autojoin
- completion
- dcc
- button
- fill
- match
- netsplit
- ring
- list
- log
- readonly
- noncommands
- networks
- move-to-prompt
- notifications
- track
- irccontrols
- move-to-prompt
- menu
- stamp))
-
- ;; spellchecking :D
- (erc-spelling-mode 1)
- ;; Use my auth-sources pl0x
- (setq erc-prompt-for-nickserv-password nil
- erc-prompt-for-password nil)
- ;; List of places to look for IRC connection info
- ;; irc-servers.el.gpg should now hold most of this information.
- (setq auth-sources `("~/.authinfo.gpg"
- ,(concat user-emacs-directory ".authinfo.gpg")))
- ;; Append this if name is in use
- (setq erc-nick-uniquifier "^")
- ;; De-clutter my shiznit
- (setq erc-lurker-hide-list '("JOIN" "PART" "QUIT"))
- (setq erc-lurker-threshold-time 600)
-
- ;; Name buffers something logical
- (setq erc-rename-buffers t)
- ;; Interpret mIRC-style color commands in IRC chats
- (setq erc-interpret-mirc-color t)'
- ;; Don't focus buffer on connect
- (setq erc-join-buffer 'bury)
-
- ;; Change fill to emacs buffer width
- ;; It's a bit buggy, so cuidado, eh?
- ;; Commented because of how bug this is
- ;; (make-variable-buffer-local 'erc-fill-column)
- ;; (add-hook 'window-configuration-change-hook
- ;; '(lambda ()
- ;; (save-excursion
- ;; (walk-windows
- ;; (lambda (w)
- ;; (let ((buffer (window-buffer w)))
- ;; (set-buffer buffer)
- ;; (when (eq major-mode 'erc-mode)
- ;; (setq erc-fill-column (- (window-width w) 2)))))))))
-
- (setq erc-prompt (lambda () (concat "[" (buffer-name) "]")))
-
- ;; (defun wiz-erc-mode-hook ()
- ;; (setq erc-fill-column 92))
- (setq erc-fill-column 92)
-
- ;; (add-hook 'erc-mode-hook 'wiz-erc-mode-hook)
- (setq erc-button-url-regexp
- "\\([-a-zA-Z0-9_=!?#$@~`%&*+\\/:;,]+\\.\\)+[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;,]*[-a-zA-Z0-9\\/]")
-
- (setq erc-fill-static-center 15
- erc-fill-function 'erc-fill-static
- ;; Logging
- erc-log-insert-log-on-open nil
- erc-log-channels t
- erc-log-channels-directory "~/.irclogs/"
- erc-save-buffer-on-part t
- erc-hide-timestamps nil)
- :config
- (erc-update-modules))
-
- ;; highlight nicks
- (use-package erc-hl-nicks
- :after erc
- :ensure t
- :defer t
- :init
- (add-to-list 'erc-modules 'hl-nicks)
- :config
- (erc-update-modules))
-
- ;; Display images as links in a channel
- ;; (use-package erc-image
- ;; :after erc
- ;; :ensure t
- ;; :defer t
- ;; :init
- ;; (add-to-list 'erc-modules 'image)
- ;; :config
- ;; (erc-update-modules))
-
- ;; (use-package ercn
- ;; :pin melpa
- ;; :after erc
- ;; :ensure t
- ;; :init
- ;; ;; todo config this lol
- ;; (defun do-notify nickname message ())
- ;; :config
- ;; (setq ercn-notify-rules
- ;; '((current-nick . all)
- ;; (keyword . all)
- ;; ;; (pal . ("#emacs"))
- ;; (pal . all)
- ;; (query-buffer . all))))
-
- (use-package erc-status-sidebar
- :after erc
- :ensure t)
- #+END_SRC
- ** Ledger
- #+BEGIN_SRC emacs-lisp
- (use-package ledger-mode
- :ensure t
- :init
- (setq ledger-clear-whole-transactions 1)
- :config
- (add-to-list 'evil-emacs-state-modes 'ledger-report-mode)
- ;; remove evil mode from ledger reports
- :mode ("\\.dat\\'"
- "\\.ledger\\'")
- ;; :general
- ;; (wiz-file-def
- ;; :keymap 'ledger-mode-map
- ;; "w" 'wiz-ledger-save)
- :preface
- (defun wiz-ledger-save ()
- "Automatically clean the ledger buffer at each save."
- (interactive)
- (save-excursion
- (when (buffer-modified-p)
- (with-demoted-errors (ledger-mode-clean-buffer))
- (save-buffer)))))
- #+END_SRC
- ** pass
- I use [[https://www.passwordstore.org/][=pass=]] for my password management.
- #+BEGIN_SRC emacs-lisp
- (use-package ivy-pass
- :ensure t
- :general
- (wiz-leader-def
- "P" 'ivy-pass))
- #+END_SRC
- ** Git (magit)
- I hear that this is one of those emacs "killer apps"
-
- See keybindings [[https://github.com/emacs-evil/evil-magit][here.]]
- #+BEGIN_SRC emacs-lisp
- (use-package magit
- :ensure t
- :general
- (wiz-leader-def
- "g" 'magit))
-
- (use-package evil-magit
- :after (magit evil evil-collection)
- :ensure t)
- #+END_SRC
- ** Docker
- Enables usage of docker from within emacs, and supports dockerfiles
- #+BEGIN_SRC emacs-lisp
- (use-package docker
- :ensure t)
- (use-package dockerfile-mode
- :ensure t
- :pin melpa)
- (use-package docker-compose-mode
- :ensure t
- :pin melpa)
- (use-package docker-tramp
- :ensure t)
- #+END_SRC
-
- ** Themes
- #+BEGIN_SRC emacs-lisp
- (use-package base16
- :ensure t
- :init
- (load-theme 'base16-black-metal-mayhem))
- #+END_SRC
- * Final Touches
- Display a [[https://xkcd.com/37/][sick ass-message]] on the desktop to verify that dbus is good
- and all is well in the wold
- #+BEGIN_SRC emacs-lisp
- (notifications-notify :title "Emacs"
- :body "Fully loaded & operational!")
- (message "Emacs done initializing.")
- #+END_SRC
|