38 KiB
- General Emacs Configuration
- Load some libraries
- Helper Functions
- Customize file
- Startup image
- Notifications
- De-clutter
- Show parenthesis
- electric pairs (DISABLED in favor of smartparens)
- Show columns
- Fonts
- Transparency
- Backup files
- Scrolling
- Shut up Emacs
- Show line numbers
- y or n prompts
- Customize the terminal
- Prettify symbols
- Tabs are spaces?!
- org-mode
- set browser
- Buffers
- Refresh theme on the fly
- tramp
- Flyspell
- calc
- Package Repo Config
- Package Configuration
- Final Touches
General Emacs Configuration
Load some libraries
Like notifications
(load-library "notifications")
(notifications-notify :title "Emacs"
:body "Electronic Macros loading...")
(message "Emacs initializing...")
and sclang, if avaliable
(add-to-list 'load-path "/usr/local/bin/sclang")
(require 'sclang)
Helper Functions
(defun wiz-kill-all-buffers ()
(interactive)
(mapc 'kill-buffer (buffer-list)))
(defun wiz-kill-curr-buffer ()
(interactive)
(kill-buffer (current-buffer)))
Customize file
Makes it so the customize data isn't schlunked in my init.el
(setq custom-file (concat user-emacs-directory "_customize.el"))
(load custom-file t)
Startup image
Add a fun image to the emacs startup screen The variable is used below in Dashboard
(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."))
Notifications
Enable make some tweaks
(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")))
De-clutter
Disable the useless cruft at the top of the screen
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode -1)
Show parenthesis
Shows matching parenthesis
(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)
electric pairs (DISABLED in favor of smartparens)
When you open a code block, close that block.
Show columns
(column-number-mode t)
Fonts
Set the font to something cool
;; (set-default-font "Go Mono-11")
(add-to-list 'default-frame-alist
'(font . "Go Mono-11")
'(font . "Noto Sans Mono CJK JP-11"))
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.
(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))
Backup files
Edit backup files properties https://www.emacswiki.org/emacs/BackupDirectory
(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)
Scrolling
(setq scroll-conservatively 100) ;; don't scroll a metric boatload when bottom is hit
Shut up Emacs
(setq ring-bell-function 'ignore) ;;emacs stfu
Show line numbers
Enable lines when editing files
(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)))
y or n prompts
(defalias 'yes-or-no-p 'y-or-n-p) ;; make yes or no prompts ask for y or n
Customize the terminal
(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)
Prettify symbols
+=|====> = CoolSword
(add-to-list 'prettify-symbols-alist '("+=|====>" 🗡️))
(global-prettify-symbols-mode 1)
Tabs are spaces?!
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
org-mode
General org settings
Auto-indent org files nicely
(add-hook 'org-mode-hook 'org-indent-mode)
Highlight syntax in source blocks
(setq org-src-fontify-natively t)
Capture Templates
Set the org mode directory and define some capture templates
(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"))))
Org templates
<el expands to emacs lisp code block
(setq org-src-window-setup 'current-window)
(add-to-list 'org-structure-template-alist
'("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
Autocomplete todo entries
(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)
export settings
use latexmk
(setq org-latex-to-pdf-process (list "latexmk -f -pdf %f"))
Keep diary
(setq org-agenda-include-diary nil)
(setq org-default-notes-file "notes.org")
set browser
Default browser should be firefox
(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)
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.
(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)))
scratch buffer
(defun wiz-scratch-buffer nil
"create a scratch buffer"
(interactive)
(switch-to-buffer (get-buffer-create "*scratch*"))
(lisp-interaction-mode))
TODO Refresh theme on the fly
Use wal and file notifications to load a theme on the fly, courtesy of this pull request.
Note: this requires base16-themes
(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)
TODO Move this to the base16 config
tramp
(setq tramp-default-method "ssh")
Flyspell
Enable a spellchecker
(add-hook 'org-mode-hook 'flyspell-mode)
calc
;; (add-to-list 'evil-emacs-state-modes 'calc-mode)
Package Repo Config
Repo Location
Let's start by configuring the repositories
(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)
use-package
use-package for installing packages https://github.com/jwiegley/use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
Package Configuration
Keybind-related packages
Show key binds
Pops up a screen that helps you navigate and complete commands
(use-package which-key
:ensure t
:diminish
:init
(which-key-mode))
General
General binds keys in a more sane way, and it integrates with
use-package
(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"))))
A few binds
h - help
(wiz-help-def
"?" 'help-for-help
"k" 'counsel-descbinds
"f" 'counsel-describe-function
"v" 'counsel-describe-variable
"a" 'counsel-apropos
"h" 'help-for-help)
b - buffer
(wiz-buffer-def
"b" 'ibuffer
"S" 'wiz-scratch-buffer
"c" 'wiz-kill-curr-buffer
"C" 'wiz-kill-all-buffers)
f - file
(wiz-file-def
"w" 'save-buffer)
hit e
to do that.
(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)
l - misc
(wiz-misc-def
:keymaps 'override
:states 'normal
:prefix "SPC l")
w - window
;; (wiz-window-def
;; :keymaps 'override
;; :states 'normal
;; :prefix "SPC w")
(wiz-window-def
"o" 'delete-other-windows)
ibuffer
(general-define-key
:keymaps 'override
"C-x b" 'ibuffer)
Terminal
(wiz-leader-def
"RET" 'eshell)
Dired
(wiz-file-def
"d" 'dired)
sclang-mode
;; (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)
Vim bindings
Let's get some vim up in here.
evil
Evil is pretty much the entirety of Vim in Emacs.
/wizard/emacs.d/src/branch/master/evil-collection provides evil in many different modes.
/wizard/emacs.d/src/branch/master/evil-org adds nice bindings to org-mode.
(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))
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>
.
(use-package evil-surround
:after evil
:ensure t
:diminish
:config
(global-evil-surround-mode 1))
evil-escape
hit fd to escape pretty much everything
(use-package evil-escape
:ensure t
:diminish
:config
(setq-default evil-escape-key-sequence "fd")
(evil-escape-mode))
evil-commentary
github here Essentially:
gcc
comments out a linegc
comments out the target of a motion
(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)))
ex extras
(use-package evil-expat
:ensure t
:diminish)
Convenience
Automagic updates
Keep packages up to date
(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))
shift-number
Shifts the next number on the given line
(use-package shift-number
:ensure t
:general (:keymaps 'override
"M-+" 'shift-number-up
"M-_" 'shift-number-down))
hide minor modes on modeline
Diminish hides minor modes on the modeline.
(use-package diminish
:ensure t
:config
(diminish 'undo-tree-mode))
rainbow
Lights up color tokens / delimiters
(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))
Show cursor location (DISABLED)
When a window is changed / opened, the cursor's location is visibly pinged.
ranger file manager (DISABLED)
Let's not use this for now
w3m
(use-package w3m
:ensure t)
Autocompletion
Fuzzy matching
Ivy, swiper, and counsel all provide fuzzy-matching on different emacs operations.
(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)
Code completion
company comlpetes anything in the buffer
(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)))
Snippets
Powered by Yasnippet
Note that the yasnippet-snippets
file may need to be manually
installed.
(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))
Text searching
deadgrep
deadgrep provides a frontend to ripgrep
(use-package deadgrep
:ensure t
:general
(wiz-misc-def
"d" 'deadgrep))
avy
use ga
and gA
to hint letters n stuff.
(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))
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 here.
(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")))
Pretty bullets
Make bullets look choice
(use-package org-bullets
:ensure t
:hook (org-mode . org-bullets-mode))
org-download
For drag n drop images n stuff
Startup splash screen
Show a custom buffer on startup
(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))))
Tags
make tag files.
(use-package ggtags
:ensure t)
TODO: Make tag files do stuff
Project Management
pretty-mode
Redisplay parts of the Emacs buffer as pretty symbols.
(when window-system
(use-package pretty-mode
:ensure t
:config
(global-pretty-mode t)))
Error checking
(use-package flycheck
:ensure t
:defer t)
Programming language specific stuff
C / C++
Completion
Irony handles enhanced C / C++ operations powered by clang
(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))
Python
TODO jedi for autocompletion sources n stuff
(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"))))
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.
(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))
Web mode completion
Web-mode completion
(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))))
JSON
Just an enhanced json mode
(use-package json-mode
:ensure t
:mode (("\\.json\\'" . json-mode)
("\\manifest.webapp\\'" . json-mode )
("\\.tern-project\\'" . json-mode)))
PHP
Should (at least) include all standard function sources for company in addition to some other niceties. See more on their GitHub page.
(use-package php-extras
:pin marmalade
:defer t
:ensure t
:hook (php-mode . web-mode))
sass
(use-package sass-mode
:pin melpa
:ensure t)
request
Send web requests in emacs
(use-package request
:pin melpa
:ensure t)
LaTeX
Completion
(use-package company-auctex
:ensure t)
(use-package company-bibtex
:ensure t
:config
(add-to-list 'company-backends 'company-bibtex))
Shell
Show completions for shell mode buffers
(use-package readline-complete
:ensure t)
Music stuff
Supercollider
(use-package sclang-snippets
:ensure t)
OS DSL
Arch Linux PKGBUILD
(use-package pkgbuild-mode
:ensure t)
Nix
(use-package nix-mode
:ensure t)
Puppet
(use-package puppet-mode
:pin melpa
:ensure t)
Lisp
Scheme
(use-package geiser
:ensure t
:config
(setq geiser-active-implementations '(guile)))
IRC
Internet relay chat. It's where hackers go to communicate. Think of it like two boats in a shipping channel.
;; 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)
Ledger
(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)))))
pass
I use pass
for my password management.
(use-package ivy-pass
:ensure t
:general
(wiz-leader-def
"P" 'ivy-pass))
Git (magit)
I hear that this is one of those emacs "killer apps"
See keybindings here.
(use-package magit
:ensure t
:general
(wiz-leader-def
"g" 'magit))
(use-package evil-magit
:after (magit evil evil-collection)
:ensure t)
Docker
Enables usage of docker from within emacs, and supports dockerfiles
(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)
Themes
(use-package base16
:ensure t
:init
(load-theme 'base16-black-metal-mayhem))
Final Touches
Display a sick ass-message on the desktop to verify that dbus is good and all is well in the wold
(notifications-notify :title "Emacs"
:body "Fully loaded & operational!")
(message "Emacs done initializing.")