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

2
.gitignore vendored
View file

@ -18,5 +18,5 @@ smex-items
*.dat
*.eld
*.cache
*.cache-*
*.log

8
Cask
View file

@ -13,7 +13,8 @@
(depends-on "use-package")
(depends-on "smex")
(depends-on "pos-tip")
;;(depends-on "vim-empty-lines-mode")
(depends-on "nlinum")
(depends-on "vim-empty-lines-mode")
(depends-on "hlinum" :git "https://github.com/tom-tan/hlinum-mode")
;; OSX
@ -34,7 +35,8 @@
(depends-on "rainbow-delimiters")
(depends-on "smartparens")
(depends-on "yasnippet")
(depends-on "git-gutter-fringe+")
(depends-on "diff-hl")
;; (depends-on "git-gutter-fringe+")
;; (depends-on "ace-jump-mode")
(depends-on "pcre2el")
(depends-on "emr")
@ -73,7 +75,7 @@
(depends-on "helm-projectile")
(depends-on "helm-swoop")
(depends-on "helm-company")
(depends-on "neotree")
(depends-on "neotree" :git "https://github.com/jeffplang/emacs-neotree")
(depends-on "ido-ubiquitous")
(depends-on "ido-vertical-mode")
(depends-on "flx-ido")

467
contrib/applescript-mode.el Normal file
View file

@ -0,0 +1,467 @@
;;; applescript-mode.el --- major mode for editing AppleScript source
;; Copyright (C) 2004 MacEmacs JP Project
;;; Credits:
;; Copyright (C) 2003,2004 FUJIMOTO Hisakuni
;; http://www.fobj.com/~hisa/w/applescript.el.html
;; Copyright (C) 2003 443,435 (Public Domain?)
;; http://pc.2ch.net/test/read.cgi/mac/1034581863/
;; Copyright (C) 2004 Harley Gorrell <harley@mahalito.net>
;; http://www.mahalito.net/~harley/elisp/osx-osascript.el
;; Author: sakito <sakito@users.sourceforge.jp>
;; Keywords: languages, tools
(defconst applescript-mode-version "$Revision$"
"The current version of the AppleScript mode.")
(defconst applescript-mode-help-address "sakito@users.sourceforge.jp"
"Address accepting submission of bug reports.")
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;; acquired from http://github.com/ieure/applescript-mode/
;;; Commentary:
;; AppleScript Mode
;;; Usage:
;; To use applescript-mode.el put the following line in your .emacs:
;; (autoload 'applescript-mode "applescript-mode"
;; "Major mode for editing AppleScript source." t)
;; (add-to-list 'auto-mode-alist '("\\.applescript$" . applescript-mode))
;; Please use the SourceForge MacEmacs JP Project to submit bugs or
;; patches:
;;
;; http://sourceforge.jp/projects/macemacsjp
;; FOR MORE INFORMATION:
;; There is some information on applescript-mode.el at
;; http://macemacsjp.sourceforge.jp/documents/applescript-mode/
;;; Code:
;; user customize variables
(defgroup applescript nil
"Support for AppleScript, <http://www.apple.com/applescript/>"
:group 'languages
:prefix "as-")
(defcustom as-osascript-command "osascript"
"*execute AppleScripts and other OSA language scripts."
:type 'string
:group 'applescript)
(defcustom as-osacompile-command "osacompile"
"*compile AppleScripts and other OSA language scripts."
:type 'string
:group 'applescript)
(defcustom as-osascript-command-args '("-ss")
"*List of string arguments to be used when starting a osascript."
:type '(repeat string)
:group 'applescript)
(defcustom as-indent-offset 4
"*Amount of offset per level of indentation.
`\\[as-guess-indent-offset]' can usually guess a good value when
you're editing someone else's AppleScript code."
:type 'integer
:group 'applescript)
(defcustom as-continuation-offset 4
"*Additional amount of offset to give for some continuation lines.
Continuation lines are those that immediately follow a
Continuation sign terminated line. Only those continuation lines
for a block opening statement are given this extra offset."
:type 'integer
:group 'applescript)
;; Face Setting
;; Face for true, false, me, it
(defvar as-pseudo-keyword-face 'as-pseudo-keyword-face
"Face for pseudo keywords in AppleScript mode, like me, true, false.")
(make-face 'as-pseudo-keyword-face)
;; Face for command
(defvar as-command-face 'as-command-face
"Face for command like copy, get, set, and error.")
(make-face 'as-command-face)
(defun as-font-lock-mode-hook ()
(or (face-differs-from-default-p 'as-pseudo-keyword-face)
(copy-face 'font-lock-keyword-face 'as-pseudo-keyword-face))
(or (face-differs-from-default-p 'as-command-face)
(copy-face 'font-lock-keyword-face 'as-command-face)))
(add-hook 'font-lock-mode-hook 'as-font-lock-mode-hook)
(defvar applescript-font-lock-keywords
(let (
;; expressions and control Statements
(kw1 (regexp-opt
'("and" "app" "application" "considering" "div"
"else" "end" "exit" "is" "mod" "not" "on" "or"
"if" "ignoring" "reopen" "repeat"
"tell" "then" "to"
"using[ \t]terms[ \t]from"
"with[ \t]timeout" "with[ \t]transaction")))
;; commands
(kw2 (regexp-opt
'("ASCII[ \t]character" "ASCII[ \t]number" "activate" "AGStart"
"beep" "copy" "count" "choose[ \t]application"
"choose[ \t]file" "choose[ \t]folder" "close[ \t]access"
"current[ \t]date" "display[ \t]dialog" "get" "get[ \t]EOF"
"info[ \t]for" "launch" "list[ \t]disks" "list[ \t]folder"
"load[ \t]script" "log" "monitor[ \t]depth" "max[ \t]monitor[ \t]depth"
"min[ \t]monitor[ \t]depth" "new[ \t]file" "offset"
"open[ \t]for[ \t]access" "path[ \t]to" "random[ \t]number"
"read" "round" "run" "run[ \t]script" "scripting[ \t]component"
"set" "set[ \t]EOF" "set[ \t]monitor[ \t]depth" "set[ \t]volume"
"start[ \t]log" "stop[ \t]log" "store[ \t]script"
"time[ \t]to[ \t]GMT" "write")))
;; misc
(kw3 (regexp-opt
'("buttons" "default[ \t]answer" "default[ \t]button"
"to[ \t]begining[ \t]of" "to[ \t]word" "starting[ \t]at"
"with[ \t]icon" "write[ \t]permission"))))
(list
;; keywords
(cons (concat "\\b\\(" kw1 "\\)\\b[ \n\t(]") 1)
(cons (concat "\\b\\(" kw2 "\\)\\b[ \n\t(]") 1)
;; kw3 not yet..
(cons (concat "\\b\\(" kw3 "\\)\\b[ \n\t(]") 1)
;; functions
'("\\bon[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
1 font-lock-function-name-face)
'("\\bto[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
1 font-lock-function-name-face)
;; pseudo-keywords
'("\\b\\(it\\|me\\|my\\|true\\|false\\)\\b"
1 as-pseudo-keyword-face))))
(put 'applescript-mode 'font-lock-defaults '(applescript-font-lock-keywords))
;; Major mode boilerplate
;; define a mode-specific abbrev table for those who use such things
(defvar applescript-mode-abbrev-table nil
"Abbrev table in use in `applescript-mode' buffers.")
(define-abbrev-table 'applescript-mode-abbrev-table nil)
(defvar applescript-mode-hook nil
"*Hook called by `applescript-mode'.")
(defvar as-mode-map ()
"Keymap used in `applescript-mode' buffers.")
(if as-mode-map
nil
(setq as-mode-map (make-sparse-keymap))
;; Key bindings
;; subprocess commands
(define-key as-mode-map "\C-c\C-c" 'as-execute-buffer)
(define-key as-mode-map "\C-c\C-s" 'as-execute-string)
(define-key as-mode-map "\C-c|" 'as-execute-region)
;; Miscellaneous
(define-key as-mode-map "\C-c;" 'comment-region)
(define-key as-mode-map "\C-c:" 'uncomment-region))
(defvar as-mode-syntax-table nil
"Syntax table used in `applescript-mode' buffers.")
(when (not as-mode-syntax-table)
(setq as-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\" "\"" as-mode-syntax-table)
(modify-syntax-entry ?: "." as-mode-syntax-table)
(modify-syntax-entry ?\; "." as-mode-syntax-table)
(modify-syntax-entry ?& "." as-mode-syntax-table)
(modify-syntax-entry ?\| "." as-mode-syntax-table)
(modify-syntax-entry ?+ "." as-mode-syntax-table)
(modify-syntax-entry ?/ "." as-mode-syntax-table)
(modify-syntax-entry ?= "." as-mode-syntax-table)
(modify-syntax-entry ?< "." as-mode-syntax-table)
(modify-syntax-entry ?> "." as-mode-syntax-table)
(modify-syntax-entry ?$ "." as-mode-syntax-table)
(modify-syntax-entry ?\[ "." as-mode-syntax-table)
(modify-syntax-entry ?\] "." as-mode-syntax-table)
(modify-syntax-entry ?\{ "." as-mode-syntax-table)
(modify-syntax-entry ?\} "." as-mode-syntax-table)
(modify-syntax-entry ?. "." as-mode-syntax-table)
(modify-syntax-entry ?\\ "." as-mode-syntax-table)
(modify-syntax-entry ?\' "." as-mode-syntax-table)
;; a double hyphen starts a comment
(modify-syntax-entry ?- ". 12" as-mode-syntax-table)
;; comment delimiters
(modify-syntax-entry ?\f "> " as-mode-syntax-table)
(modify-syntax-entry ?\n "> " as-mode-syntax-table)
;; define parentheses to match
(modify-syntax-entry ?\( "()1" as-mode-syntax-table)
(modify-syntax-entry ?\) ")(4" as-mode-syntax-table)
(modify-syntax-entry ?* ". 23b" as-mode-syntax-table))
;; Utilities
(defmacro as-safe (&rest body)
"Safely execute BODY, return nil if an error occurred."
(` (condition-case nil
(progn (,@ body))
(error nil))))
(defsubst as-keep-region-active ()
"Keep the region active in XEmacs."
;; Ignore byte-compiler warnings you might see. Also note that
;; FSF's Emacs 19 does it differently; its policy doesn't require us
;; to take explicit action.
(when (featurep 'xemacs)
(and (boundp 'zmacs-region-stays)
(setq zmacs-region-stays t))))
(defsubst as-point (position)
"Returns the value of point at certain commonly referenced POSITIONs.
POSITION can be one of the following symbols:
bol -- beginning of line
eol -- end of line
bod -- beginning of on or to
eod -- end of on or to
bob -- beginning of buffer
eob -- end of buffer
boi -- back to indentation
bos -- beginning of statement
This function does not modify point or mark."
(let ((here (point)))
(cond
((eq position 'bol) (beginning-of-line))
((eq position 'eol) (end-of-line))
((eq position 'bod) (as-beginning-of-handler 'either))
((eq position 'eod) (as-end-of-handler 'either))
;; Kind of funny, I know, but useful for as-up-exception.
((eq position 'bob) (beginning-of-buffer))
((eq position 'eob) (end-of-buffer))
((eq position 'boi) (back-to-indentation))
((eq position 'bos) (as-goto-initial-line))
(t (error "Unknown buffer position requested: %s" position)))
(prog1 (point) (goto-char here))))
;; Menu definitions, only relevent if you have the easymenu.el package
;; (standard in the latest Emacs 19 and XEmacs 19 distributions).
(defvar as-menu nil
"Menu for AppleScript Mode.
This menu will get created automatically if you have the
`easymenu' package. Note that the latest X/Emacs releases
contain this package.")
(and (as-safe (require 'easymenu) t)
(easy-menu-define
as-menu as-mode-map "AppleScript Mode menu"
'("AppleScript"
["Comment Out Region" comment-region (mark)]
["Uncomment Region" uncomment-region (mark)]
"-"
["Execute buffer" as-execute-buffer t]
["Execute region" as-execute-region (mark)]
["Execute string" as-execute-string t]
"-"
["Mode Version" as-mode-version t]
["AppleScript Version" as-language-version t])))
;;;###autoload
(defun applescript-mode ()
"Major mode for editing AppleScript files."
(interactive)
;; set up local variables
(kill-all-local-variables)
(make-local-variable 'font-lock-defaults)
(make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-start)
(make-local-variable 'require-final-newline)
(make-local-variable 'comment-start)
(make-local-variable 'comment-end)
(make-local-variable 'comment-start-skip)
(make-local-variable 'comment-column)
(make-local-variable 'comment-indent-function)
(make-local-variable 'indent-region-function)
(make-local-variable 'indent-line-function)
(make-local-variable 'add-log-current-defun-function)
(make-local-variable 'fill-paragraph-function)
;;
;; Maps and tables
(use-local-map as-mode-map)
(set-syntax-table as-mode-syntax-table)
;; Names
(setq major-mode 'applescript-mode
mode-name "AppleScript"
local-abbrev-table applescript-mode-abbrev-table
font-lock-defaults '(applescript-font-lock-keywords)
paragraph-separate "[ \t\n\f]*$"
paragraph-start "[ \t\n\f]*$"
require-final-newline t
comment-start "-- "
comment-end ""
comment-start-skip "---*[ \t]*"
comment-column 40)
;; Support for outline-minor-mode
(set (make-local-variable 'outline-regexp)
"\\([ \t]*\\(on\\|to\\|if\\|repeat\\|tell\\|end\\)\\|--\\)")
(set (make-local-variable 'outline-level) 'as-outline-level)
;; add the menu
(if as-menu
(easy-menu-add as-menu))
;; Run the mode hook. Note that applescript-mode-hook is deprecated.
(if applescript-mode-hook
(run-hooks 'applescript-mode-hook)
(run-hooks 'applescript-mode-hook)))
(when (not (or (rassq 'applescript-mode auto-mode-alist)
(push '("\\.applescript$" . applescript-mode) auto-mode-alist))))
;;; Subprocess commands
;; function use variables
(defconst as-output-buffer "*AppleScript Output*"
"Name for the buffer to display AppleScript output.")
(make-variable-buffer-local 'as-output-buffer)
;; Code execution commands
(defun as-execute-buffer (&optional async)
"Execute the whole buffer as an Applescript"
(interactive "P")
(as-execute-region (point-min) (point-max) async))
(defun as-execute-string (string &optional async)
"Send the argument STRING to an AppleScript."
(interactive "sExecute AppleScript: ")
(save-excursion
(set-buffer (get-buffer-create
(generate-new-buffer-name as-output-buffer)))
(insert string)
(as-execute-region (point-min) (point-max) async)))
(defun as-execute-region (start end &optional async)
"Execute the region as an Applescript"
(interactive "r\nP")
(let ((region (buffer-substring start end))
(as-current-win (selected-window)))
(pop-to-buffer as-output-buffer)
(insert (as-execute-code region))
(select-window as-current-win)))
(defun as-execute-code (code)
"pop to the AppleScript buffer, run the code and display the results."
(as-decode-string
(do-applescript (as-string-to-sjis-string-with-escape code))))
(defun as-mode-version ()
"Echo the current version of `applescript-mode' in the minibuffer."
(interactive)
(message "Using `applescript-mode' version %s" applescript-mode-version)
(as-keep-region-active))
(defun as-language-version()
"Echo the current version of AppleScript Version in the minibuffer."
(interactive)
(message "Using AppleScript version %s"
(as-execute-code "AppleScript's version"))
(as-keep-region-active))
;; as-beginning-of-handler, as-end-of-handler,as-goto-initial-line not yet
;; Support for outline.el
(defun as-outline-level ()
"This is so that `current-column` DTRT in otherwise-hidden text"
(let (buffer-invisibility-spec)
(save-excursion
(back-to-indentation)
(current-column))))
;; for Japanese
(defun as-unescape-string (str)
"delete escape char '\'"
(replace-regexp-in-string "\\\\\\(.\\)" "\\1" str))
(defun as-escape-string (str)
"add escape char '\'"
(replace-regexp-in-string "\\\\" "\\\\\\\\" str))
(defun as-sjis-byte-list-escape (lst)
(cond
((null lst) nil)
((= (car lst) 92)
(append (list 92 (car lst)) (as-sjis-byte-list-escape (cdr lst))))
(t (cons (car lst) (as-sjis-byte-list-escape (cdr lst))))))
(defun as-string-to-sjis-string-with-escape (str)
"String convert to SJIS, and escape \"\\\" "
(apply 'string
(as-sjis-byte-list-escape
(string-to-list
(as-encode-string str)))))
(defun as-decode-string (str)
"do-applescript return values decode sjis-mac"
(decode-coding-string str 'sjis-mac))
(defun as-encode-string (str)
"do-applescript return values encode sjis-mac"
(encode-coding-string str 'sjis-mac))
(defun as-parse-result (retstr)
"String convert to Emacs Lisp Object"
(cond
;; as list
((string-match "\\`\\s-*{\\(.*\\)}\\s-*\\'" retstr)
(let ((mstr (match-string 1 retstr)))
(mapcar (lambda (item) (as-parse-result item))
(split-string mstr ","))))
;; AERecord item as cons
((string-match "\\`\\s-*\\([^:\\\"]+\\):\\(.*\\)\\s-*\\'" retstr)
(cons (intern (match-string 1 retstr))
(as-parse-result (match-string 2 retstr))))
;; as string
((string-match "\\`\\s-*\\\"\\(.*\\)\\\"\\s-*\\'" retstr)
(as-decode-string
(as-unescape-string (match-string 1 retstr))))
;; as integer
((string-match "\\`\\s-*\\([0-9]+\\)\\s-*\\'" retstr)
(string-to-int (match-string 1 retstr)))
;; else
(t (intern retstr))))
(provide 'applescript-mode)
;;; applescript-mode.el ends here

40
init.el
View file

@ -5,15 +5,8 @@
;;
;;; Description:
;;
;; My emacs.d, which sets out to rustle emacs users' jimmies by making
;; emacs as vim-like as possible.
;;
;; Naming conventions:
;; * my--<defun-name> ; interal defuns, meant for use via elisp
;; * my-<defun-name> ; interactive command, can be used via M-x
;; * my.<defun-name> ; commands with buffer side-effects (for keybinds)
;; * my:<defun-name> ; defuns meant to be used from Ex mode
;; * *<defun/var-name> ; for altering the visual state
;; My emacs.d sets out to rustle emacs users' jimmies by making emacs as
;; vim-like as possible.
;;
;;; Code:
(defconst DEBUG-MODE nil)
@ -23,17 +16,13 @@
(defconst my-contrib-dir (concat my-dir "contrib/"))
(defconst my-themes-dir (concat my-dir "themes/"))
(defconst my-snippets-dir (concat my-dir "snippets/"))
(defconst my-tmp-dir (concat my-dir ".cache/"))
(defconst my-tmp-dir (concat my-dir ".cache-" (system-name) "/"))
(defconst *dark-theme 'v0)
(defconst *light-theme 'github) ; wtb better light theme...
(defconst *fonts `(,(font-spec :family "Terminus (TTF)" :size 12 :antialias nil)
,(font-spec :family "Inconsolata" :size 14 :antialias t)
,(font-spec :family "Ubuntu Mono" :size 20 :antialias t)
))
(defconst *default-theme 'v0)
(defconst *default-font (font-spec :family "Terminus (TTF)" :size 12 :antialias nil))
(push my-modules-dir load-path)
(push my-contrib-dir load-path)
(add-to-list 'load-path my-modules-dir)
(add-to-list 'load-path my-contrib-dir)
;; Add cask dirs to load-path
(let ((default-directory (expand-file-name (concat ".cask/" emacs-version "/elpa/") my-dir)))
(normal-top-level-add-subdirs-to-load-path))
@ -47,23 +36,24 @@
core-evil ; evil-mode and its plugins
core-editor ; completing the editor
init-auto-insert ; for the lazy typis
init-auto-insert ; for the lazy typist
init-company ; see above
init-fly ; fly(check|spell)
init-git ; git-gutter + modes
init-vc ; version control gutter + git modes
init-ido ; a search engine for your car keys
init-helm ; a search engine for your life
init-project ; project tools: dired, neotree
init-project ; dired, neotree
init-present ; for when I need to show off
init-cc ; C/C++/Obj-C madness
;; init-cscope
init-csharp
;; init-eshell
init-go
;; init-go
init-java ; the poster child for carpal tunnel syndome
init-js ; alert("not java, javascript!")
init-lua ; one-based indices? One-based indices.
;; init-org ; for fearless [organized] leader
init-org ; for fearless [organized] leader
init-php ; making php less painful to work with
init-python ; beautiful is better than ugly
init-regex ; /^[^\s](meaning)[^\n]*/
@ -75,8 +65,8 @@
init-tmux
;; init-rust
;; init-R
init-web
init-workgroups
init-web ; For the 2.0'er
init-workgroups ; session management I can understand
init-yasnippet ; type for me
my-defuns

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)))
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
(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 visible-bell nil) ; silence of the bells
(setq-default use-dialog-box nil) ; avoid GUI
(setq-default redisplay-dont-pause t)
(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
(setq-default truncate-lines t)
(setq-default truncate-partial-width-windows nil)
(setq-default indicate-buffer-boundaries nil)
(setq-default indicate-empty-lines nil)
truncate-lines t
truncate-partial-width-windows nil
indicate-buffer-boundaries nil
indicate-empty-lines nil
fringes-outside-margins t)
(use-package nlinum
:commands nlinum-mode
:init
(progn
(defface linum-highlight-face '((t (:inherit linum)))
"Face for line highlights")
;; 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,13 +145,14 @@
(global-mode-string ("" global-mode-string ""))))
(add-hook! 'after-change-major-mode-hook
(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-mule-info
;; mode-line-client
;; mode-line-remote
;; mode-line-frame-identification
mode-line-buffer-identification
mode-line-modified
mode-line-modes
@ -127,7 +162,7 @@
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))
@ -34,11 +29,9 @@
(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
(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)")
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)")))
(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,36 +58,27 @@
("@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)
(org-babel-do-load-languages 'org-babel-load-languages
'((python . t)
(ruby . 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,27 +227,31 @@
(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
'(normal visual)
", l" 'org-insert-link
'normal
",=" 'org-align-all-tags
",/" 'org-sparse-tree
",?" 'org-tags-view
",a" 'org-attach
@ -253,13 +269,15 @@
"go" 'org-open-at-point
"gO" 'org-attach-open
"gC-o" 'org-attach-reveal
"g i" (λ (if (> (length org-inline-image-overlays) 0)
"gI" (λ (if (> (length org-inline-image-overlays) 0)
(org-remove-inline-images)
(org-display-inline-images nil t (line-beginning-position) (line-end-position))))
"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
@ -273,7 +291,26 @@
(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)
(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?
(setq wg-emacs-exit-save-behavior 'save) ; Options: 'save 'ask nil
(setq wg-workgroups-mode-exit-save-behavior 'save) ; Options: 'save 'ask nil
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
@ -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..."))))

View file

@ -25,20 +25,21 @@
(custom-theme-set-variables 'v0)
(let ((background "#222222")
(let (;; (background "#222222")
(background "#2b303b")
;; (gutters "#262E34")
(gutters "#1f252a")
(gutter-fg "#55616A")
(gutters-active "#2e363c")
;; (gutters-active "#2e363c")
(gutters-active "#1c1f26")
(linum "#1e262c")
; (background "#11141c")
; (gutters "#343d46")
(gutter-light "#434f58")
; (gutters-active "#4f5b66")
;; (gutter-light "#434f58")
(gutter-light "#232830")
(builtin "#d08770")
(foreground "#c0c5ce")
(invisibles "#65737e")
(lineHighlight "#353539")
;; (line-hl "#353539")
(line-hl "#343d46")
(selection "#4f5b66")
(text "#c0c5ce")
(comments "#65737e")
@ -52,10 +53,12 @@
(strings "#a3be8c")
(constants "#d08770")
(white "#ffffff")
(highlight "orange")
(dim-highlight "#556779")
(git-modified "#B4924E")
(git-added "#91E331")
(git-deleted "#A12121"))
(git-modified "#55616A")
(git-added "#436b3b")
(git-deleted "#714243"))
(custom-theme-set-faces
'v0
@ -64,13 +67,13 @@
;; *****************************************************************************************
`(default ((t (:foreground ,text :background ,background) )))
`(hl-line ((t (:background ,lineHighlight) )))
`(hl-line ((t (:background ,line-hl) )))
`(region ((t (:background ,selection) )))
`(cursor ((t (:background ,white) )))
`(fringe ((t (:background ,background :foreground ,white) )))
`(linum ((t (:background ,background :foreground ,gutter-fg) )))
`(linum ((t (:background ,background :foreground ,gutter-fg :weight normal) )))
`(vertical-border ((t (:foreground ,gutters-active) )))
`(vertical-border ((t (:foreground "#000000") )))
`(mode-line ((t (:foreground ,white
:background ,gutter-light
@ -84,8 +87,8 @@
`(mode-line-modified-face ((t (:foreground ,builtin))))
;; `(highlight-indentation-face ((t (:background ,linum) )))
;; `(highlight-indentation-current-column-face ((t (:background ,gutters-active) )))
`(sml/folder ((t nil)))
`(sml/modified ((t (:foreground ,highlight))))
`(flyspell-incorrect ((t (:underline "#ff5555" :inherit unspecified))))
@ -95,6 +98,8 @@
;; Font lock faces
;; *****************************************************************************************
`(linum-highlight-face ((t (:foreground ,text :background ,line-hl :inherit linum))))
`(font-lock-keyword-face ((t (:foreground ,keywords))))
`(font-lock-type-face ((t (:foreground ,punctuation))))
`(font-lock-constant-face ((t (:foreground ,constants))))
@ -112,15 +117,17 @@
`(whitespace-newline ((t (:foreground "#444444"))))
`(whitespace-trailing ((t (:background "#553333"))))
`(git-gutter+-modified ((t (:foreground ,git-modified))))
`(git-gutter+-added ((t (:foreground ,git-added))))
`(git-gutter+-deleted ((t (:foreground ,git-deleted))))
`(git-gutter+-modified ((t (:foreground ,git-modified :background nil))))
`(git-gutter+-added ((t (:foreground ,git-added :background nil))))
`(git-gutter+-deleted ((t (:foreground ,git-deleted :background nil))))
`(diff-hl-change ((t (:background ,git-modified))))
`(diff-hl-delete ((t (:background ,git-deleted))))
`(diff-hl-insert ((t (:background ,git-added))))
`(rainbow-delimiters-unmatched-face ((t (:inherit 'error))))
`(rainbow-delimiters-depth-1-face ((t (:foreground "#CCCCCC" :weight bold :bold t))))
`(linum-highlight-face ((t (:background ,gutters-active))))
;; js2-mode
;; *****************************************************************************************
@ -135,8 +142,10 @@
`(org-level-1 ((t (:inherit outline-1 :bold t :foreground ,git-added))))
`(org-level-2 ((t (:inherit outline-2 :bold t :foreground ,variables))))
`(evil-snipe-first-match-face ((t (:background "orange" :foreground "black" :underline nil))))
`(evil-snipe-matches-face ((t (:foreground "orange" :background "gray20" :underline t))))
`(evil-snipe-first-match-face ((t (:background ,highlight :foreground "black" :underline nil))))
`(evil-snipe-matches-face ((t (:foreground ,highlight :background "gray20" :underline t))))
`(isearch ((t (:foreground "black" :background ,highlight :inverse-video nil))))
`(isearch-lazy-highlight-face ((t (:foreground ,text :background ,dim-highlight))))
))