├── .gitignore ├── Readme.org ├── bookmarks ├── init.el ├── mu4econfig-sample.el ├── myinit.org ├── samples ├── python │ └── test.py └── reveal │ ├── present.html │ └── present.org └── snippets ├── org-mode └── post ├── python-mode └── flask └── web-mode └── vue /.gitignore: -------------------------------------------------------------------------------- 1 | elpa 2 | auto-save-list 3 | *~ 4 | \#* 5 | -------------------------------------------------------------------------------- /Readme.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: showall hidestars 2 | 3 | For a list of all posts and videos check out http://cestlaz.github.io/stories/emacs 4 | 5 | -------------------------------------------------------------------------------- /bookmarks: -------------------------------------------------------------------------------- 1 | ;;;; Emacs Bookmark Format Version 1 ;;;; -*- coding: utf-8-emacs -*- 2 | ;;; This format is meant to be slightly human-readable; 3 | ;;; nevertheless, you probably don't want to edit it. 4 | ;;; -*- End Of Bookmark File Format Version Stamp -*- 5 | (("org-refile-last-stored" 6 | (filename . "~/Dropbox/orgfiles/admissions.org") 7 | (front-context-string . "** Need to evalu") 8 | (rear-context-string . "hi, Xing Tao]]\n\n") 9 | (position . 10749)) 10 | ("org-capture-last-stored" 11 | (filename . "~/Sync/orgfiles/i.org") 12 | (front-context-string . "** TODO [[mu4e:m") 13 | (rear-context-string . "o Do and Notes \n") 14 | (position . 137)) 15 | ("elfeed-unread" 16 | (location . "@6-months-ago +unread") 17 | (tags "unread") 18 | (handler . elfeed-search-bookmark-handler)) 19 | ("elfeed-starred" 20 | (location . "@1-day-ago +star") 21 | (tags "star") 22 | (handler . elfeed-search-bookmark-handler)) 23 | ("elfeed-education" 24 | (location . "@6-months-ago +education") 25 | (tags 26 | #("education" 0 9 27 | (fontified nil face 28 | (org-tag org-level-2) 29 | mouse-face highlight keymap 30 | (keymap 31 | (follow-link . mouse-face) 32 | (mouse-3 . org-find-file-at-mouse) 33 | (mouse-2 . org-open-at-mouse))))) 34 | (handler . elfeed-search-bookmark-handler)) 35 | ("elfeed-all" 36 | (location . "@6-months-ago") 37 | (tags) 38 | (handler . elfeed-search-bookmark-handler)) 39 | ("elfeed-daily" 40 | (location . "@1-day-ago") 41 | (tags) 42 | (handler . elfeed-search-bookmark-handler)) 43 | ) -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | 2 | (setq max-lisp-eval-depth 10000) 3 | (setq max-specpdl-size 10000) 4 | (require 'package) 5 | 6 | (setq package-enable-at-startup nil) 7 | (add-to-list 'package-archives 8 | '("melpa" . "https://melpa.org/packages/")) 9 | (add-to-list 'package-archives 10 | '("gnu" . "https://elpa.gnu.org/packages/")) 11 | ;; (add-to-list 'package-archives 12 | ;; '("melpa3" . "http://www.mirrorservice.org/sites/stable.melpa.org/packages/")) 13 | (package-initialize) 14 | 15 | ;; Bootstrap `use-package' 16 | (unless (package-installed-p 'use-package) 17 | (package-refresh-contents) 18 | (package-install 'use-package)) 19 | 20 | 21 | 22 | (org-babel-load-file (expand-file-name "~/.emacs.d/myinit.org")) 23 | (custom-set-variables 24 | ;; custom-set-variables was added by Custom. 25 | ;; If you edit it by hand, you could mess it up, so be careful. 26 | ;; Your init file should contain only one such instance. 27 | ;; If there is more than one, they won't work right. 28 | '(all-the-icons-ivy-buffer-commands '(ivy-switch-buffer-other-window ivy-switch-buffer)) 29 | '(elpy-rpc-backend "jedi" t) 30 | '(hydra-hint-display-type 'posframe) 31 | '(org-confirm-babel-evaluate nil) 32 | '(org-default-notes-file (concat org-directory "/notes.org")) 33 | '(org-directory "~/Sync/orgfiles") 34 | '(org-export-html-postamble nil) 35 | '(org-hide-leading-stars t) 36 | '(org-src-fontify-natively t) 37 | '(org-startup-folded 'overview) 38 | '(org-startup-indented t) 39 | '(package-selected-packages 40 | '(flycheck-pos-tip flycheck-clojure ox-reveal posframe processing-snippets processing-mode rg deadgrep flycheck-rust cargo racer yasnippet-classic-snippets rustic lsp-rust lsp-java company-lsp lsp-ui lsp-mode lsp yasnippet-snippets counsel-spotify exec-path-from-shell easy-kill auto-yasnippet org-pdfview pdf-tools atomic-chrome mingus simple-mpc pcre2el ag wgrep-ag wgrep haskell-mode aggressive-indent treemacs-projectile treemacs prodigy origami dumb-jump cider ggtags circe-notifications circe org-gcal mu4e-alert git-timemachine git-gutter magit hydra default-text-scale smartparens projectile auctex tern-auto-complete tern js2-refactor ac-js2 js2-mode emmet-mode web-mode iedit expand-region multiple-cursors hungry-delete beacon undo-tree virtualenvwrapper elpy flycheck doom-modeline doom-themes tao-theme poet-theme faff-theme zerodark-theme alect-themes moe-theme base16-theme zenburn-theme color-theme-modern company-jedi irony-eldoc company-irony company counsel ace-window htmlize noflet org-bullets which-key try use-package)) 41 | '(sp-escape-quotes-after-insert nil)) 42 | (setq max-lisp-eval-depth 10000) 43 | (setq max-specpdl-size 10000) 44 | (require 'package) 45 | 46 | (setq package-enable-at-startup nil) 47 | (add-to-list 'package-archives 48 | '("melpa" . "https://melpa.org/packages/")) 49 | (add-to-list 'package-archives 50 | '("gnu" . "https://elpa.gnu.org/packages/")) 51 | ;; (add-to-list 'package-archives 52 | ;; '("melpa3" . "http://www.mirrorservice.org/sites/stable.melpa.org/packages/")) 53 | (package-initialize) 54 | 55 | ;; Bootstrap `use-package' 56 | (unless (package-installed-p 'use-package) 57 | (package-refresh-contents) 58 | (package-install 'use-package)) 59 | 60 | 61 | 62 | (org-babel-load-file (expand-file-name "~/.emacs.d/myinit.org")) 63 | 64 | (custom-set-faces 65 | ;; custom-set-faces was added by Custom. 66 | ;; If you edit it by hand, you could mess it up, so be careful. 67 | ;; Your init file should contain only one such instance. 68 | ;; If there is more than one, they won't work right. 69 | '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 3.0))))) 70 | (put 'dired-find-alternate-file 'disabled nil) 71 | (put 'dired-find-alternate-file 'disabled nil) 72 | -------------------------------------------------------------------------------- /mu4econfig-sample.el: -------------------------------------------------------------------------------- 1 | (add-to-list 'load-path "/home/zamansky/Dropbox/opt/mu/mu4e") 2 | 3 | 4 | (require 'mu4e) 5 | 6 | (require 'smtpmail) 7 | 8 | 9 | (setq 10 | message-send-mail-function 'smtpmail-send-it 11 | starttls-use-gnutls t 12 | mu4e-sent-messages-behavior 'sent 13 | mu4e-sent-folder "/hunter/Sent Items" 14 | mu4e-drafts-folder "/hunter/Drafts" 15 | user-mail-address "mz631@hunter.cuny.edu" 16 | user-full-name "Mike Zamansky" 17 | smtpmail-default-smtp-server "mail.hunter.cuny.edu" 18 | smtpmail-local-domain "hunter.cuny.edu" 19 | smtpmail-smtp-user "mz631" 20 | smtpmail-smtp-server "mail.hunter.cuny.edu" 21 | smtpmail-stream-type 'starttls 22 | smtpmail-smtp-service 587) 23 | 24 | (setq mu4e-maildir "~/Maildir" 25 | mu4e-trash-folder "/Trash" 26 | mu4e-refile-folder "/Archive" 27 | mu4e-get-mail-command "mbsync -a" 28 | mu4e-update-interval 300 ;; second 29 | mu4e-compose-signature-auto-include nil 30 | mu4e-view-show-images t 31 | mu4e-view-show-addresses t 32 | mu4e-attachment-dir "~/Downloads" 33 | mu4e-use-fancy-chars t 34 | ) 35 | 36 | 37 | 38 | 39 | 40 | ;;; Mail directory shortcuts 41 | (setq mu4e-maildir-shortcuts 42 | '( 43 | ("/hunter/INBOX" . ?h) 44 | ("/hunter/Archive" . ?H) 45 | ("/hunter/Sent Items" .?s) 46 | )) 47 | 48 | ;;; Bookmarks 49 | (setq mu4e-bookmarks 50 | `( 51 | ("flag:unread AND NOT flag:trashed" "Unread messages" ?u) 52 | ("flag:unread" "Unread messages" ?n) 53 | ("date:today..now" "Today's messages" ?t) 54 | ("date:7d..now" "Last 7 days" ?w) 55 | ("mime:image/*" "Messages with images" ?p) 56 | (,(mapconcat 'identity 57 | (mapcar 58 | (lambda (maildir) 59 | (concat "maildir:" (car maildir))) 60 | mu4e-maildir-shortcuts) " OR ") 61 | "All inboxes" ?i))) 62 | 63 | 64 | (require 'org-mu4e) 65 | (setq org-mu4e-convert-to-html t) 66 | 67 | (add-to-list 'load-path "/home/zamansky/Dropbox/opt/org-mode/contrib/lisp") 68 | (require 'org-mime) 69 | 70 | ;; this seems to fix the babel file saving thing 71 | (defun org~mu4e-mime-replace-images (str current-file) 72 | "Replace images in html files with cid links." 73 | (let (html-images) 74 | (cons 75 | (replace-regexp-in-string ;; replace images in html 76 | "src=\"\\([^\"]+\\)\"" 77 | (lambda (text) 78 | (format 79 | "src=\"./:%s\"" 80 | (let* ((url (and (string-match "src=\"\\([^\"]+\\)\"" text) 81 | (match-string 1 text))) 82 | (path (expand-file-name 83 | url (file-name-directory current-file))) 84 | (ext (file-name-extension path)) 85 | (id (replace-regexp-in-string "[\/\\\\]" "_" path))) 86 | (add-to-list 'html-images 87 | (org~mu4e-mime-file 88 | (concat "image/" ext) path id)) 89 | id))) 90 | str) 91 | html-images))) 92 | 93 | (add-to-list 'mu4e-view-actions 94 | '("ViewInBrowser" . mu4e-action-view-in-browser) t) 95 | 96 | 97 | 98 | 99 | (use-package mu4e-alert 100 | :ensure t) 101 | 102 | 103 | (mu4e-alert-set-default-style 'libnotify) 104 | (add-hook 'after-init-hook #'mu4e-alert-enable-notifications) 105 | (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display) 106 | 107 | 108 | 109 | 110 | ;;need this for hash access 111 | (require 'subr-x) 112 | 113 | 114 | ;; we seem to need this to fix the org-store-link issue 115 | (org-link-set-parameters "mu4e" :follow #'org-mu4e-open :store 116 | #'org-mu4e-store-link) 117 | 118 | 119 | ;; contact tweaks 120 | 121 | ;;(setq mu4e-compose-complete-only-after t) 122 | ;;(setq mu4e-compose-complete-only-personal t) 123 | 124 | -------------------------------------------------------------------------------- /myinit.org: -------------------------------------------------------------------------------- 1 | #+STARTUP: overview 2 | #+PROPERTY: header-args :comments yes :results silent 3 | * repos 4 | #+BEGIN_SRC emacs-lisp 5 | (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) 6 | #+END_SRC 7 | * interface tweaks 8 | #+BEGIN_SRC emacs-lisp 9 | (setq inhibit-startup-message t) 10 | (tool-bar-mode -1) 11 | (fset 'yes-or-no-p 'y-or-n-p) 12 | (global-set-key (kbd "") 'revert-buffer) 13 | #+END_SRC 14 | 15 | * try 16 | #+BEGIN_SRC emacs-lisp 17 | (use-package try 18 | :ensure t) 19 | #+END_SRC 20 | 21 | * posframe 22 | 23 | #+BEGIN_SRC emacs-lisp 24 | (use-package posframe :ensure t) 25 | #+END_SRC 26 | * which key 27 | Brings up some help 28 | #+BEGIN_SRC emacs-lisp 29 | (use-package which-key 30 | :ensure t 31 | :config 32 | (which-key-mode)) 33 | 34 | #+END_SRC 35 | 36 | * Org mode 37 | 38 | 39 | Org bullets makes things look pretty 40 | #+BEGIN_SRC emacs-lisp 41 | 42 | (use-package org 43 | :ensure t 44 | :pin org) 45 | 46 | (setenv "BROWSER" "firefox") 47 | (use-package org-bullets 48 | :ensure t 49 | :config 50 | (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) 51 | (custom-set-variables 52 | '(org-directory "~/Sync/orgfiles") 53 | '(org-default-notes-file (concat org-directory "/notes.org")) 54 | '(org-export-html-postamble nil) 55 | '(org-hide-leading-stars t) 56 | '(org-startup-folded (quote overview)) 57 | '(org-startup-indented t) 58 | '(org-confirm-babel-evaluate nil) 59 | '(org-src-fontify-natively t) 60 | ) 61 | 62 | (setq org-file-apps 63 | (append '( 64 | ("\\.pdf\\'" . "evince %s") 65 | ("\\.x?html?\\'" . "/usr/bin/firefox %s") 66 | ) org-file-apps )) 67 | 68 | (global-set-key "\C-ca" 'org-agenda) 69 | (setq org-agenda-start-on-weekday nil) 70 | (setq org-agenda-custom-commands 71 | '(("c" "Simple agenda view" 72 | ((agenda "") 73 | (alltodo ""))))) 74 | 75 | (global-set-key (kbd "C-c c") 'org-capture) 76 | 77 | (setq org-agenda-files (list "~/Sync/orgfiles/gcal.org" 78 | "~/Sync/orgfiles/soe-cal.org" 79 | "~/Sync/orgfiles/i.org" 80 | "~/Sync/orgfiles/schedule.org")) 81 | (setq org-capture-templates 82 | '(("a" "Appointment" entry (file "~/Sync/orgfiles/gcal.org" ) 83 | "* %?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n") 84 | ("l" "Link" entry (file+headline "~/Sync/orgfiles/links.org" "Links") 85 | "* %? %^L %^g \n%T" :prepend t) 86 | ("b" "Blog idea" entry (file+headline "~/Sync/orgfiles/i.org" "Blog Topics:") 87 | "* %?\n%T" :prepend t) 88 | ("t" "To Do Item" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") 89 | "* TODO %?\n%u" :prepend t) 90 | ("m" "Mail To Do" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") 91 | "* TODO %a\n %?" :prepend t) 92 | ("g" "GMail To Do" entry (file+headline "~/Sync/orgfiles/i.org" "To Do and Notes") 93 | "* TODO %^L\n %?" :prepend t) 94 | ("n" "Note" entry (file+headline "~/Sync/orgfiles/i.org" "Notes") 95 | "* %u %? " :prepend t) 96 | )) 97 | 98 | 99 | (defadvice org-capture-finalize 100 | (after delete-capture-frame activate) 101 | "Advise capture-finalize to close the frame" 102 | (if (equal "capture" (frame-parameter nil 'name)) 103 | (delete-frame))) 104 | 105 | (defadvice org-capture-destroy 106 | (after delete-capture-frame activate) 107 | "Advise capture-destroy to close the frame" 108 | (if (equal "capture" (frame-parameter nil 'name)) 109 | (delete-frame))) 110 | 111 | (use-package noflet 112 | :ensure t ) 113 | (defun make-capture-frame () 114 | "Create a new frame and run org-capture." 115 | (interactive) 116 | (make-frame '((name . "capture"))) 117 | (select-frame-by-name "capture") 118 | (delete-other-windows) 119 | (noflet ((switch-to-buffer-other-window (buf) (switch-to-buffer buf))) 120 | (org-capture))) 121 | ;; (require 'ox-beamer) 122 | ;; for inserting inactive dates 123 | (define-key org-mode-map (kbd "C-c >") (lambda () (interactive (org-time-stamp-inactive)))) 124 | 125 | (use-package htmlize :ensure t) 126 | 127 | (setq org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar") 128 | 129 | #+END_SRC 130 | 131 | #+RESULTS: 132 | : make-capture-frame 133 | 134 | * Ace windows for easy window switching 135 | #+BEGIN_SRC emacs-lisp 136 | (use-package ace-window 137 | :ensure t 138 | :init 139 | (progn 140 | (setq aw-scope 'global) ;; was frame 141 | (global-set-key (kbd "C-x O") 'other-frame) 142 | (global-set-key [remap other-window] 'ace-window) 143 | (custom-set-faces 144 | '(aw-leading-char-face 145 | ((t (:inherit ace-jump-face-foreground :height 3.0))))) 146 | )) 147 | #+END_SRC 148 | 149 | #+RESULTS: 150 | 151 | * Swiper / Ivy / Counsel 152 | Swiper gives us a really efficient incremental search with regular expressions 153 | and Ivy / Counsel replace a lot of ido or helms completion functionality 154 | #+BEGIN_SRC emacs-lisp 155 | 156 | 157 | 158 | 159 | (use-package counsel 160 | :ensure t 161 | :bind 162 | (("M-y" . counsel-yank-pop) 163 | :map ivy-minibuffer-map 164 | ("M-y" . ivy-next-line))) 165 | 166 | 167 | 168 | 169 | (use-package ivy 170 | :ensure t 171 | :diminish (ivy-mode) 172 | :bind (("C-x b" . ivy-switch-buffer)) 173 | :config 174 | (ivy-mode 1) 175 | (setq ivy-use-virtual-buffers t) 176 | (setq ivy-count-format "%d/%d ") 177 | (setq ivy-display-style 'fancy)) 178 | 179 | 180 | (use-package swiper 181 | :ensure t 182 | :bind (("C-s" . swiper-isearch) 183 | ("C-r" . swiper-isearch) 184 | ("C-c C-r" . ivy-resume) 185 | ("M-x" . counsel-M-x) 186 | ("C-x C-f" . counsel-find-file)) 187 | :config 188 | (progn 189 | (ivy-mode 1) 190 | (setq ivy-use-virtual-buffers t) 191 | (setq ivy-display-style 'fancy) 192 | (define-key read-expression-map (kbd "C-r") 'counsel-expression-history) 193 | )) 194 | #+END_SRC 195 | 196 | * Avy - navigate by searching for a letter on the screen and jumping to it 197 | See https://github.com/abo-abo/avy for more info 198 | #+BEGIN_SRC emacs-lisp 199 | (use-package avy 200 | :ensure t 201 | :bind ("M-s" . avy-goto-word-1)) ;; changed from char as per jcs 202 | #+END_SRC 203 | 204 | * Company 205 | #+BEGIN_SRC emacs-lisp 206 | (use-package company 207 | :ensure t 208 | :config 209 | (setq company-idle-delay 0) 210 | (setq company-minimum-prefix-length 3) 211 | 212 | (global-company-mode t) 213 | ) 214 | 215 | 216 | (defun my/python-mode-hook () 217 | (add-to-list 'company-backends 'company-jedi)) 218 | 219 | (add-hook 'python-mode-hook 'my/python-mode-hook) 220 | (use-package company-jedi 221 | :ensure t 222 | :config 223 | (add-hook 'python-mode-hook 'jedi:setup) 224 | ) 225 | 226 | (defun my/python-mode-hook () 227 | (add-to-list 'company-backends 'company-jedi)) 228 | 229 | (add-hook 'python-mode-hook 'my/python-mode-hook) 230 | 231 | ;; company box mode 232 | ;(use-package company-box 233 | ;:ensure t 234 | ; :hook (company-mode . company-box-mode)) 235 | 236 | 237 | #+END_SRC 238 | 239 | #+RESULTS: 240 | * C++ 241 | #+BEGIN_SRC emacs-lisp 242 | (use-package company-irony 243 | :ensure t 244 | :config 245 | (add-to-list 'company-backends 'company-irony) 246 | 247 | ) 248 | 249 | (use-package irony 250 | :ensure t 251 | :config 252 | (add-hook 'c++-mode-hook 'irony-mode) 253 | (add-hook 'c-mode-hook 'irony-mode) 254 | (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) 255 | ) 256 | 257 | (use-package irony-eldoc 258 | :ensure t 259 | :config 260 | (add-hook 'irony-mode-hook #'irony-eldoc)) 261 | 262 | 263 | #+END_SRC 264 | * Themes and modeline 265 | #+BEGIN_SRC emacs-lisp 266 | 267 | (use-package color-theme-modern 268 | :ensure t) 269 | (use-package zenburn-theme 270 | :ensure t 271 | 272 | ) 273 | 274 | (use-package base16-theme 275 | :ensure t 276 | ) 277 | (use-package moe-theme 278 | :ensure t) 279 | 280 | 281 | (use-package alect-themes 282 | :ensure t) 283 | 284 | (use-package zerodark-theme 285 | :ensure t) 286 | 287 | (use-package faff-theme 288 | :ensure t) 289 | (use-package poet-theme 290 | :ensure t) 291 | (use-package tao-theme 292 | :ensure t) 293 | (use-package doom-themes 294 | :ensure t) 295 | (use-package doom-modeline 296 | :ensure t) 297 | (require 'doom-modeline) 298 | (doom-modeline-init) 299 | ;(load-theme 'faff t) 300 | (load-theme 'faff t) 301 | #+END_SRC 302 | 303 | 304 | 305 | * Reveal.js 306 | #+BEGIN_SRC emacs-lisp :tangle no 307 | (use-package ox-reveal 308 | :ensure t 309 | :config 310 | (require 'ox-reveal) 311 | (setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/") 312 | (setq org-reveal-mathjax t) 313 | ) 314 | (use-package htmlize 315 | :ensure t) 316 | #+END_SRC 317 | 318 | #+RESULTS: 319 | : t 320 | 321 | * Flycheck 322 | #+BEGIN_SRC emacs-lisp 323 | (use-package flycheck 324 | :ensure t 325 | :init 326 | (global-flycheck-mode t)) 327 | 328 | #+END_SRC 329 | * Python 330 | #+BEGIN_SRC emacs-lisp 331 | 332 | (setq py-python-command "python3") 333 | (setq python-shell-interpreter "python3") 334 | 335 | 336 | (use-package elpy 337 | :ensure t 338 | :custom (elpy-rpc-backend "jedi") 339 | :config 340 | 341 | (elpy-enable) 342 | 343 | ) 344 | 345 | (use-package virtualenvwrapper 346 | :ensure t 347 | :config 348 | (venv-initialize-interactive-shells) 349 | (venv-initialize-eshell)) 350 | 351 | #+END_SRC 352 | 353 | #+RESULTS: 354 | : t 355 | 356 | * Yasnippet 357 | #+BEGIN_SRC emacs-lisp 358 | (use-package yasnippet 359 | :ensure t 360 | :init 361 | (yas-global-mode 1)) 362 | 363 | ; (use-package yasnippet-snippets 364 | ; :ensure t) 365 | #+END_SRC 366 | 367 | #+RESULTS: 368 | 369 | * Undo Tree 370 | #+BEGIN_SRC emacs-lisp :tangle no 371 | (use-package undo-tree 372 | :ensure t 373 | :init 374 | (global-undo-tree-mode)) 375 | #+END_SRC 376 | * Misc packages 377 | #+BEGIN_SRC emacs-lisp 378 | 379 | ; Highlights the current cursor line 380 | (global-hl-line-mode t) 381 | 382 | ; flashes the cursor's line when you scroll 383 | (use-package beacon 384 | :ensure t 385 | :config 386 | (beacon-mode 1) 387 | ; (setq beacon-color "#666600") 388 | ) 389 | 390 | ; deletes all the whitespace when you hit backspace or delete 391 | (use-package hungry-delete 392 | :ensure t 393 | :config 394 | (global-hungry-delete-mode)) 395 | 396 | 397 | (use-package multiple-cursors 398 | :ensure t) 399 | 400 | ; expand the marked region in semantic increments (negative prefix to reduce region) 401 | (use-package expand-region 402 | :ensure t 403 | :config 404 | (global-set-key (kbd "C-=") 'er/expand-region)) 405 | 406 | (setq save-interprogram-paste-before-kill t) 407 | 408 | 409 | (global-auto-revert-mode 1) ;; you might not want this 410 | (setq auto-revert-verbose nil) ;; or this 411 | (global-set-key (kbd "") 'revert-buffer) 412 | (global-set-key (kbd "") 'revert-buffer) 413 | 414 | 415 | 416 | #+END_SRC 417 | 418 | * iedit and narrow / widen dwim 419 | 420 | #+BEGIN_SRC emacs-lisp 421 | ; mark and edit all copies of the marked region simultaniously. 422 | (use-package iedit 423 | :ensure t) 424 | 425 | ; if you're windened, narrow to the region, if you're narrowed, widen 426 | ; bound to C-x n 427 | (defun narrow-or-widen-dwim (p) 428 | "If the buffer is narrowed, it widens. Otherwise, it narrows intelligently. 429 | Intelligently means: region, org-src-block, org-subtree, or defun, 430 | whichever applies first. 431 | Narrowing to org-src-block actually calls `org-edit-src-code'. 432 | 433 | With prefix P, don't widen, just narrow even if buffer is already 434 | narrowed." 435 | (interactive "P") 436 | (declare (interactive-only)) 437 | (cond ((and (buffer-narrowed-p) (not p)) (widen)) 438 | ((region-active-p) 439 | (narrow-to-region (region-beginning) (region-end))) 440 | ((derived-mode-p 'org-mode) 441 | ;; `org-edit-src-code' is not a real narrowing command. 442 | ;; Remove this first conditional if you don't want it. 443 | (cond ((ignore-errors (org-edit-src-code)) 444 | (delete-other-windows)) 445 | ((org-at-block-p) 446 | (org-narrow-to-block)) 447 | (t (org-narrow-to-subtree)))) 448 | (t (narrow-to-defun)))) 449 | 450 | ;; (define-key endless/toggle-map "n" #'narrow-or-widen-dwim) 451 | ;; This line actually replaces Emacs' entire narrowing keymap, that's 452 | ;; how much I like this command. Only copy it if that's what you want. 453 | (define-key ctl-x-map "n" #'narrow-or-widen-dwim) 454 | 455 | #+END_SRC 456 | 457 | 458 | #+RESULTS: 459 | : narrow-or-widen-dwim 460 | 461 | * Web Mode 462 | #+BEGIN_SRC emacs-lisp 463 | (use-package web-mode 464 | :ensure t 465 | :config 466 | (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) 467 | (add-to-list 'auto-mode-alist '("\\.vue?\\'" . web-mode)) 468 | (setq web-mode-engines-alist 469 | '(("django" . "\\.html\\'"))) 470 | (setq web-mode-ac-sources-alist 471 | '(("css" . (ac-source-css-property)) 472 | ("vue" . (ac-source-words-in-buffer ac-source-abbrev)) 473 | ("html" . (ac-source-words-in-buffer ac-source-abbrev)))) 474 | (setq web-mode-enable-auto-closing t)) 475 | (setq web-mode-enable-auto-quoting t) ; this fixes the quote problem I mentioned 476 | 477 | 478 | #+END_SRC 479 | 480 | #+RESULTS: 481 | : t 482 | * Emmet mode 483 | #+BEGIN_SRC emacs-lisp 484 | (use-package emmet-mode 485 | :ensure t 486 | :config 487 | (add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes 488 | (add-hook 'web-mode-hook 'emmet-mode) ;; Auto-start on any markup modes 489 | (add-hook 'css-mode-hook 'emmet-mode) ;; enable Emmet's css abbreviation. 490 | ) 491 | #+END_SRC 492 | * Javascript 493 | #+BEGIN_SRC emacs-lisp 494 | (use-package js2-mode 495 | :ensure t 496 | :ensure ac-js2 497 | :init 498 | (progn 499 | (add-hook 'js-mode-hook 'js2-minor-mode) 500 | (add-hook 'js2-mode-hook 'ac-js2-mode) 501 | )) 502 | 503 | (use-package js2-refactor 504 | :ensure t 505 | :config 506 | (progn 507 | (js2r-add-keybindings-with-prefix "C-c C-m") 508 | ;; eg. extract function with `C-c C-m ef`. 509 | (add-hook 'js2-mode-hook #'js2-refactor-mode))) 510 | (use-package tern 511 | :ensure tern 512 | :ensure tern-auto-complete 513 | :config 514 | (progn 515 | (add-hook 'js-mode-hook (lambda () (tern-mode t))) 516 | (add-hook 'js2-mode-hook (lambda () (tern-mode t))) 517 | (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) 518 | ;;(tern-ac-setup) 519 | )) 520 | 521 | ;;(use-package jade 522 | ;;:ensure t 523 | ;;) 524 | 525 | ;; use web-mode for .jsx files 526 | (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode)) 527 | 528 | 529 | ;; turn on flychecking globally 530 | (add-hook 'after-init-hook #'global-flycheck-mode) 531 | 532 | ;; disable jshint since we prefer eslint checking 533 | (setq-default flycheck-disabled-checkers 534 | (append flycheck-disabled-checkers 535 | '(javascript-jshint))) 536 | 537 | ;; use eslint with web-mode for jsx files 538 | (flycheck-add-mode 'javascript-eslint 'web-mode) 539 | 540 | ;; customize flycheck temp file prefix 541 | (setq-default flycheck-temp-prefix ".flycheck") 542 | 543 | ;; disable json-jsonlist checking for json files 544 | (setq-default flycheck-disabled-checkers 545 | (append flycheck-disabled-checkers 546 | '(json-jsonlist))) 547 | 548 | ;; adjust indents for web-mode to 2 spaces 549 | (defun my-web-mode-hook () 550 | "Hooks for Web mode. Adjust indents" 551 | ;;; http://web-mode.org/ 552 | (setq web-mode-markup-indent-offset 2) 553 | (setq web-mode-css-indent-offset 2) 554 | (setq web-mode-code-indent-offset 2)) 555 | (add-hook 'web-mode-hook 'my-web-mode-hook) 556 | #+END_SRC 557 | 558 | * DIRED 559 | #+BEGIN_SRC emacs-lisp 560 | ; wiki melpa problem 561 | ;(use-package dired+ 562 | ; :ensure t 563 | ; :config (require 'dired+) 564 | ; ) 565 | 566 | (setq dired-dwim-target t) 567 | 568 | (use-package dired-narrow 569 | :ensure t 570 | :config 571 | (bind-key "C-c C-n" #'dired-narrow) 572 | (bind-key "C-c C-f" #'dired-narrow-fuzzy) 573 | (bind-key "C-x C-N" #'dired-narrow-regexp) 574 | ) 575 | 576 | (use-package dired-subtree :ensure t 577 | :after dired 578 | :config 579 | (bind-key "" #'dired-subtree-toggle dired-mode-map) 580 | (bind-key "" #'dired-subtree-cycle dired-mode-map)) 581 | 582 | 583 | #+END_SRC 584 | 585 | #+RESULTS: 586 | : t 587 | 588 | * Stuff to refile as I do more Screencasts 589 | #+BEGIN_SRC emacs-lisp 590 | 591 | ;;-------------------------------------------------------------------------- 592 | ;; latex 593 | (use-package tex 594 | :ensure auctex) 595 | 596 | (defun tex-view () 597 | (interactive) 598 | (tex-send-command "evince" (tex-append tex-print-file ".pdf"))) 599 | ;; babel stuff 600 | 601 | (org-babel-do-load-languages 602 | 'org-babel-load-languages 603 | '((python . t) 604 | (emacs-lisp . t) 605 | (shell . t) 606 | (C . t) 607 | (js . t) 608 | (ditaa . t) 609 | (dot . t) 610 | (org . t) 611 | (latex . t ) 612 | )) 613 | ;; projectile 614 | (use-package projectile 615 | :ensure t 616 | :bind ("C-c p" . projectile-command-map) 617 | :config 618 | (projectile-global-mode) 619 | (setq projectile-completion-system 'ivy)) 620 | 621 | ;; (use-package counsel-projectile 622 | ;; :ensure t 623 | ;; :config 624 | ;; (counsel-projectile-on)q) 625 | 626 | (use-package smartparens 627 | :ensure t 628 | :hook (prog-mode . smartparens-mode) 629 | :custom 630 | (sp-escape-quotes-after-insert nil) 631 | :config 632 | (require 'smartparens-config)) 633 | 634 | (show-paren-mode t) 635 | ;;-------------------------------------------- 636 | 637 | 638 | 639 | 640 | ;; font scaling 641 | (use-package default-text-scale 642 | :ensure t 643 | :config 644 | (global-set-key (kbd "C-M-=") 'default-text-scale-increase) 645 | (global-set-key (kbd "C-M--") 'default-text-scale-decrease)) 646 | 647 | 648 | ;; (use-package frame-cmds :ensure t) 649 | ;; (load-file "/home/zamansky/Dropbox/shared/zoom-frm.el") 650 | ;; (define-key ctl-x-map [(control ?+)] 'zoom-in/out) 651 | ;; (define-key ctl-x-map [(control ?-)] 'zoom-in/out) 652 | ;; (define-key ctl-x-map [(control ?=)] 'zoom-in/out) 653 | (define-key ctl-x-map [(control ?0)] 'zoom-in/out) 654 | 655 | 656 | #+END_SRC 657 | * Hydra 658 | #+BEGIN_SRC emacs-lisp 659 | (use-package hydra 660 | :ensure hydra 661 | :init 662 | (global-set-key 663 | (kbd "C-x t") 664 | (defhydra toggle (:color blue) 665 | "toggle" 666 | ("a" abbrev-mode "abbrev") 667 | ("s" flyspell-mode "flyspell") 668 | ("d" toggle-debug-on-error "debug") 669 | ("c" fci-mode "fCi") 670 | ("f" auto-fill-mode "fill") 671 | ("t" toggle-truncate-lines "truncate") 672 | ("w" whitespace-mode "whitespace") 673 | ("q" nil "cancel"))) 674 | (global-set-key 675 | (kbd "C-x j") 676 | (defhydra gotoline 677 | ( :pre (linum-mode 1) 678 | :post (linum-mode -1)) 679 | "goto" 680 | ("t" (lambda () (interactive)(move-to-window-line-top-bottom 0)) "top") 681 | ("b" (lambda () (interactive)(move-to-window-line-top-bottom -1)) "bottom") 682 | ("m" (lambda () (interactive)(move-to-window-line-top-bottom)) "middle") 683 | ("e" (lambda () (interactive)(end-of-buffer)) "end") 684 | ("c" recenter-top-bottom "recenter") 685 | ("n" next-line "down") 686 | ("p" (lambda () (interactive) (forward-line -1)) "up") 687 | ("g" goto-line "goto-line") 688 | )) 689 | (global-set-key 690 | (kbd "C-c t") 691 | (defhydra hydra-global-org (:color blue) 692 | "Org" 693 | ("t" org-timer-start "Start Timer") 694 | ("s" org-timer-stop "Stop Timer") 695 | ("r" org-timer-set-timer "Set Timer") ; This one requires you be in an orgmode doc, as it sets the timer for the header 696 | ("p" org-timer "Print Timer") ; output timer value to buffer 697 | ("w" (org-clock-in '(4)) "Clock-In") ; used with (org-clock-persistence-insinuate) (setq org-clock-persist t) 698 | ("o" org-clock-out "Clock-Out") ; you might also want (setq org-log-note-clock-out t) 699 | ("j" org-clock-goto "Clock Goto") ; global visit the clocked task 700 | ("c" org-capture "Capture") ; Don't forget to define the captures you want http://orgmode.org/manual/Capture.html 701 | ("l" (or )rg-capture-goto-last-stored "Last Capture")) 702 | 703 | )) 704 | 705 | (defhydra hydra-multiple-cursors (:hint nil) 706 | " 707 | Up^^ Down^^ Miscellaneous % 2(mc/num-cursors) cursor%s(if (> (mc/num-cursors) 1) \"s\" \"\") 708 | ------------------------------------------------------------------ 709 | [_p_] Next [_n_] Next [_l_] Edit lines [_0_] Insert numbers 710 | [_P_] Skip [_N_] Skip [_a_] Mark all [_A_] Insert letters 711 | [_M-p_] Unmark [_M-n_] Unmark [_s_] Search 712 | [Click] Cursor at point [_q_] Quit" 713 | ("l" mc/edit-lines :exit t) 714 | ("a" mc/mark-all-like-this :exit t) 715 | ("n" mc/mark-next-like-this) 716 | ("N" mc/skip-to-next-like-this) 717 | ("M-n" mc/unmark-next-like-this) 718 | ("p" mc/mark-previous-like-this) 719 | ("P" mc/skip-to-previous-like-this) 720 | ("M-p" mc/unmark-previous-like-this) 721 | ("s" mc/mark-all-in-region-regexp :exit t) 722 | ("0" mc/insert-numbers :exit t) 723 | ("A" mc/insert-letters :exit t) 724 | ("" mc/add-cursor-on-click) 725 | ;; Help with click recognition in this hydra 726 | ("" ignore) 727 | ("" ignore) 728 | ("q" nil) 729 | 730 | 731 | ("" mc/add-cursor-on-click) 732 | ("" ignore) 733 | ("" ignore)) 734 | 735 | #+END_SRC 736 | 737 | #+RESULTS: 738 | 739 | * git 740 | #+BEGIN_SRC emacs-lisp 741 | (use-package magit 742 | :ensure t 743 | :init 744 | (progn 745 | (bind-key "C-x g" 'magit-status) 746 | )) 747 | 748 | (setq magit-status-margin 749 | '(t "%Y-%m-%d %H:%M " magit-log-margin-width t 18)) 750 | (use-package git-gutter 751 | :ensure t 752 | :init 753 | (global-git-gutter-mode +1)) 754 | 755 | (global-set-key (kbd "M-g M-g") 'hydra-git-gutter/body) 756 | 757 | 758 | (use-package git-timemachine 759 | :ensure t 760 | ) 761 | (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1) 762 | :hint nil) 763 | " 764 | Git gutter: 765 | _j_: next hunk _s_tage hunk _q_uit 766 | _k_: previous hunk _r_evert hunk _Q_uit and deactivate git-gutter 767 | ^ ^ _p_opup hunk 768 | _h_: first hunk 769 | _l_: last hunk set start _R_evision 770 | " 771 | ("j" git-gutter:next-hunk) 772 | ("k" git-gutter:previous-hunk) 773 | ("h" (progn (goto-char (point-min)) 774 | (git-gutter:next-hunk 1))) 775 | ("l" (progn (goto-char (point-min)) 776 | (git-gutter:previous-hunk 1))) 777 | ("s" git-gutter:stage-hunk) 778 | ("r" git-gutter:revert-hunk) 779 | ("p" git-gutter:popup-hunk) 780 | ("R" git-gutter:set-start-revision) 781 | ("q" nil :color blue) 782 | ("Q" (progn (git-gutter-mode -1) 783 | ;; git-gutter-fringe doesn't seem to 784 | ;; clear the markup right away 785 | (sit-for 0.1) 786 | (git-gutter:clear)) 787 | :color blue)) 788 | 789 | 790 | 791 | #+END_SRC 792 | * Load other files 793 | #+BEGIN_SRC emacs-lisp 794 | (defun load-if-exists (f) 795 | "load the elisp file only if it exists and is readable" 796 | (if (file-readable-p f) 797 | (load-file f))) 798 | 799 | (load-if-exists "~/Sync/shared/mu4econfig.el") 800 | (load-if-exists "~/Sync/shared/not-for-github.el") 801 | 802 | #+END_SRC 803 | 804 | #+RESULTS: 805 | : t 806 | * Testing Stuff 807 | #+BEGIN_SRC emacs-lisp 808 | (add-hook 'org-mode-hook 'turn-on-flyspell) 809 | (add-hook 'org-mode-hook 'turn-on-auto-fill) 810 | (add-hook 'mu4e-compose-mode-hook 'turn-on-flyspell) 811 | (add-hook 'mu4e-compose-mode-hook 'turn-on-auto-fill) 812 | 813 | #+END_SRC 814 | * Better Shell 815 | #+BEGIN_SRC emacs-lisp :tangle no 816 | (use-package better-shell 817 | :ensure t 818 | :bind (("C-\"" . better-shell-shell) 819 | ("C-:" . better-shell-remote-open))) 820 | #+END_SRC 821 | 822 | #+RESULTS: 823 | : better-shell-remote-open 824 | 825 | * Elfeed 826 | #+BEGIN_SRC emacs-lisp :tangle no 827 | 828 | (setq elfeed-db-directory "~/Sync/shared/elfeeddb") 829 | 830 | 831 | (defun elfeed-mark-all-as-read () 832 | (interactive) 833 | (mark-whole-buffer) 834 | (elfeed-search-untag-all-unread)) 835 | 836 | 837 | ;;functions to support syncing .elfeed between machines 838 | ;;makes sure elfeed reads index from disk before launching 839 | (defun bjm/elfeed-load-db-and-open () 840 | "Wrapper to load the elfeed db from disk before opening" 841 | (interactive) 842 | (elfeed-db-load) 843 | (elfeed) 844 | (elfeed-search-update--force)) 845 | 846 | ;;write to disk when quiting 847 | (defun bjm/elfeed-save-db-and-bury () 848 | "Wrapper to save the elfeed db to disk before burying buffer" 849 | (interactive) 850 | (elfeed-db-save) 851 | (quit-window)) 852 | 853 | 854 | 855 | 856 | (use-package elfeed 857 | :ensure t 858 | :bind (:map elfeed-search-mode-map 859 | ("q" . bjm/elfeed-save-db-and-bury) 860 | ("Q" . bjm/elfeed-save-db-and-bury) 861 | ("m" . elfeed-toggle-star) 862 | ("M" . elfeed-toggle-star) 863 | ("j" . mz/make-and-run-elfeed-hydra) 864 | ("J" . mz/make-and-run-elfeed-hydra) 865 | ) 866 | :config 867 | (defalias 'elfeed-toggle-star 868 | (elfeed-expose #'elfeed-search-toggle-all 'star)) 869 | 870 | ) 871 | 872 | (use-package elfeed-goodies 873 | :ensure t 874 | :config 875 | (elfeed-goodies/setup)) 876 | 877 | 878 | (use-package elfeed-org 879 | :ensure t 880 | :config 881 | (elfeed-org) 882 | (setq rmh-elfeed-org-files (list "~/Sync/shared/elfeed.org"))) 883 | 884 | 885 | 886 | 887 | 888 | (defun z/hasCap (s) "" 889 | (let ((case-fold-search nil)) 890 | (string-match-p "[[:upper:]]" s) 891 | )) 892 | 893 | 894 | (defun z/get-hydra-option-key (s) 895 | "returns single upper case letter (converted to lower) or first" 896 | (interactive) 897 | (let ( (loc (z/hasCap s))) 898 | (if loc 899 | (downcase (substring s loc (+ loc 1))) 900 | (substring s 0 1) 901 | ))) 902 | 903 | ;; (active blogs cs eDucation emacs local misc sports star tech unread webcomics) 904 | (defun mz/make-elfeed-cats (tags) 905 | "Returns a list of lists. Each one is line for the hydra configuratio in the form 906 | (c function hint)" 907 | (interactive) 908 | (mapcar (lambda (tag) 909 | (let* ( 910 | (tagstring (symbol-name tag)) 911 | (c (z/get-hydra-option-key tagstring)) 912 | ) 913 | (list c (append '(elfeed-search-set-filter) (list (format "@6-months-ago +%s" tagstring) ))tagstring ))) 914 | tags)) 915 | 916 | 917 | 918 | 919 | 920 | (defmacro mz/make-elfeed-hydra () 921 | `(defhydra mz/hydra-elfeed () 922 | "filter" 923 | ,@(mz/make-elfeed-cats (elfeed-db-get-all-tags)) 924 | ("*" (elfeed-search-set-filter "@6-months-ago +star") "Starred") 925 | ("M" elfeed-toggle-star "Mark") 926 | ("A" (elfeed-search-set-filter "@6-months-ago") "All") 927 | ("T" (elfeed-search-set-filter "@1-day-ago") "Today") 928 | ("Q" bjm/elfeed-save-db-and-bury "Quit Elfeed" :color blue) 929 | ("q" nil "quit" :color blue) 930 | )) 931 | 932 | 933 | 934 | 935 | (defun mz/make-and-run-elfeed-hydra () 936 | "" 937 | (interactive) 938 | (mz/make-elfeed-hydra) 939 | (mz/hydra-elfeed/body)) 940 | 941 | 942 | #+END_SRC 943 | 944 | #+RESULTS: 945 | : mz/make-and-run-elfeed-hydra 946 | 947 | * c++ 948 | #+BEGIN_SRC emacs-lisp 949 | (use-package ggtags 950 | :ensure t 951 | :config 952 | (add-hook 'c-mode-common-hook 953 | (lambda () 954 | (when (derived-mode-p 'c-mode 'c++-mode 'java-mode) 955 | (ggtags-mode 1)))) 956 | ) 957 | 958 | #+END_SRC 959 | 960 | #+RESULTS: 961 | 962 | * Clojure 963 | #+BEGIN_SRC emacs-lisp 964 | (use-package cider 965 | :ensure t 966 | :config 967 | (add-hook 'cider-repl-mode-hook #'company-mode) 968 | (add-hook 'cider-mode-hook #'company-mode) 969 | (add-hook 'cider-mode-hook #'eldoc-mode) 970 | ;; (add-hook 'cider-mode-hook #'cider-hydra-mode) 971 | (setq cider-repl-use-pretty-printing t) 972 | (setq cider-repl-display-help-banner nil) 973 | ;; (setq cider-cljs-lein-repl "(do (use 'figwheel-sidecar.repl-api) (start-figwheel!) (cljs-repl))") 974 | 975 | :bind (("M-r" . cider-namespace-refresh) 976 | ("C-c r" . cider-repl-reset) 977 | ("C-c ." . cider-reset-test-run-tests)) 978 | ) 979 | 980 | (use-package clj-refactor 981 | :ensure t 982 | :config 983 | (add-hook 'clojure-mode-hook (lambda () 984 | (clj-refactor-mode 1) 985 | ;; insert keybinding setup here 986 | )) 987 | (cljr-add-keybindings-with-prefix "C-c C-m") 988 | (setq cljr-warn-on-eval nil) 989 | :bind ("C-c '" . hydra-cljr-help-menu/body) 990 | ) 991 | #+END_SRC 992 | 993 | 994 | * Dumb jump 995 | #+BEGIN_SRC emacs-lisp 996 | 997 | (use-package dumb-jump 998 | :bind (("M-g o" . dumb-jump-go-other-window) 999 | ("M-g j" . dumb-jump-go) 1000 | ("M-g x" . dumb-jump-go-prefer-external) 1001 | ("M-g z" . dumb-jump-go-prefer-external-other-window)) 1002 | :config 1003 | ;; (setq dumb-jump-selector 'ivy) ;; (setq dumb-jump-selector 'helm) 1004 | :init 1005 | (dumb-jump-mode) 1006 | :ensure 1007 | ) 1008 | 1009 | 1010 | 1011 | #+END_SRC 1012 | * Origami folding 1013 | #+BEGIN_SRC emacs-lisp 1014 | (use-package origami 1015 | :ensure t) 1016 | #+END_SRC 1017 | 1018 | #+RESULTS: 1019 | 1020 | * IBUFFER 1021 | #+BEGIN_SRC emacs-lisp 1022 | (global-set-key (kbd "C-x C-b") 'ibuffer) 1023 | (setq ibuffer-saved-filter-groups 1024 | (quote (("default" 1025 | ("dired" (mode . dired-mode)) 1026 | ("org" (name . "^.*org$")) 1027 | ("magit" (mode . magit-mode)) 1028 | ("IRC" (or (mode . circe-channel-mode) (mode . circe-server-mode))) 1029 | ("web" (or (mode . web-mode) (mode . js2-mode))) 1030 | ("shell" (or (mode . eshell-mode) (mode . shell-mode))) 1031 | ("mu4e" (or 1032 | 1033 | (mode . mu4e-compose-mode) 1034 | (name . "\*mu4e\*") 1035 | )) 1036 | ("programming" (or 1037 | (mode . clojure-mode) 1038 | (mode . clojurescript-mode) 1039 | (mode . python-mode) 1040 | (mode . c++-mode))) 1041 | ("emacs" (or 1042 | (name . "^\\*scratch\\*$") 1043 | (name . "^\\*Messages\\*$"))) 1044 | )))) 1045 | (add-hook 'ibuffer-mode-hook 1046 | (lambda () 1047 | (ibuffer-auto-mode 1) 1048 | (ibuffer-switch-to-saved-filter-groups "default"))) 1049 | 1050 | ;; don't show these 1051 | ;(add-to-list 'ibuffer-never-show-predicates "zowie") 1052 | ;; Don't show filter groups if there are no buffers in that group 1053 | (setq ibuffer-show-empty-filter-groups nil) 1054 | 1055 | ;; Don't ask for confirmation to delete marked buffers 1056 | (setq ibuffer-expert t) 1057 | 1058 | #+END_SRC 1059 | * Treemacs 1060 | #+BEGIN_SRC emacs-lisp 1061 | (use-package treemacs 1062 | :ensure t 1063 | :defer t 1064 | :config 1065 | (progn 1066 | 1067 | (setq treemacs-follow-after-init t 1068 | treemacs-width 35 1069 | treemacs-indentation 2 1070 | treemacs-git-integration t 1071 | treemacs-collapse-dirs 3 1072 | treemacs-silent-refresh nil 1073 | treemacs-change-root-without-asking nil 1074 | treemacs-sorting 'alphabetic-desc 1075 | treemacs-show-hidden-files t 1076 | treemacs-never-persist nil 1077 | treemacs-is-never-other-window nil 1078 | treemacs-goto-tag-strategy 'refetch-index) 1079 | 1080 | (treemacs-follow-mode t) 1081 | (treemacs-filewatch-mode t)) 1082 | :bind 1083 | (:map global-map 1084 | ([f8] . treemacs-toggle) 1085 | ([f9] . treemacs-projectile-toggle) 1086 | ("" . treemacs-toggle) 1087 | ("M-0" . treemacs-select-window) 1088 | ("C-c 1" . treemacs-delete-other-windows) 1089 | )) 1090 | (use-package treemacs-projectile 1091 | :defer t 1092 | :ensure t 1093 | :config 1094 | (setq treemacs-header-function #'treemacs-projectile-create-header) 1095 | ) 1096 | 1097 | #+END_SRC 1098 | 1099 | #+RESULTS: 1100 | 1101 | * misc 1102 | #+BEGIN_SRC emacs-lisp 1103 | 1104 | (use-package aggressive-indent 1105 | :ensure t 1106 | :config 1107 | (global-aggressive-indent-mode 1) 1108 | ;;(add-to-list 'aggressive-indent-excluded-modes 'html-mode) 1109 | ) 1110 | 1111 | 1112 | (defun z/swap-windows () 1113 | "" 1114 | (interactive) 1115 | (ace-swap-window) 1116 | (aw-flip-window) 1117 | ) 1118 | 1119 | #+END_SRC 1120 | 1121 | #+RESULTS: 1122 | : z/nikola-deploy 1123 | * Haskell 1124 | #+BEGIN_SRC emacs-lisp 1125 | (use-package haskell-mode 1126 | :ensure t 1127 | :config 1128 | (require 'haskell-interactive-mode) 1129 | (require 'haskell-process) 1130 | (add-hook 'haskell-mode-hook 'interactive-haskell-mode) 1131 | 1132 | ) 1133 | 1134 | #+END_SRC 1135 | * personal keymap 1136 | #+BEGIN_SRC emacs-lisp 1137 | ;; unset C- and M- digit keys 1138 | ;(dotimes (n 10) 1139 | ; (global-unset-key (kbd (format "C-%d" n))) 1140 | ; (global-unset-key (kbd (format "M-%d" n))) 1141 | ; ) 1142 | 1143 | 1144 | (defun org-agenda-show-agenda-and-todo (&optional arg) 1145 | (interactive "P") 1146 | (org-agenda arg "c") 1147 | (org-agenda-fortnight-view)) 1148 | 1149 | (defun z/load-iorg () 1150 | (interactive ) 1151 | (find-file "~/Sync/orgfiles/i.org")) 1152 | 1153 | ;; set up my own map 1154 | (define-prefix-command 'z-map) 1155 | (global-set-key (kbd "C-z") 'z-map) ;; was C-1 1156 | (define-key z-map (kbd "k") 'compile) 1157 | (define-key z-map (kbd "c") 'hydra-multiple-cursors/body) 1158 | (define-key z-map (kbd "m") 'mu4e) 1159 | (define-key z-map (kbd "1") 'org-global-cycle) 1160 | (define-key z-map (kbd "a") 'org-agenda-show-agenda-and-todo) 1161 | (define-key z-map (kbd "g") 'counsel-ag) 1162 | (define-key z-map (kbd "2") 'make-frame-command) 1163 | (define-key z-map (kbd "0") 'delete-frame) 1164 | (define-key z-map (kbd "o") 'ace-window) 1165 | 1166 | (define-key z-map (kbd "s") 'flyspell-correct-word-before-point) 1167 | (define-key z-map (kbd "i") 'z/load-iorg) 1168 | (define-key z-map (kbd "f") 'origami-toggle-node) 1169 | (define-key z-map (kbd "w") 'z/swap-windows) 1170 | (define-key z-map (kbd "*") 'calc) 1171 | 1172 | 1173 | (setq user-full-name "Mike Zamansky" 1174 | user-mail-address "mz631@hunter.cuny.edu") 1175 | ;;-------------------------------------------------------------------------- 1176 | 1177 | 1178 | (global-set-key (kbd "\e\ei") 1179 | (lambda () (interactive) (find-file "~/Sync/orgfiles/i.org"))) 1180 | 1181 | (global-set-key (kbd "\e\el") 1182 | (lambda () (interactive) (find-file "~/Sync/orgfiles/links.org"))) 1183 | 1184 | (global-set-key (kbd "\e\ec") 1185 | (lambda () (interactive) (find-file "~/.emacs.d/myinit.org"))) 1186 | 1187 | (global-set-key (kbd "") 'move-end-of-line) 1188 | 1189 | (global-set-key [mouse-3] 'flyspell-correct-word-before-point) 1190 | 1191 | #+END_SRC 1192 | 1193 | #+RESULTS: 1194 | : origami-toggle-node 1195 | 1196 | # LocalWords: DIRED Javascript Screencasts Autocomplete 1197 | * Wgrep 1198 | #+BEGIN_SRC emacs-lisp 1199 | (use-package wgrep 1200 | :ensure t 1201 | ) 1202 | (use-package wgrep-ag 1203 | :ensure t 1204 | ) 1205 | (require 'wgrep-ag) 1206 | #+END_SRC 1207 | 1208 | #+RESULTS: 1209 | * Silversearcher 1210 | #+BEGIN_SRC emacs-lisp 1211 | (use-package ag 1212 | :ensure t) 1213 | 1214 | #+END_SRC 1215 | * Regex 1216 | #+BEGIN_SRC emacs-lisp 1217 | (use-package pcre2el 1218 | :ensure t 1219 | :config 1220 | (pcre-mode) 1221 | ) 1222 | #+END_SRC 1223 | * Eyebrowse 1224 | #+BEGIN_SRC emacs-lisp :tangle no 1225 | (use-package eyebrowse 1226 | :ensure t 1227 | :config 1228 | (eyebrowse-mode) 1229 | ) 1230 | 1231 | #+END_SRC 1232 | 1233 | #+RESULTS: 1234 | 1235 | * Music 1236 | #+BEGIN_SRC emacs-lisp 1237 | (use-package simple-mpc 1238 | :ensure t) 1239 | (use-package mingus 1240 | :ensure t) 1241 | 1242 | #+END_SRC 1243 | * Atomic Chrome (edit in emacs) 1244 | #+BEGIN_SRC emacs-lisp 1245 | (use-package atomic-chrome 1246 | :ensure t 1247 | :config (atomic-chrome-start-server)) 1248 | (setq atomic-chrome-buffer-open-style 'frame) 1249 | #+END_SRC 1250 | * PDF tools 1251 | #+BEGIN_SRC emacs-lisp 1252 | (use-package pdf-tools 1253 | :ensure t) 1254 | (use-package org-pdfview 1255 | :ensure t) 1256 | 1257 | (require 'pdf-tools) 1258 | (require 'org-pdfview) 1259 | 1260 | #+END_SRC 1261 | * auto-yasnippet 1262 | #+BEGIN_SRC emacs-lisp 1263 | (use-package auto-yasnippet 1264 | :ensure t) 1265 | #+END_SRC 1266 | * mu4e-conversation 1267 | #+BEGIN_SRC emacs-lisp :tangle no 1268 | (use-package mu4e-conversation 1269 | :ensure t 1270 | ) 1271 | 1272 | #+END_SRC 1273 | * Unfill region and paragraph 1274 | #+BEGIN_SRC emacs-lisp 1275 | ;;; Stefan Monnier . It is the opposite of fill-paragraph 1276 | (defun unfill-paragraph (&optional region) 1277 | "Takes a multi-line paragraph and makes it into a single line of text." 1278 | (interactive (progn (barf-if-buffer-read-only) '(t))) 1279 | (let ((fill-column (point-max)) 1280 | ;; This would override `fill-column' if it's an integer. 1281 | (emacs-lisp-docstring-fill-column t)) 1282 | (fill-paragraph nil region))) 1283 | 1284 | (defun unfill-region (beg end) 1285 | "Unfill the region, joining text paragraphs into a single 1286 | logical line. This is useful, e.g., for use with 1287 | `visual-line-mode'." 1288 | (interactive "*r") 1289 | (let ((fill-column (point-max))) 1290 | (fill-region beg end))) 1291 | 1292 | 1293 | #+END_SRC 1294 | * Easy kill 1295 | #+BEGIN_SRC emacs-lisp 1296 | ;; (use-package easy-kill 1297 | ;; :ensure t 1298 | ;; :config 1299 | ;; (global-set-key [remap kill-ring-save] #'easy-kill) 1300 | ;; (global-set-key [remap mark-sexp] #'easy-mark)) 1301 | 1302 | #+END_SRC 1303 | 1304 | * PATH 1305 | #+BEGIN_SRC emacs-lisp 1306 | (use-package exec-path-from-shell 1307 | :ensure t 1308 | :config 1309 | (exec-path-from-shell-initialize) 1310 | ) 1311 | #+END_SRC 1312 | * Counsel-spotify 1313 | #+begin_src emacs-lisp 1314 | 1315 | (setq counsel-spotify-client-id "ce31becb1af94921907671e4bfa7f558") 1316 | (setq counsel-spotify-client-secret "9433b011b7094b2b8c4eb0255b8249e3") 1317 | (use-package counsel-spotify 1318 | :ensure t 1319 | :config 1320 | (require 'counsel-spotify) 1321 | ) 1322 | #+end_src 1323 | * Misc 1324 | 1325 | 1326 | #+BEGIN_SRC emacs-lisp 1327 | (setq browse-url-browser-function 'browse-url-generic 1328 | browse-url-generic-program "firefox") 1329 | 1330 | (setq auto-window-vscroll nil) 1331 | 1332 | #+END_SRC 1333 | 1334 | * Keyfreq 1335 | #+BEGIN_SRC emacs-lisp 1336 | (use-package keyfreq 1337 | :ensure t 1338 | :config 1339 | (require 'keyfreq) 1340 | (keyfreq-mode 1) 1341 | (keyfreq-autosave-mode 1) 1342 | ) 1343 | #+END_SRC 1344 | * Word stuff 1345 | #+BEGIN_SRC emacs-lisp 1346 | (use-package dictionary 1347 | :ensure t) 1348 | 1349 | (use-package synosaurus 1350 | :ensure t) 1351 | 1352 | #+END_SRC 1353 | * Rust 1354 | #+BEGIN_SRC emacs-lisp 1355 | ;; don't forget to install racer: 1356 | ;; rustup toolchain add nightly 1357 | ;; cargo +nightly install racer 1358 | ;; rustup component add rust-src 1359 | ;; rustup component add rustfmt 1360 | (use-package racer 1361 | :ensure t 1362 | :config 1363 | (add-hook 'racer-mode-hook #'company-mode) 1364 | (setq company-tooltip-align-annotations t) 1365 | (setq racer-rust-src-path "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src")) 1366 | 1367 | (use-package rust-mode 1368 | :ensure t 1369 | :config 1370 | (add-hook 'rust-mode-hook #'racer-mode) 1371 | (add-hook 'racer-mode-hook #'eldoc-mode) 1372 | (setq rust-format-on-save t)) 1373 | 1374 | (use-package cargo 1375 | :ensure t 1376 | :config 1377 | (setq compilation-scroll-output t) 1378 | (add-hook 'rust-mode-hook 'cargo-minor-mode)) 1379 | 1380 | (use-package flycheck-rust 1381 | :ensure t 1382 | :config 1383 | (add-hook 'flycheck-mode-hook #'flycheck-rust-setup) 1384 | (add-hook 'rust-mode-hook 'flycheck-mode)) 1385 | 1386 | #+END_SRC 1387 | * Ripgrep 1388 | #+BEGIN_SRC emacs-lisp 1389 | (use-package deadgrep 1390 | :ensure t) 1391 | 1392 | (use-package rg 1393 | :ensure t 1394 | :commands rg) 1395 | 1396 | #+END_SRC 1397 | * Fzf 1398 | #+BEGIN_SRC emacs-lisp 1399 | (use-package fzf :ensure t) 1400 | #+END_SRC 1401 | * All the icons 1402 | 1403 | #+BEGIN_SRC emacs-lisp 1404 | (use-package all-the-icons 1405 | :ensure t 1406 | :defer 0.5) 1407 | 1408 | (use-package all-the-icons-ivy 1409 | :ensure t 1410 | :after (all-the-icons ivy) 1411 | :custom (all-the-icons-ivy-buffer-commands '(ivy-switch-buffer-other-window ivy-switch-buffer)) 1412 | :config 1413 | (add-to-list 'all-the-icons-ivy-file-commands 'counsel-dired-jump) 1414 | (add-to-list 'all-the-icons-ivy-file-commands 'counsel-find-library) 1415 | (all-the-icons-ivy-setup)) 1416 | 1417 | 1418 | (use-package all-the-icons-dired 1419 | :ensure t 1420 | ) 1421 | 1422 | (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) 1423 | 1424 | #+END_SRC 1425 | -------------------------------------------------------------------------------- /samples/python/test.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | def f(x): 4 | return random.randrange(1, x) 5 | 6 | 7 | for i in range(2,10): 8 | print f(i) 9 | 10 | 11 | 12 | if __name__ == '__main__': 13 | hello 14 | 15 | 16 | class myclass(somethingelse): 17 | """documentation 18 | 19 | """ 20 | def __init__(self, some_args): 21 | super(myclass, self).__init__() 22 | self.some_args = some_args 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/reveal/present.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | My Awesome Presentation 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 25 | 26 | 27 |
28 |
29 |

My Awesome Presentation

Mike Zamansky

Created: 2016-07-19 Tue 11:44

30 |
31 | 32 |
33 |
34 |

Slide 1

35 |

36 | here's some text 37 |

38 | 39 |
40 |
41 |
42 |
43 |

Slide 2

44 |
45 |
46 |
47 |

subslide 1

48 |
49 |
50 |

subslide 2

51 |
52 |
53 |
54 |
55 |

Slide 3

56 |
    57 |
  • list item 1
  • 58 |
  • 59 | list item 2 60 |

    61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
    abc
    123
    456
  • 92 | 93 |
94 |
95 |
96 |
97 |
98 |

slide 4

99 |
100 | 101 |
def f(x):
102 |     return x + 1
103 | 
104 | print f(5)
105 | 
106 |
107 |
108 |
109 |
110 |
111 | 112 | 113 | 114 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /samples/reveal/present.org: -------------------------------------------------------------------------------- 1 | #+REVEAL_THEME: sky 2 | #+OPTIONS: toc:nil num:nil 3 | #+TITLE: My Awesome Presentation 4 | #+AUTHOR: Mike Zamansky 5 | 6 | * Slide 1 7 | here's some text 8 | 9 | * Slide 2 10 | ** subslide 1 11 | ** subslide 2 12 | * Slide 3 13 | #+ATTR_REVEAL: :frag (roll-in) 14 | - list item 1 15 | - list item 2 16 | | a | b | c | 17 | |---+---+---| 18 | | 1 | 2 | 3 | 19 | | 4 | 5 | 6 | 20 | |---+---+---| 21 | * slide 4 22 | #+BEGIN_SRC python 23 | def f(x): 24 | return x + 1 25 | 26 | print f(5) 27 | 28 | 29 | #+END_SRC 30 | -------------------------------------------------------------------------------- /snippets/org-mode/post: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: post 3 | # key: post 4 | # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) 5 | # -- 6 | --- 7 | title: ${1:`(capitalize (replace-regexp-in-string "-\\|_" " " (file-name-base))))`} 8 | date: `(format-time-string "%Y-%m-%dT%H:%M:%S-04:00" (current-time))` 9 | tags: 10 | categories: 11 | draft: true 12 | --- 13 | 14 | $0 -------------------------------------------------------------------------------- /snippets/python-mode/flask: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: flask 3 | # key: flask 4 | # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) 5 | # -- 6 | from flask import Flask, render_template 7 | 8 | app = Flask(__name__) 9 | 10 | 11 | @app.route("/") 12 | def index(): 13 | return "hello" 14 | 15 | $0 16 | 17 | if __name__ == "__main__": 18 | app.debug = True 19 | app.run(host="0.0.0.0", port=8000) 20 | -------------------------------------------------------------------------------- /snippets/web-mode/vue: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: vue 3 | # key: vue 4 | # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil)) 5 | # -- 6 | 9 | 10 | 11 | 30 | 31 | --------------------------------------------------------------------------------