Yet another massive update

This commit is contained in:
Henrik Lissner
2015-05-28 22:24:43 -04:00
parent ee6ac2095e
commit d32b9f0dd0
28 changed files with 1124 additions and 601 deletions

View File

@@ -1,11 +1,13 @@
;; Global editor behavior
(electric-indent-mode 1)
(electric-indent-mode -1)
(setq electric-indent-chars '(? ?: ?{))
(add-hook! 'org-mode-hook (electric-indent-mode -1))
(add-hook 'python-mode-hook 'electric-indent-local-mode)
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook! 'eldoc-mode-hook (diminish 'eldoc-mode " ?"))
(setq-default fill-column 80)
(diminish 'auto-fill-function)
;; Sane scroll settings
(setq scroll-margin 5)
(setq scroll-conservatively 9999)
@@ -42,9 +44,15 @@
(set-face-foreground face nil)
(set-face-background face nil))
(diminish 'isearch-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package anzu
:diminish anzu-mode
:config (global-anzu-mode +1))
(use-package smartparens
:diminish smartparens-mode
:config
(progn
(require 'smartparens-config)
@@ -72,6 +80,10 @@
(sp-local-pair "/* " " */" :post-handlers '(("||\n[i]" "RET")))
(sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET"))))
;; Support for generics
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
(sp-local-pair "<" ">" :when '(sp-point-after-word-p) :unless '(sp-point-before-same-p)))
(sp-with-modes '(objc-mode scss-mode css-mode)
(sp-local-pair "/*\n" "\n */" :post-handlers '(("||[i]" "RET"))))
@@ -89,7 +101,7 @@
:commands (smart-up smart-down smart-left smart-right))
(use-package expand-region
:commands (er/expand-region er/contract-region))
:commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
(use-package hl-todo
:commands hl-todo-mode

View File

@@ -1,14 +1,16 @@
;;;; Eeeeeeevil ;;;;;;;;;;;;;;;;;;;;;;;;
(use-package evil
:diminish undo-tree-mode
:config
(progn
(setq evil-want-visual-char-semi-exclusive t
(setq evil-want-visual-char-semi-exclusive nil
evil-search-module 'evil-search
evil-search-wrap nil
evil-magic 'magic
evil-want-C-u-scroll t ; enable C-u for scrolling
evil-ex-visual-char-range t ; column range for ex commands
evil-ex-search-vim-style-regexp t
evil-ex-interactive-search-highlight 'selected-window
;; Color-coded state cursors
evil-normal-state-cursor '("white" box)
@@ -19,9 +21,9 @@
(evil-mode 1)
;; Always ensure evil-shift-width is consistent with tab-width
(add-hook! 'after-change-major-mode-hook (setq evil-shift-width tab-width))
(add-hook! 'evil-local-mode-hook (setq evil-shift-width tab-width))
;; Fix code folding
(add-hook 'prog-mode-hook 'hs-minor-mode)
(add-hook! 'prog-mode-hook (hs-minor-mode 1) (diminish 'hs-minor-mode))
;; highlight matching delimiters where it's important
(defun show-paren-mode-off () (show-paren-mode -1))
@@ -74,6 +76,7 @@
:config (global-evil-search-highlight-persist t))
(use-package evil-commentary
:diminish evil-commentary-mode
:commands (evil-commentary
evil-commentary-yank
evil-commentary-line)
@@ -82,10 +85,8 @@
(use-package evil-jumper
:init (setq evil-jumper-file (expand-file-name "jumplist" my-tmp-dir))
:config
(progn
(setq evil-jumper-auto-center t
evil-jumper-auto-save-interval 3600)
(define-key evil-motion-state-map (kbd "H-i") 'evil-jumper/forward)))
(setq evil-jumper-auto-center t
evil-jumper-auto-save-interval 3600))
(use-package evil-exchange
:commands (evil-exchange)
@@ -111,6 +112,7 @@
(global-evil-visualstar-mode 1)))
(use-package evil-snipe
:diminish evil-snipe-mode
:config
(progn
(global-evil-snipe-mode +1)
@@ -167,16 +169,15 @@
(mapc 'kill-buffer
(my-living-buffer-list (if bang (projectile-project-buffers) (buffer-list)))))
(evil-define-command my:init-files (&optional bang)
:repeat nil
(evil-define-command my:init-files (&optional bang) :repeat nil
(interactive "<!>")
(if bang
(ido-find-file-in-dir my-modules-dir)
(ido-find-file-in-dir my-dir)))
(evil-define-command my:notes ()
:repeat nil
(evil-define-command my:notes () :repeat nil
(interactive)
(require 'org)
(ido-find-file-in-dir org-directory))
(evil-define-command my:byte-compile (&optional bang)

View File

@@ -12,8 +12,10 @@
(setq mac-option-modifier 'alt)
;; fix emacs PATH on OSX (GUI only)
(require 'exec-path-from-shell)
(exec-path-from-shell-initialize)
(use-package exec-path-from-shell
:config (exec-path-from-shell-initialize))
(use-package applescript-mode :mode "\\.applescript$")
(after "evil"
;; On OSX, stop copying each visual state move to the clipboard:
@@ -26,10 +28,10 @@
;; Send current file to OSX apps
(defun my-open-with (&optional app-name path)
(interactive)
(let ((app-name (if app-name (concat "-a " app-name)))
(path (or path (if (eq major-mode 'dired-mode) (dired-get-file-for-visit) (buffer-file-name)))))
(message "Trying: %s" (concat "open " app-name " " (shell-quote-argument path)))
(shell-command (concat "open " app-name " " (shell-quote-argument path)))))
(let* ((path (f-full (s-replace "'" "\\'" (or path (if (eq major-mode 'dired-mode) (dired-get-file-for-visit) (buffer-file-name))))))
(command (concat "open " (when app-name (concat "-a " (shell-quote-argument app-name))) " '" path "'")))
(message "Trying: %s" command)
(shell-command command)))
(provide 'core-osx)

View File

@@ -1,50 +1,105 @@
;;; core-ui.el -- User interface layout & behavior
;;;; Load Theme ;;;;;;;;;;;;;;;;;;;;;;;;
(when window-system
(set-frame-parameter nil 'alpha '(96 86))
(cycle-font 0)) ; Load font
(when window-system
(set-frame-font *default-font)
(set-frame-parameter nil 'alpha '(100 75)))
(add-to-list 'custom-theme-load-path my-themes-dir)
(load-dark-theme)
(load-theme *default-theme t)
;;;; GUI Settings ;;;;;;;;;;;;;;;;;;;;;;
(when window-system
(scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar
(menu-bar-mode -1)) ; no menubar
(scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar
(menu-bar-mode -1) ; no menubar
(fringe-mode '(2 . 8))) ; no nonsense
(tooltip-mode -1)
(blink-cursor-mode 1) ; blink cursor
(global-hl-line-mode -1) ; highlight line
;; Highlight curent line number
(use-package hlinum
:config
(progn
(hlinum-activate)
;; A little excessive
(remove-hook 'pre-command-hook 'hlinum-unhighlight-current-line)))
;; Line numbers
(setq linum-format " %4d ")
(add-hooks '(text-mode-hook prog-mode-hook) 'linum-mode)
(global-hl-line-mode 1) ; do highlight line
(blink-cursor-mode 1) ; do blink cursor
(line-number-mode 1) ; do show line no in modeline
(column-number-mode 1) ; do show col no in modeline
(tooltip-mode -1) ; don't show tooltips
;; Multiple cursors across buffers cause a strange redraw delay for
;; some things, like auto-complete or evil-mode's cursor color
;; switching.
(setq-default cursor-in-non-selected-windows nil)
(setq-default cursor-in-non-selected-windows nil
visible-bell nil ; silence of the bells
use-dialog-box nil ; avoid GUI
redisplay-dont-pause t
;; do not soft-wrap lines
truncate-lines t
truncate-partial-width-windows nil
indicate-buffer-boundaries nil
indicate-empty-lines nil
fringes-outside-margins t)
(setq-default visible-bell nil) ; silence of the bells
(setq-default use-dialog-box nil) ; avoid GUI
(setq-default redisplay-dont-pause t)
(use-package nlinum
:commands nlinum-mode
:init
(progn
(defface linum-highlight-face '((t (:inherit linum)))
"Face for line highlights")
;; do not soft-wrap lines
(setq-default truncate-lines t)
(setq-default truncate-partial-width-windows nil)
(setq-default indicate-buffer-boundaries nil)
(setq-default indicate-empty-lines nil)
;; Preset width nlinum
(add-hook! 'nlinum-mode-hook
(setq nlinum--width
(length (number-to-string
(count-lines (point-min) (point-max))))))
;; Highlight line number
(setq hl-nlinum-overlay nil)
(setq hl-nlinum-line nil)
(defun hl-nlinum-unhighlight-line ()
(when hl-nlinum-overlay
(let* ((ov hl-nlinum-overlay)
(disp (get-text-property 0 'display (overlay-get ov 'before-string)))
(str (nth 1 disp)))
(put-text-property 0 (length str) 'face 'linum str)
(setq hl-nlinum-overlay nil)
(setq hl-nlinum-line nil))))
(defun hl-nlinum-highlight-line ()
(let ((line-no (line-number-at-pos (point))))
(when (and nlinum-mode (not (eq line-no hl-nlinum-line)))
(let* ((pbol (point-at-bol))
(peol (1+ pbol)))
;; Handle EOF case
(when (>= peol (point-max))
(setq pbol (line-beginning-position 0))
(setq peol (line-end-position 0)))
(jit-lock-fontify-now pbol peol)
(let* ((overlays (overlays-in pbol peol))
(ov (-first (lambda (item) (overlay-get item 'nlinum)) overlays)))
(when ov
(hl-nlinum-unhighlight-line)
(let* ((disp (get-text-property 0 'display (overlay-get ov 'before-string)))
(str (nth 1 disp)))
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
(put-text-property 0 (length str) 'face 'linum-highlight-face str)
(setq hl-nlinum-overlay ov)
(setq hl-nlinum-line line-no))))))))
(defun nlinum-toggle ()
(interactive)
(if nlinum-mode
(nlinum-disable)
(nlinum-enable)))
(defun nlinum-enable ()
(nlinum-mode +1)
(add-hook 'post-command-hook 'hl-nlinum-highlight-line))
(defun nlinum-disable ()
(nlinum-mode -1)
(remove-hook 'post-command-hook 'hl-nlinum-highlight-line)
(hl-nlinum-unhighlight-line))
(add-hooks '(text-mode-hook prog-mode-hook) 'nlinum-enable)
(add-hook 'org-mode-hook 'nlinum-disable))
:config
(setq-default nlinum-format " %4d "))
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
@@ -58,11 +113,11 @@
;; [pedantry intensifies]
(rename-mode-name emacs-lisp-mode "Elisp")
(use-package vim-empty-lines-mode
:config (global-vim-empty-lines-mode +1))
;;;; Modeline ;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (use-package vim-empty-lines-mode
;; :config (global-vim-empty-lines-mode +1))
(use-package uniquify
:config
(setq uniquify-buffer-name-style 'post-forward-angle-brackets
@@ -70,28 +125,6 @@
uniquify-ignore-buffers-re "^\\*"))
(use-package smart-mode-line
:init
(defvar rm-blacklist
(mapconcat 'identity
'(" SP"
" Fill"
" EvilOrg"
" Abbrev"
" snipe"
" company"
" Anaconda"
" WS"
" GitGutter"
" Undo-Tree"
" Projectile\\[.+\\]"
" hs"
" ElDoc"
" wg"
" ~"
" s-/"
" emr"
" Refactor"
) "\\|"))
:config
(progn
(setq sml/no-confirm-load-theme t
@@ -99,11 +132,12 @@
sml/extra-filler (if window-system -1 0)
sml/show-remote nil
sml/modified-char "*"
sml/encoding-format nil)
(setq sml/replacer-regexp-list '(("^~/Dropbox/Projects/" "PROJECTS:")
("^~/.emacs.d/" "EMACS.D:")))
sml/encoding-format nil
sml/replacer-regexp-list '(("^~/Dropbox/Projects/" "PROJECTS:")
("^~/.emacs.d/" "EMACS.D:")
("^~/Dropbox/notes/" "NOTES:")))
;; Hide evil state indicator
(after "evil" (setq evil-mode-line-format nil))
(setq-default mode-line-misc-info
@@ -111,23 +145,24 @@
(global-mode-string ("" global-mode-string ""))))
(add-hook! 'after-change-major-mode-hook
(setq mode-line-format
'((if window-system " ")
"%e"
mode-line-mule-info
mode-line-client
mode-line-remote
mode-line-frame-identification
mode-line-buffer-identification
mode-line-modified
mode-line-modes
mode-line-misc-info
(vc-mode vc-mode)
" "
mode-line-position
" "
mode-line-front-space
))
(unless (null mode-line-format)
(setq mode-line-format
'((if window-system " ")
"%e"
;; mode-line-mule-info
;; mode-line-client
;; mode-line-remote
;; mode-line-frame-identification
mode-line-buffer-identification
mode-line-modified
mode-line-modes
mode-line-misc-info
(vc-mode vc-mode)
" "
mode-line-position
" "
mode-line-front-space
)))
(add-to-list 'mode-line-modes
'(sml/buffer-identification-filling
@@ -138,7 +173,6 @@
(let ((-linepo mode-line-position))
(sml/setup)
(sml/apply-theme 'respectful)
(setq mode-line-position -linepo)
(sml/filter-mode-line-list 'mode-line-position))))

View File

@@ -1,8 +1,3 @@
(when (functionp 'scroll-bar-mode) (scroll-bar-mode -1)) ; no scrollbar
(when (functionp 'tool-bar-mode) (tool-bar-mode -1)) ; no toolbar
(when (functionp 'menu-bar-mode) (menu-bar-mode -1)) ; no menubar
(when (fboundp 'fringe-mode) (fringe-mode '(4 . 10))) ; no nonsense
(defconst is-mac (eq system-type 'darwin))
(defconst is-linux (eq system-type 'gnu/linux))
(defconst is-windows (eq system-type 'windows-nt))
@@ -33,12 +28,10 @@
;; (setq load-prefer-newer t)
(setq debug-on-quit DEBUG-MODE)
;;;; Sane defaults ;;;;;;;;;;;;;;;;;;;;;;;
(line-number-mode 1) ; hide line no in modeline
(column-number-mode 1) ; hide col no in modeline
;;;; Sane defaults ;;;;;;;;;;;;;;;;;;;;;;;
(auto-compression-mode t) ; Transparently open compressed files
(global-font-lock-mode t) ; Enable syntax highlighting for older emacs
(global-auto-revert-mode 1) ; revert buffers for changed files
;; (global-auto-revert-mode 1) ; revert buffers for changed files
;;; window layout undo/redo
(setq winner-boring-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
@@ -51,8 +44,8 @@
:init (add-hook 'prog-mode-hook 'semantic-mode)
:config
(progn
(semantic-mode 1)
(setq semanticdb-default-save-directory (expand-file-name "semanticdb" my-tmp-dir))))
(setq semanticdb-default-save-directory (expand-file-name "semanticdb" my-tmp-dir))
(semantic-mode 1)))
;;; UTF-8 please
(setq locale-coding-system 'utf-8) ; pretty
@@ -81,26 +74,23 @@
(setq ring-bell-function 'ignore)
(setq inhibit-startup-screen t) ; don't show EMACs start screen
(setq inhibit-splash-screen t)
(setq inhibit-startup-buffer-menu t)
(setq inhibit-startup-screen t ; don't show EMACs start screen
inhibit-splash-screen t
inhibit-startup-buffer-menu t
(setq initial-major-mode 'text-mode) ; initial scratch buffer mode
(setq initial-scratch-message nil)
(setq initial-scratch-buffer nil) ; empty scratch buffer
initial-major-mode 'fundamental-mode ; initial scratch buffer mode
initial-scratch-message nil
initial-scratch-buffer nil ; empty scratch buffer
(setq compilation-always-kill t)
(setq compilation-ask-about-save nil)
(setq compilation-scroll-output t)
compilation-always-kill t
compilation-ask-about-save nil
compilation-scroll-output t)
(setq sentence-end-double-space nil) ; sentences end with periods. Period.
(setq ediff-diff-options "-w")
(setq ediff-split-window-function 'split-window-horizontally) ; side-by-side diffs
(setq ediff-window-setup-function 'ediff-setup-windows-plain) ; no extra frames
;; Fixes C-i's synonymity with TAB
(keyboard-translate ?\C-i ?\H-i)
(setq ediff-diff-options "-w"
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
ediff-window-setup-function 'ediff-setup-windows-plain) ; no extra frames
;; Don't save clipboard contents into kill-ring before replacing them
(setq save-interprogram-paste-before-kill nil)
@@ -118,7 +108,7 @@
(use-package savehist
:config
(progn
(setq savehist-file (concat my-tmp-dir "savehist") ; keep the home clean
(setq savehist-file (expand-file-name "savehist" my-tmp-dir) ; keep the home clean
history-length 1000
savehist-additional-variables '(kill-ring
global-mark-ring
@@ -131,7 +121,7 @@
(use-package saveplace
:config
(progn
(setq-default save-place-file (concat my-tmp-dir "saveplace"))
(setq-default save-place-file (expand-file-name "saveplace" my-tmp-dir))
;; activate save-place only for files that exist
(add-hook! 'find-file-hook (if (file-exists-p buffer-file-name) (setq save-place t)))))
@@ -139,10 +129,10 @@
:config
(progn
(add-hook 'kill-emacs-hook 'recentf-cleanup)
(setq recentf-save-file (concat my-tmp-dir "recentf")
(setq recentf-save-file (expand-file-name "recentf" my-tmp-dir)
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$" "/\\.cache/.+" "emacs\\.d/workgroups/.+$" ".emacs.workgroup")
recentf-max-menu-items 0
recentf-max-saved-items 1000
recentf-max-saved-items 250
recentf-auto-cleanup 'never)
(recentf-mode 1)))
@@ -320,38 +310,32 @@ the checking happens for all pairs in auto-minor-mode-alist"
(progn ; popwin config
(popwin-mode 1)
(setq popwin:popup-window-height 0.45)
;; (setq display-buffer-function 'popwin:display-buffer)
(push '("\\`\\*helm.*?\\*\\'" :regexp t :position bottom :height 15) popwin:special-display-config)
(push '("^\\*Flycheck.*\\*$" :regexp t :position bottom :height 0.25 :noselect t) popwin:special-display-config)
(push '(inf-enh-ruby-mode :position bottom :stick t) popwin:special-display-config)
(push '(snippet-mode :position bottom :stick t) popwin:special-display-config)
(push '("^\\*eclim.*\\*" :regexp t :position bottom :height 0.25) popwin:special-display-config)
(push '("*ansi-term*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
(push '("*terminal*" :position bottom :height 0.45 :stick t) popwin:special-display-config)
(push '("*Async Shell Command*" :position bottom) popwin:special-display-config)
(push '("*Shell Command Output*" :position bottom :stick t :height 15) popwin:special-display-config)
(push '("* Regexp Explain *" :position top :height 0.35) popwin:special-display-config)
(push '("*anaconda-doc*" :position bottom :height 15 :noselect t) popwin:special-display-config)
(push '("*anaconda-nav*" :position bottom :height 15 :stick t) popwin:special-display-config)
(push '("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t) popwin:special-display-config)
(push '(help-mode :height 0.5 :position bottom :stick t) popwin:special-display-config)
(push '(compilation-mode :height 0.5 :position bottom :noselect t) popwin:special-display-config)
(push '(diff-mode :position bottom :stick t) popwin:special-display-config)
(push '("*Backtrace*") popwin:special-display-config)
(push '("*Warnings*") popwin:special-display-config)
(push '("*Process List*") popwin:special-display-config)
(push '("*Compile-Log*" :height 0.3 :position bottom :noselect t) popwin:special-display-config)
(push '(" *undo-tree*" :width 0.3 :position right) popwin:special-display-config)
(push '("^\\*scratch\\*.*" :regexp t :stick t) popwin:special-display-config)
(push '(image-mode) popwin:special-display-config)
(push '("*NeoTree*" :position left :width 22 :stick t) popwin:special-display-config)
(setq popwin:special-display-config
(append '(("\\`\\*helm.*?\\*\\'" :regexp t :position bottom :height 15)
("^\\*Flycheck.*\\*$" :regexp t :position bottom :height 0.25 :noselect t)
(inf-enh-ruby-mode :position bottom :stick t)
(snippet-mode :position bottom :stick t)
("^\\*eclim.*\\*" :regexp t :position bottom :height 0.25)
("*ansi-term*" :position bottom :height 0.45 :stick t)
("*terminal*" :position bottom :height 0.45 :stick t)
("*Async Shell Command*" :position bottom)
("*Shell Command Output*" :position bottom :stick t :height 15)
("* Regexp Explain *" :position top :height 0.35)
("*anaconda-doc*" :position bottom :height 15 :noselect t)
("*anaconda-nav*" :position bottom :height 15 :stick t)
("^\\*Python.+\\*$" :regexp t :position bottom :height 20 :noselect t)
(help-mode :height 25 :position bottom :stick t)
(compilation-mode :height 0.5 :position bottom :noselect t)
(diff-mode :position bottom :stick t)
("*Backtrace*")
("*Warnings*")
("*Process List*")
("*Compile-Log*" :height 0.3 :position bottom :noselect t)
(" *undo-tree*" :width 0.3 :position right)
("^\\*scratch\\*.*" :regexp t :stick t)
(image-mode)
("*NeoTree*" :position left :width 22 :stick t))
popwin:special-display-config))
(defun popwin:toggle-popup-window ()
(interactive)

View File

@@ -1,18 +1,5 @@
(eval-when-compile (require 'cl))
(defvar my/dark-theme-p t)
(defvar my/cycle-font-i 0)
;;;###autoload
(defun load-dark-theme()
(interactive)
(load-theme *dark-theme t))
;;;###autoload
(defun load-light-theme()
(interactive)
(load-theme *light-theme t))
;;;###autoload
(defun toggle-transparency ()
(interactive)
@@ -22,13 +9,6 @@
(set-frame-parameter nil 'alpha 97)
(set-frame-parameter nil 'alpha 0))))
;;;###autoload
(defun toggle-theme ()
(interactive)
(if my/dark-theme-p
(load-light-theme)
(load-dark-theme)))
;;;###autoload
(defun toggle-fullscreen ()
(interactive)

View File

@@ -104,20 +104,6 @@ key-chord-define."
(set (make-local-variable 'require-final-newline) nil))
;; Font Defuns ;;;;;;;;;;;;;;;;;;;;;;;;;
(defun cycle-font (&optional i)
"Cycle between fonts specified in *fonts in init.el"
(interactive)
(if (numberp i)
(setq my/cycle-font-i i)
(if (>= my/cycle-font-i (1- (length *fonts)))
(setq my/cycle-font-i 0)
(cl-incf my/cycle-font-i)))
(let ((font (nth my/cycle-font-i *fonts)))
(message "Changing font to %s" (nth 1 (font-face-attributes font)))
(set-frame-font font)))
;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;
(defun my--minibuffer-quit ()
"Abort recursive edit. In Delete Selection mode, if the mark is

View File

@@ -18,7 +18,7 @@
(symbol-value mode))))
(insert uuid)
(yas-expand-from-trigger-key)
(if (string-equal uuid (string-trim (buffer-string)))
(if (string-equal uuid (s-trim (buffer-string)))
(erase-buffer)
(evil-insert-state 1))))
@@ -59,8 +59,8 @@
;; (add-template "/_layouts/.+\\.html$" "%jekyll-layout%" 'web-mode)
;; ;; Javascript
;; (add-template "\\.lbaction/Contents/Info.plist$" "%lb6%" 'nxml-mode)
;; (add-template "\\.lbaction/.+/\\(default\\|suggestions\\)\\.js$" "%lb6%" 'js-mode)
(add-template "\\.lbaction/Contents/Info.plist$" "%Info.plst%" 'lb6-mode)
(add-template "\\.lbaction/.+/\\(default\\|suggestions\\)\\.js$" "%default.js%" 'lb6-mode)
;; (add-template "/package\\.json$" "%package.json%" 'json-mode)
;; (add-template "\\.\\(json\\|jshintrc\\)$" "%%" 'json-mode)
@@ -85,5 +85,6 @@
(add-template "\\.emacs\\.d/.+\\.el$" "%initfile%" 'emacs-lisp-mode)
(add-template "\\.emacs\\.d/snippets/.+$" "%%" 'snippet-mode))
(provide 'init-auto-insert)
;;; init-auto-insert.el ends here

View File

@@ -23,21 +23,15 @@
(progn
;; Settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq c-basic-offset 4
c-tab-always-indent nil)
c-tab-always-indent nil
c-electric-flag nil)
(when is-mac
(setq my--clang-includes
'("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1"
"/usr/local/include"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
"/usr/include"
"/System/Library/Frameworks"
"/Library/Frameworks"))
(defun my--clang-includes () my--clang-includes)
(defun my--clang-includes-flags ()
(mapcar (lambda (item) (concat "-I" item)) my--clang-includes)))
(after "flycheck"
(setq flycheck-clang-language-standard "c++11"
flycheck-clang-standard-library "libc++"
flycheck-c/c++-clang-executable "clang++"
flycheck-clang-include-path '("/usr/local/include"))))
(after "company"
;; TODO Clang is *really* slow in larger projects, maybe replace it with irony-mode or ycmd?
@@ -68,12 +62,6 @@
(define-key c-mode-map (kbd "DEL") nil))
(add-hook 'c-mode-hook 'my-c/c++-settings)
(add-hook 'c++-mode-hook 'my-c/c++-settings)
(after "flycheck"
(add-hook! 'c++-mode-hook
(setq flycheck-clang-language-standard "c++11"
flycheck-clang-standard-library "libc++"
flycheck-c/c++-clang-executable "clang++"
flycheck-clang-include-path (my--clang-includes))))
(progn ; Obj-C
(add-to-list 'magic-mode-alist

View File

@@ -1,4 +1,5 @@
(use-package company
:diminish company-mode
:config
(progn
(global-company-mode 1)

View File

@@ -1,115 +0,0 @@
(use-package git-commit-mode ;
:mode (("/COMMIT_EDITMSG\\'" . git-commit-mode)
("/NOTES_EDITMSG\\'" . git-commit-mode)
("/MERGE_MSG\\'" . git-commit-mode)
("/TAG_EDITMSG\\'" . git-commit-mode)
("/PULLREQ_EDITMSG\\'" . git-commit-mode)))
(use-package git-rebase-mode
:mode ("/git-rebase-todo\\'" . git-rebase-mode))
(use-package gitconfig-mode
:mode (("/\\.?git/?config\\'" . gitconfig-mode)
("/\\.gitmodules\\'" . gitconfig-mode))
:init (add-hook 'gitconfig-mode-hook 'flyspell-mode))
(use-package gitignore-mode
:mode (("/\\.gitignore\\'" . gitignore-mode)
("/\\.git/info/exclude\\'" . gitignore-mode)
("/git/ignore\\'" . gitignore-mode)))
;;
(use-package git-gutter-fringe+
:config
(progn
(global-git-gutter+-mode 1)
;; Fixes "git-gutter+-process-diff: Wrong number of arguments: nil" error
(defadvice git-gutter+-process-diff (before git-gutter+-process-diff-advice activate)
(ad-set-arg 0 (file-truename (ad-get-arg 0))))
(fringe-helper-define 'git-gutter-fr+-added nil
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......")
(fringe-helper-define 'git-gutter-fr+-deleted nil
".X......"
".XXXXXXX"
".X......"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........"
"........")
(fringe-helper-define 'git-gutter-fr+-modified nil
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......"
".X......")))
(evil-set-initial-state 'git-commit-mode 'insert)
(evil-set-initial-state 'git-rebase-mode 'insert)
(provide 'init-git)
;;; init-git.el ends here

View File

@@ -1,3 +1,10 @@
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
;; `bang', then `search' is interpreted as regexp
(evil-define-command my:helm-recentf (&optional bang)
:repeat nil
(interactive "<!>")
(if bang (helm-recentf) (helm-projectile-recentf)))
(use-package projectile
:commands (projectile-ack
projectile-ag
@@ -25,6 +32,7 @@
helm-projectile-recentf
helm-projectile-find-other-file
helm-projectile-switch-project)
:diminish projectile-mode
:config
(progn
(setq-default projectile-enable-caching t)
@@ -37,9 +45,10 @@
(add-to-list 'projectile-globally-ignored-directories "assets")
(add-to-list 'projectile-other-file-alist '("scss" "css"))
(add-to-list 'projectile-other-file-alist '("css" "scss"))
(projectile-global-mode +1)
(use-package helm-projectile)
(projectile-global-mode +1)
;; Don't show the project name in the prompts; I already know.
(defun projectile-prepend-project-name (string) helm-global-prompt)))
@@ -50,11 +59,9 @@
helm-semantic-or-imenu
helm-etags-select
helm-apropos
helm-recentf
helm-show-kill-ring
helm-bookmarks
helm-wg
my:helm-recentf)
helm-wg)
:init
(evil-set-initial-state 'helm-mode 'emacs)
:config
@@ -82,21 +89,11 @@
(my--cleanup-buffers-add "^\\*[Hh]elm.*\\*$")
(require 'helm-files)
(progn ; helm hacks
;; No persistent header
(defadvice helm-display-mode-line (after undisplay-header activate)
(setq header-line-format nil))
;; Reconfigured `helm-recentf' to use `helm', instead of `helm-other-buffer'
(defun helm-recentf ()
(interactive)
(let ((helm-ff-transformer-show-only-basename nil))
(helm :sources '(helm-source-recentf)
:buffer "*helm recentf*"
:prompt helm-global-prompt)))
;; Hide the mode-line in helm (<3 minimalism)
(defun helm-display-mode-line (source &optional force)
(set (make-local-variable 'helm-mode-line-string)
@@ -117,20 +114,24 @@
(propertize (concat " " hlstr hlend) 'face 'helm-header))))
(when force (force-mode-line-update))))
(progn ; evil
;; Ex-mode interface for `helm-recentf' and `helm-projectile-recentf'. If
;; `bang', then `search' is interpreted as regexp
(evil-define-command my:helm-recentf (&optional bang)
:repeat nil
(interactive "<!>")
(if bang (helm-recentf) (helm-projectile-recentf))))
(bind helm-map
"C-w" 'evil-delete-backward-word
"C-u" 'helm-delete-minibuffer-contents
"C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious!
[escape] 'helm-keyboard-quit)))
(use-package helm-files
:commands (helm-recentf)
:config
(progn
;; Reconfigured `helm-recentf' to use `helm', instead of `helm-other-buffer'
(defun helm-recentf ()
(interactive)
(let ((helm-ff-transformer-show-only-basename nil))
(helm :sources '(helm-source-recentf)
:buffer "*helm recentf*"
:prompt helm-global-prompt)))))
(use-package helm-ag
:commands (helm-ag
my:helm-ag-search
@@ -189,9 +190,7 @@
(progn
(setq helm-swoop-use-line-number-face t
helm-swoop-split-with-multiple-windows t
helm-swoop-speed-or-color t
;; helm-swoop-split-window-function 'popwin:popup-buffer
)
helm-swoop-speed-or-color t)
;; Ex-mode interface for `helm-swoop', `helm-multi-swoop-all' (if `bang'), or
;; `helm-css-scss' and `helm-css-scss-multi' (if `bang') if major-mode is

View File

@@ -30,6 +30,7 @@
ido-save-directory-list-file (concat my-tmp-dir "ido.last"))
(add-to-list 'ido-ignore-files "\\`.DS_Store$")
(add-to-list 'ido-ignore-files "Icon\\?$")
(setq ido-ignore-buffers
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"

View File

@@ -18,12 +18,12 @@
(after "emr" (use-package js2-refactor))
(rename-mode-name js2-mode "Javascript2")
(use-package tern
:diminish (tern-mode . "tern")
:commands tern-mode
:init
(progn
(add-hook 'js2-mode-hook 'tern-mode)
(after "auto-complete" (add-hook 'js2-mode-hook 'tern-ac-setup)))
:init (add-hook 'js2-mode-hook 'tern-mode)
:config
(after "company"
(use-package company-tern

View File

@@ -1,30 +1,33 @@
(use-package org
:commands (org-capture
org-capture-string
my:org-capture)
:mode (("\\.org$" . org-mode)
("\\.opml$" . org-mode))
:init
(progn
(add-hook 'org-mode-hook 'enable-tab-width-2)
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook 'org-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook 'iimage-mode)
(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook! 'org-mode-hook (hl-line-mode -1)))
:config
(progn
(after "org-indent" (diminish 'org-indent-mode))
(after "iimage" (diminish 'iimage-mode))
;; Reset evil to ensure evil-org-mode's maps work
(add-hook! 'org-mode-hook (evil-mode nil) (evil-mode 1))
(setq org-directory "~/Dropbox/notes"
org-default-notes-file "~/Dropbox/notes/notes.org"
org-agenda-files '("~/Dropbox/notes"
"~/Dropbox/notes/projects"
"~/Dropbox/notes/projects/dev"
"~/Dropbox/notes/projects/gamedev"
"~/Dropbox/notes/projects/webdev")
org-archive-location "~/Dropbox/notes/archive/%s::"
(setq org-directory "~/Dropbox/notes")
(setq org-project-directory (expand-file-name "projects" org-directory) ; custom variable
org-default-notes-file (expand-file-name "notes.org" org-directory)
org-agenda-files (append (list org-directory)
(f-entries org-project-directory (lambda (path) (f-ext? path "org")) t))
org-archive-location (concat org-directory "/archive/%s::")
org-confirm-babel-evaluate nil
org-src-tab-acts-natively t
org-image-actual-width 300
org-startup-with-inline-images t)
(setq org-completion-use-ido t
org-image-actual-width 250
org-startup-with-inline-images t
org-completion-use-ido t
org-hidden-keywords '(title)
org-special-ctrl-a/e t
org-hide-leading-stars t
@@ -32,14 +35,19 @@
org-checkbox-hierarchical-statistics t
org-tags-column -87
org-log-done t
org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "DOING(s)" "PENDING(p)")
(sequence "|" "CANCELLED(c)")))
org-confirm-elisp-link-function nil
org-startup-folded 'content
org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "DOING(s)" "PENDING(p)")
(sequence "|" "CANCELLED(c)"))
org-mobile-directory "~/Dropbox/Apps/MobileOrg"
org-mobile-inbox-for-pull (expand-file-name "mobile.org" org-directory))
(setq org-src-fontify-natively t)
(setq org-blank-before-new-entry '((heading . auto) (plain-list-item . auto)))
(setq org-export-backends '(ascii html latex md opml))
(setq org-src-fontify-natively t
org-blank-before-new-entry '((heading . auto) (plain-list-item . auto))
org-export-backends '(ascii html latex md opml))
(add-to-list 'org-link-frame-setup '(file . find-file))
(setq org-tag-alist '(("@home" . ?h)
("@daily" . ?d)
@@ -50,35 +58,26 @@
("@writing" . ?w)
("@projects" . ?r)))
(defun project-org-filename (cat)
(interactive (list (completing-read "Choose category:"
(mapcar 'f-filename (f-directories org-project-directory)))))
(expand-file-name (concat (f-filename (project-root)) ".org")
(expand-file-name cat org-project-directory)))
(setq org-capture-templates
'(("t" "TODO" entry (file+headline "~/Dropbox/notes/todo.org" "Inbox") "* TODO %? %u\n%i")
("T" "Project TODO" entry (file+headline (concat (projectile-project-root) "/TODO.org") "Unsorted") "** %u %?\n%i" :prepend t)
("c" "Changelog" entry (file+headline (concat (projectile-project-root) "/CHANGELOG.org") "Unsorted") "** %u %? :unsorted:\n%i" :prepend t)
("n" "Note" entry (file+headline org-default-notes-file "Unfiled") "** %T %?\n%i" :prepend t)
("T" "Project TODO" entry (file+headline (project-org-filename) "Tasks") "** TODO %?\n%i" :prepend t)
("N" "Project Note" entry (file+headline (project-org-filename) "Notes") "** %u %?\n%i")
("c" "Changelog" entry (file+datetree (project-org-filename)) "** %<%H:%M>: %? :unsorted:\n%i" :prepend t)
("n" "Note" entry (file+datetree org-default-notes-file) "** %<%H:%M>: %?\n%i" :prepend t)
("j" "Journal" entry (file+datetree "~/Dropbox/notes/journal.org") "** %?%^g\nAdded: %U\n%i")
("a" "Trivia" entry (file "~/Dropbox/notes/trivia.org") "* %u %?\n%i" :prepend t)
("s" "Writing Scraps" entry (file "~/Dropbox/notes/writing.org") "* %u %?\n%i" :prepend t)
("v" "Vocab" entry (file "~/Dropbox/notes/vocab.org") "* %?\n%i" :prepend t)
("e" "Excerpt" entry (file "~/Dropbox/notes/excerpts.org") "* %u %?\n%i" :prepend t)))
(setq org-agenda-custom-commands
'(("x" agenda)
("y" agenda*)
("w" todo "WAITING")
("W" todo-tree "WAITING")
("to" todo)
("tp" tags "+Projects")
("tg" tags-todo "+gamedev")
("tw" tags-tree "+webdev"))))
:config
(progn
(message "Org-mode loaded")
(setq iimage-mode-image-regex-alist
'(("\\(`?file://\\|\\[\\[\\|<\\|`\\)?\\([-+./_0-9a-zA-Z]+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)\\(\\]\\]\\|>\\|'\\)?" . 2)
("<\\(http://.+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)>" . 1)))
(push '("\\*Org.+\\*" :regexp t :width 0.3 :position bottom) popwin:special-display-config)
'(("\\(`?file://\\|\\[\\[\\|<\\|`\\)?\\([-+./_0-9a-zA-Z]+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)\\(\\]\\]\\|>\\|'\\)?" . 2)
("<\\(http://.+\\.\\(GIF\\|JP\\(?:E?G\\)\\|P\\(?:BM\\|GM\\|N[GM]\\|PM\\)\\|SVG\\|TIFF?\\|X\\(?:[BP]M\\)\\|gif\\|jp\\(?:e?g\\)\\|p\\(?:bm\\|gm\\|n[gm]\\|pm\\)\\|svg\\|tiff?\\|x\\(?:[bp]m\\)\\)\\)>" . 1)))
(org-babel-do-load-languages 'org-babel-load-languages
'((python . t)
@@ -92,54 +91,31 @@
(defadvice evil-force-normal-state (before evil-esc-org-remove-highlights activate)
(org-remove-occur-highlights))
;; Auto update cookies
(defun my--org-mode-update-cookies ()
(when (eq major-mode 'org-mode) (org-update-parent-todo-statistics) (org-update-statistics-cookies nil)))
(add-hook 'evil-normal-state-entry-hook 'my--org-mode-update-cookies)
(define-minor-mode evil-org-mode
:init-value nil
:lighter " EvilOrg"
:lighter " !"
:keymap (make-sparse-keymap) ; defines evil-org-mode-map
:group 'evil-org)
;; (use-package org-present
;; :config
;; (progn
;; (defun my--org-present-mode-on ()
;; (org-present-big)
;; (org-display-inline-images)
;; (org-present-hide-cursor)
;; (org-present-read-only))
;; (progn ; opml support
;; (defun set-buffer-file-format-to-opml ()
;; (when (string-match "\.opml$" (buffer-file-name))
;; (setq buffer-file-format '(opml))))
;; (defun my--org-present-mode-off ()
;; (org-present-small)
;; (org-remove-inline-images)
;; (org-present-show-cursor)
;; (org-present-read-write))
;; (defun my--opml-encode (begin end buffer)
;; "Export Org mode buffer to OPML."
;; (let ((org-export-show-temporary-export-buffer nil)
;; (name "*OPML Export Buffer*"))
;; (org-export-to-buffer 'opml name)
;; (erase-buffer)
;; (insert-buffer-substring (get-buffer name))
;; (point-max)))
;; (add-hook 'org-present-mode-hook 'my--org-present-mode-on)
;; (add-hook 'org-present-mode-quit-hook 'my--org-present-mode-off)))
(progn ; opml support
(defun set-buffer-file-format-to-opml ()
(when (string-match "\.opml$" (buffer-file-name))
(setq buffer-file-format '(opml))))
(defun my--opml-encode (begin end buffer)
"Export Org mode buffer to OPML."
(let ((org-export-show-temporary-export-buffer nil)
(name "*OPML Export Buffer*"))
(org-export-to-buffer 'opml name)
(erase-buffer)
(insert-buffer-substring (get-buffer name))
(point-max)))
(add-hook 'find-file-hooks 'set-buffer-file-format-to-opml)
(add-to-list 'format-alist '(opml "Outline Processor Markup Language"
"<[?]xml version=\"1.0\"[^>]*[?]>[\n]?.*[\n]?.*[\n]?<opml version=\"[1|2].0\">"
"~/.emacs.d/elisp/org-opml/opml2org.py" my--opml-encode t))
(shut-up (load-library "ox-opml")))
;; (add-hook 'find-file-hooks 'set-buffer-file-format-to-opml)
;; (add-to-list 'format-alist '(opml "Outline Processor Markup Language"
;; "<[?]xml version=\"1.0\"[^>]*[?]>[\n]?.*[\n]?.*[\n]?<opml version=\"[1|2].0\">"
;; "~/.emacs.d/elisp/org-opml/opml2org.py" my--opml-encode t))
;; (shut-up (load-library "ox-opml")))
(progn ; key bindings
(defun my--org-in-list-p ()
@@ -185,6 +161,42 @@
(t (org-insert-heading)))
(insert "[ ] ")))
;; Hide properties PERMANENTLY
(defun org-cycle-hide-drawers (state)
"Re-hide all drawers after a visibility state change."
(when (and (derived-mode-p 'org-mode)
(not (memq state '(overview folded contents))))
(save-excursion
(let* ((globalp (memq state '(contents all)))
(beg (if globalp (point-min) (point)))
(end (if globalp (point-max)
(if (eq state 'children)
(save-excursion (outline-next-heading) (point))
(org-end-of-subtree t)))))
(goto-char beg)
(while (re-search-forward org-drawer-regexp end t)
(save-excursion
(beginning-of-line 1)
(backward-char 1)
(let ((b (point)))
(if (re-search-forward
"^[ \t]*:END:"
(save-excursion (outline-next-heading) (point)) t)
(outline-flag-region b (point-at-eol) t)
(user-error ":END: line missing at position %s" b)))))))))
(use-package org-agenda
:config
(setq org-agenda-restore-windows-after-quit t
org-agenda-custom-commands '(("x" agenda)
("y" agenda*)
("w" todo "WAITING")
("W" todo-tree "WAITING")
("to" todo)
("tp" tags "+Projects")
("tg" tags-todo "+gamedev")
("tw" tags-tree "+webdev"))))
(bind 'insert org-mode-map [remap my.inflate-space-maybe] 'self-insert-command)
(bind org-mode-map
@@ -193,14 +205,14 @@
"C-k" nil)
(bind '(normal insert) evil-org-mode-map
"¬" 'org-metaright ; M-j
"˙" 'org-metaleft ; M-h
"˚" 'org-metaup ; M-k
"Δ" 'org-metadown ; M-j
"Ò" 'org-shiftmetaright ; M-L
"Ó" 'org-shiftmetaleft ; M-H
"" 'org-shiftmetaup ; M-K
"Ô" 'org-shiftmetadown) ; M-J
"A-l" 'org-metaright ; M-j
"A-h" 'org-metaleft ; M-h
"A-k" 'org-metaup ; M-k
"A-j" 'org-metadown ; M-j
"A-l" 'org-shiftmetaright ; M-L
"A-h" 'org-shiftmetaleft ; M-H
"A-k" 'org-shiftmetaup ; M-K
"A-j" 'org-shiftmetadown) ; M-J
(bind 'insert evil-org-mode-map
"C-e" 'org-end-of-line
@@ -215,65 +227,90 @@
(defun my/org-surround (delim)
(insert delim) (save-excursion (insert delim)))
(bind 'insert evil-org-mode-map
(bind evil-org-mode-map
"M-a" 'mark-whole-buffer
'insert
;; Add new header line before this line
(kbd "<S-M-return>") 'my--org-insert-item-before
"<S-M-return>" 'my--org-insert-item-before
;; Add new header line after this line
(kbd "<M-return>") 'my--org-insert-item-after
"<M-return>" 'my--org-insert-item-after
(kbd "M-b") (λ (my/org-surround "*")) ; bold
(kbd "M-u") (λ (my/org-surround "_")) ; underline
(kbd "M-i") (λ (my/org-surround "/")) ; italics
(kbd "M-`") (λ (my/org-surround "+"))) ; strikethrough
(bind 'visual evil-org-mode-map
(kbd "M-b") "S*"
(kbd "M-u") "S_"
(kbd "M-i") "S/"
(kbd "M-`") "S+")
"M-b" (λ (my/org-surround "*")) ; bold
"M-u" (λ (my/org-surround "_")) ; underline
"M-i" (λ (my/org-surround "/")) ; italics
"M-`" (λ (my/org-surround "+")) ; strikethrough
(bind '(normal visual) evil-org-mode-map
", l" 'org-insert-link)
'visual
"M-b" "S*"
"M-u" "S_"
"M-i" "S/"
"M-`" "S+"
(bind 'normal evil-org-mode-map
", +" 'org-align-all-tags
", /" 'org-sparse-tree
", ?" 'org-tags-view
", a" 'org-attach
", D" 'org-time-stamp-inactive
", T" 'org-show-todo-tree
", d" 'org-time-stamp
", r" 'org-refile
", s" 'org-schedule
", t" 'org-todo
"g r" 'org-babel-execute-src-block-maybe
"g h" 'outline-up-heading
"g j" 'org-forward-heading-same-level
"g k" 'org-backward-heading-same-level
"g l" 'outline-next-visible-heading
"g o" 'org-open-at-point
"g O" 'org-attach-open
"g C-o" 'org-attach-reveal
"g i" (λ (if (> (length org-inline-image-overlays) 0)
'(normal visual)
", l" 'org-insert-link
'normal
",=" 'org-align-all-tags
",/" 'org-sparse-tree
",?" 'org-tags-view
",a" 'org-attach
",D" 'org-time-stamp-inactive
",T" 'org-show-todo-tree
",d" 'org-time-stamp
",r" 'org-refile
",s" 'org-schedule
",t" 'org-todo
"gr" 'org-babel-execute-src-block-maybe
"gh" 'outline-up-heading
"gj" 'org-forward-heading-same-level
"gk" 'org-backward-heading-same-level
"gl" 'outline-next-visible-heading
"go" 'org-open-at-point
"gO" 'org-attach-open
"gC-o" 'org-attach-reveal
"gI" (λ (if (> (length org-inline-image-overlays) 0)
(org-remove-inline-images)
(org-display-inline-images nil t (line-beginning-position) (line-end-position))))
"g Q" 'org-fill-paragraph
"g a" 'org-attach
"g A" 'org-agenda
"g t" 'org-show-todo-tree
"gQ" 'org-fill-paragraph
"ga" 'org-attach
"gA" 'org-agenda
"gt" 'org-show-todo-tree
"]l" 'org-next-link
"[l" 'org-previous-link
"$" 'org-end-of-line
"^" 'org-beginning-of-line
"<" 'org-metaleft
">" 'org-metaright
"-" 'org-cycle-list-bullet
", SPC" 'my--toggle-checkbox
", <return>" 'org-archive-subtree
",SPC" 'my--toggle-checkbox
",<return>" 'org-archive-subtree
"<S-M-return>" 'my--org-insert-item-before
"<M-return>" 'my--org-insert-item-after
"RET" (λ (cond ((org-at-item-checkbox-p)
(org-toggle-checkbox))
((org-entry-is-todo-p)
(org-todo 'done))))
[tab] 'org-cycle))
[tab] 'org-cycle)
(after "org-agenda"
(bind 'emacs org-agenda-mode-map
"<escape>" 'org-agenda-Quit
"C-j" 'org-agenda-next-item
"C-k" 'org-agenda-previous-item
"C-n" 'org-agenda-next-item
"C-p" 'org-agenda-previous-item)))
(evil-define-operator my:org-capture (&optional beg end)
"Send a selection to org-capture."
:move-point nil
:type inclusive
(interactive "<r><!>")
(let ((text (when (and (evil-visual-state-p) beg end)
(buffer-substring beg end))))
(if text
(org-capture-string text)
(org-capture))))
(evil-define-command my:org-insert-image-url (&optional image-url)
:repeat nil

12
init/init-present.el Normal file
View File

@@ -0,0 +1,12 @@
(defconst *big-font (font-spec :family "Inconsolata" :size 18 :antialias t))
(defvar big-mode nil)
(defun toggle-big-mode ()
(interactive)
(if big-mode
(set-frame-font *default-font)
(set-frame-font *big-font))
(setq big-mode (not big-mode)))
(provide 'init-present)
;;; init-present.el ends here

View File

@@ -6,28 +6,52 @@
(defun my-neotree-open (&optional dir)
(interactive)
(neotree-dir (or dir (project-root))))
(defun my-neotree-toggle ()
(interactive)
(if (neo-global--window-exists-p)
(neotree-hide)
(my-neotree-open)))
(defun my-neotree-find ()
(interactive)
(save-excursion (my-neotree-open))
(neotree-find)))
(neotree-find))
(add-hook 'neotree-mode-hook 'my-neotree-keymap))
:config
(progn
(setq neo-create-file-auto-open t
neo-mode-line-type 'neotree
neo-mode-line-type 'none
neo-persist-show t
neo-window-width 28
neo-window-width 22
neo-show-updir-line nil
neo-auto-indent-point t)
neo-auto-indent-point t
neo-banner-message nil
;; requires <https://github.com/jeffplang/emacs-neotree> fork of
;; neotree (at least, until the PR is accepted). Causes neotree to
;; open in a vertical split that consumes the entire height of the
;; frame.
neo-modern-sidebar t)
;; Custom ascii theme
(defun neo-buffer--insert-fold-symbol (name)
(let ((n-insert-symbol (lambda (n)
(neo-buffer--insert-with-face
n 'neo-expand-btn-face))))
(or (and (equal name 'open) (funcall n-insert-symbol "- "))
(and (equal name 'close) (funcall n-insert-symbol "> "))
(and (equal name 'leaf) (funcall n-insert-symbol " ")))))
;; Close neotree on window changes, to prevent ensuing mindbuggery
(add-hook! 'window-configuration-change-hook
(unless (and (neo-global--window-exists-p)
(eq (current-buffer) (neo-global--get-buffer)))
(neotree-hide)))
(after "projectile"
(setq projectile-switch-project-action 'neotree-projectile-action))
(add-to-list 'evil-motion-state-modes 'neotree-mode)
(defun my-neotree-keymap ()
(bind evil-motion-state-local-map
"ESC" 'neotree-hide
"\\\\" 'neotree-hide
"RET" 'neotree-enter
"J" 'neotree-select-next-sibling-node
@@ -42,9 +66,7 @@
"q" 'neotree-hide
"r" 'neotree-rename-node
"R" 'neotree-change-root
"?" 'neotree-))
(add-hook 'neotree-mode-hook 'my-neotree-keymap)))
"?" 'neotree-))))
(provide 'init-project)

View File

@@ -18,8 +18,9 @@
(progn
(add-hook 'python-mode-hook 'anaconda-mode)
(add-hook 'python-mode-hook 'eldoc-mode)
(add-hook! 'anaconda-mode-hook
(process-buffer (python-shell-get-or-create-process python-shell-interpreter t nil))))
;; (add-hook! 'anaconda-mode-hook
;; (process-buffer (python-shell-get-or-create-process python-shell-interpreter t nil)))
)
:config
(progn
(bind 'motion anaconda-mode-map "gd" 'anaconda-mode-goto-definitions)

120
init/init-vc.el Normal file
View File

@@ -0,0 +1,120 @@
(use-package git-commit-mode ;
:mode (("/COMMIT_EDITMSG\\'" . git-commit-mode)
("/NOTES_EDITMSG\\'" . git-commit-mode)
("/MERGE_MSG\\'" . git-commit-mode)
("/TAG_EDITMSG\\'" . git-commit-mode)
("/PULLREQ_EDITMSG\\'" . git-commit-mode))
:config
(evil-set-initial-state 'git-commit-mode 'insert))
(use-package git-rebase-mode
:mode ("/git-rebase-todo\\'" . git-rebase-mode)
:config
(evil-set-initial-state 'git-rebase-mode 'insert))
(use-package gitconfig-mode
:mode (("/\\.?git/?config\\'" . gitconfig-mode)
("/\\.gitmodules\\'" . gitconfig-mode))
:init (add-hook 'gitconfig-mode-hook 'flyspell-mode))
(use-package gitignore-mode
:mode (("/\\.gitignore\\'" . gitignore-mode)
("/\\.git/info/exclude\\'" . gitignore-mode)
("/git/ignore\\'" . gitignore-mode)))
(use-package diff-hl
:config
(progn
(setq diff-hl-draw-borders nil)
(global-diff-hl-mode +1)))
;; (use-package git-gutter-fringe+
;; :diminish (git-gutter+-mode . " git")
;; :config
;; (progn
;; ;; (global-git-gutter+-mode +1)
;; (add-hooks '(text-mode-hook prog-mode-hook) 'git-gutter+-mode)
;; ;; Fixes "git-gutter+-process-diff: Wrong number of arguments: nil" error
;; (defadvice git-gutter+-process-diff (before git-gutter+-process-diff-advice activate)
;; (ad-set-arg 0 (file-truename (ad-get-arg 0))))
;; (fringe-helper-define 'git-gutter-fr+-added nil
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X....")
;; (fringe-helper-define 'git-gutter-fr+-deleted nil
;; "....X...."
;; "....XXXXX"
;; "....XXXXX"
;; "....X...."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; "........."
;; ".........")
;; (fringe-helper-define 'git-gutter-fr+-modified nil
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X...."
;; "....X....")))
(provide 'init-vc)
;;; init-vc.el ends here

View File

@@ -1,15 +1,15 @@
(use-package workgroups2
:diminish workgroups-mode
:config
(progn
(setq wg-session-file "~/.emacs.workgroup")
(setq wg-workgroup-directory "~/.emacs.d/workgroups/")
(setq wg-first-wg-name "main")
(setq wg-session-load-on-start t)
;; What to do on Emacs exit / workgroups-mode exit?
(setq wg-emacs-exit-save-behavior 'save) ; Options: 'save 'ask nil
(setq wg-workgroups-mode-exit-save-behavior 'save) ; Options: 'save 'ask nil
(setq wg-session-file "~/.emacs.workgroup"
wg-workgroup-directory "~/.emacs.d/workgroups/"
wg-first-wg-name "main"
wg-session-load-on-start t
wg-mode-line-display-on nil
;; What to do on Emacs exit / workgroups-mode exit?
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
wg-workgroups-mode-exit-save-behavior 'save) ; Options: 'save 'ask nil
(evil-define-command my:save-session (&optional bang session-name)
(interactive "<!><a>")

View File

@@ -1,5 +1,5 @@
(use-package yasnippet
:defer t
:diminish (yas-minor-mode . " @")
:commands (yas-minor-mode yas-minor-mode-on my--init-yas-mode my:snippets)
:mode (("emacs\\.d/snippets/.+$" . snippet-mode))
:init
@@ -13,6 +13,7 @@
(add-hook 'snippet-mode-hook 'yas-minor-mode-on)
(add-hook 'text-mode-hook 'yas-minor-mode-on)
(add-hook 'prog-mode-hook 'yas-minor-mode-on)
(add-hook 'js2-mode-hook 'yas-minor-mode-on)
(add-hook 'org-mode-hook 'yas-minor-mode-on)
(add-hook 'snippet-mode-hook 'disable-final-newline))
:config

View File

@@ -22,7 +22,7 @@
'normal
"M-o" 'ido-find-file
"M-O" 'my-ido-find-project-file
"M-d" 'dash-at-point
"<f1>" 'dash-at-point
"M-R" 'my:eval-buffer)
(when is-mac
@@ -59,14 +59,17 @@
"E" 'my:init-files
"g" 'git-gutter+-show-hunk
"h" 'helm-apropos
"n" 'my:notes
"m" 'helm-recentf
"M" 'helm-projectile-recentf ; recent PROJECT files
"p" 'helm-projectile-switch-project
"r" 'emr-show-refactor-menu ; init-dev.el
"x" 'my:org-capture
"qq" 'evil-save-and-quit
"QQ" (λ (my:kill-buffers t) (evil-quit-all))
"oo" 'my-open-with
"ob" (λ (my-open-with "Google Chrome"))
"of" (λ (my-open-with "Finder.app" default-directory))
"oF" (λ (my-open-with "Finder.app" (project-root)))
"ou" (λ (my-open-with "Transmit"))
@@ -82,7 +85,7 @@
(bind my-localleader-map
"\\" 'my-neotree-toggle
"." 'my-neotree-find
";" 'linum-mode
";" 'nlinum-toggle
"=" 'toggle-transparency
"E" 'evil-emacs-state
@@ -97,8 +100,8 @@
(bind 'normal
"," 'my-leader-map
"\\" 'my-localleader-map
"," 'my-leader-map
"\\" 'my-localleader-map
;; behave like D and C; yank to end of line
"Y" (λ (evil-yank (point) (point-at-eol)))
@@ -117,7 +120,7 @@
"gy" 'evil-commentary-yank
'visual
", =" 'align-regexp
",=" 'align-regexp
;; vnoremap < <gv
"<" (λ (evil-shift-left (region-beginning) (region-end))
@@ -128,8 +131,6 @@
(evil-normal-state)
(evil-visual-restore))
'normal "X" 'evil-exchange
'motion
"%" 'evilmi-jump-items
[tab] 'evilmi-jump-items ; alias for %
@@ -140,12 +141,14 @@
"]e" (λ (call-interactively (if flycheck-mode 'flycheck-next-error 'next-error)))
"[e" (λ (call-interactively (if flycheck-mode 'flycheck-previous-error 'previous-error)))
"]\\" 'er/expand-region
"[\\" 'er/contract-region
"C-=" 'er/expand-region
"C--" 'er/contract-region
"gl" (λ (linum-mode 1) (evil-ex "") (linum-mode -1))
"gx" 'my-scratch-buffer ; send to scratch buffer
;; "gl" (λ (nlinum-enable) (evil-ex "") (nlinum-disable))
"gx" 'evil-exchange
"gr" 'my:eval-region ; init-dev.el
"g]" 'smart-down
"g[" 'smart-up
'insert
"<A-backspace>" 'evil-delete-backward-word
@@ -213,6 +216,10 @@
(after "help-mode"
(bind 'normal help-mode-map
"<escape>" (λ (kill-buffer)
(if (eq popwin:popup-buffer (current-buffer))
(popwin:close-popup-window)
(evil-window-delete)))
"]]" 'help-go-forward
"[[" 'help-go-back))
@@ -301,10 +308,6 @@
((string-match "^ \\*" (buffer-name (current-buffer)))
(bury-buffer))))
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
(bind map "\C-w" 'evil-delete-backward-word))
(global-unset-key (kbd "<drag-mouse-1>"))
(provide 'my-bindings)
;;; my-bindings.el ends here

View File

@@ -6,34 +6,19 @@
;; Implements some helpful keymappings for emacs sub-modes
(add-hook! 'ido-setup-hook
(bind ido-completion-map
(kbd "<backspace>") 'ido-delete-backward-updir
"\C-w" 'ido-delete-backward-word-updir))
"<backspace>" 'ido-delete-backward-updir
"C-w" 'ido-delete-backward-word-updir))
(bind 'emacs [escape] 'my--minibuffer-quit)
(bind 'normal evil-command-window-mode-map [escape] 'kill-buffer-and-window)
;; (bind evil-ex-map [escape] 'my--minibuffer-quit)
(dolist (map (list evil-ex-search-keymap minibuffer-local-map))
(bind map "\C-w" 'evil-delete-backward-word))
;; (dolist (map (list evil-ex-search-keymap minibuffer-local-map ido-common-completion-map ido-completion-map))
;; (bind map "C-w" 'evil-delete-backward-word))
(bind minibuffer-local-map "\C-u" 'evil-delete-whole-line)
;; Redefine to get rid of that silly delete-other-windows nonsense
;; (defun keyboard-escape-quit ()
;; (interactive)
;; (cond ((eq last-command 'mode-exited) nil)
;; ((region-active-p)
;; (deactivate-mark))
;; ((> (minibuffer-depth) 0)
;; (abort-recursive-edit))
;; (current-prefix-arg
;; nil)
;; ((> (recursion-depth) 0)
;; (exit-recursive-edit))
;; (buffer-quit-function
;; (funcall buffer-quit-function))
;; ((string-match "^ \\*" (buffer-name (current-buffer)))
;; (bury-buffer))))
(global-unset-key (kbd "<drag-mouse-1>"))
(if is-mac (global-set-key (kbd "M-q") (λ (message "Gee, I dunno Brain..."))))