diff --git a/init/flycheck_my-settings.el b/init/flycheck_my-settings.el new file mode 100644 index 000000000..d4af649b3 --- /dev/null +++ b/init/flycheck_my-settings.el @@ -0,0 +1,131 @@ +;;;; Modes 'n hooks ;;;;;;;;;;;;;;;;; +(associate-mode "/LICENSE[^/]*$" 'text-mode) +(associate-mode "zsh\\(env\\|rc\\)?$" 'sh-mode) +(associate-mode "z\\(profile\\|login\\|logout\\)?$" 'sh-mode) +(associate-mode "zsh/" 'sh-mode) +(associate-mode "\\.applescript$" 'applescript-mode) +(associate-mode "Cask$" 'emacs-lisp-mode) +(associate-mode "\\.el\\.gz$" 'emacs-lisp-mode) +(associate-mode "/Makefile$" 'makefile-gmake-mode) +(associate-mode "\\.plist$" 'nxml-mode) + +;; (setenv "SHELL" (s-trim (shell-command-to-string "which zsh"))) +(setenv "SHELL" "/usr/local/bin/zsh") +(setenv "EMACS" "1") + +;; show-paren faces +(set-face-background 'show-paren-match nil) +(set-face-foreground 'show-paren-match "orange") +(set-face-attribute 'show-paren-match nil :weight 'extra-bold) + +(set-register ?. "~/.dotfiles/") +(set-register ?d "~/Dropbox/Projects/") +(set-register ?@ "~/.emacs.d/init.el") + +(add-hook 'help-mode-hook 'visual-line-mode) +(add-hook! 'before-save-hook + (unless (eq major-mode 'org-mode) + (delete-trailing-whitespace))) + +;; Performance checks +(add-hook! 'find-file-hook + ;; If file is oversized... + (when (> (buffer-size) (* 1024 1024)) + (setq buffer-read-only t) + (buffer-disable-undo) + (fundamental-mode) + (visual-line-mode))) + + +;;;; Keymap Fixes ;;;;;;;;;;;;;;;;;;;;;; +;; This section is dedicated to keymaps that "fix" certain keys so +;; that they behave more like vim (or how I like it). + +;; Restores "dumb" indentation to the tab key. This rustles a lot of +;; peoples' jimmies, apparently, but it's how I like it. +(bind 'insert (kbd "TAB") 'my.dumb-indent) +;; Except for lisp +(bind 'insert lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command) +(bind 'insert emacs-lisp-mode-map [remap my.dumb-indent] 'indent-for-tab-command) + +;; Highjacks backspace and space to: +;; a) expand spaces between delimiters intelligently: (|) -> ( | ) +;; b) the reverse of A: ( | ) -> (|) +;; c) allow backspace to delete indented blocks intelligently +;; d) and not do any of this magic when inside a string +(bind 'insert + (kbd "SPC") 'my.inflate-space-maybe + [remap backward-delete-char-untabify] 'my.deflate-space-maybe + [remap newline] 'my.newline-and-indent + + ;; Smarter move-to-beginning-of-line + [remap move-beginning-of-line] 'my.move-to-bol + + ;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist + "\C-e" 'my.move-to-eol + "\C-u" 'my.backward-kill-to-bol-and-indent + + ;; Fixes delete + (kbd "") 'delete-char + + ;; Textmate-esque insert-line before/after + (kbd "") 'evil-open-below + (kbd "") 'evil-open-above) + +;; Fix osx keymappings and then some +(bind 'insert + (kbd "") 'my.move-to-bol + (kbd "") 'my.move-to-eol + (kbd "") 'beginning-of-buffer + (kbd "") 'end-of-buffer + (kbd "") 'my.backward-kill-to-bol-and-indent) + +(add-hook! 'ido-setup-hook + (bind ido-completion-map + (kbd "") 'ido-delete-backward-updir + "\C-w" 'ido-delete-backward-word-updir)) + +;; Make ESC quit all the things +(bind (list minibuffer-local-map + minibuffer-local-ns-map + minibuffer-local-completion-map + minibuffer-local-must-match-map + minibuffer-local-isearch-map) [escape] 'my--minibuffer-quit) +(bind 'emacs [escape] 'my--minibuffer-quit) +(bind 'god [escape] 'evil-god-state-bail) +(bind 'normal evil-command-window-mode-map [escape] 'kill-buffer-and-window) +(bind evil-ex-map [escape] 'my--minibuffer-quit) + +(bind (list evil-ex-search-keymap minibuffer-local-map) + "\C-w" 'evil-delete-backward-word) +(bind minibuffer-local-map + "\C-u" 'evil-delete-whole-line) +;; Close help/compilation windows with escape + +;; 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)))) + +(defun my-emacs-is-not-kill () + (interactive) + (message "Gee, I dunno Brain...")) + +(if is-mac (global-set-key (kbd "s-q") 'my-emacs-is-not-kill)) + + + +(provide 'my-settings) +;;; my-settings.el ends here diff --git a/init/init-company.el b/init/init-company.el index c838aad94..429bebd2e 100644 --- a/init/init-company.el +++ b/init/init-company.el @@ -1,5 +1,3 @@ -(provide 'init-company) - (use-package company :init (global-company-mode 1) @@ -128,3 +126,7 @@ (after "helm-company" (bind company-mode-map "" 'helm-company) (bind company-active-map "" 'helm-company)))))) + + +(provide 'init-company) +;;; init-company.el ends here diff --git a/init/init-csharp.el b/init/init-csharp.el index 601859590..6c312fdfc 100644 --- a/init/init-csharp.el +++ b/init/init-csharp.el @@ -1,5 +1,3 @@ -(provide 'init-csharp) - (use-package omnisharp :defer t :config (progn @@ -26,3 +24,6 @@ (use-package shaderlab-mode :mode "\\.shader$") ;; TODO Make more Unity-friendly + +(provide 'init-csharp) +;;; init-csharp.el ends here diff --git a/init/init-elisp.el b/init/init-elisp.el index 6609a8ab7..ba729e1f8 100644 --- a/init/init-elisp.el +++ b/init/init-elisp.el @@ -1,5 +1,3 @@ -(provide 'init-elisp) - (defun remove-elc-on-save () "If you're saving an elisp file, likely the .elc is no longer valid." (make-local-variable 'after-save-hook) @@ -29,3 +27,7 @@ (if func (find-function-other-window func))))) (bind 'motion emacs-lisp-mode-map "g r" 'my:elisp-eval) + + +(provide 'init-elisp) +;;; init-elisp.el ends here diff --git a/init/init-eshell.el b/init/init-eshell.el index 42969aa86..a588446f5 100644 --- a/init/init-eshell.el +++ b/init/init-eshell.el @@ -1,5 +1,3 @@ -(provide 'init-eshell) - ;; (evil-set-initial-state 'eshell-mode 'emacs) ;; (push '("*eshell*" :position left :width 80 :stick t) popwin:special-display-config) @@ -46,3 +44,7 @@ ;; ;; em-prompt ;; (setq eshell-prompt-function 'my-eshell-prompt) + + +(provide 'init-eshell) +;;; init-eshell.el ends here diff --git a/init/init-fly.el b/init/init-fly.el index 1ddc07fb2..99069ff0b 100644 --- a/init/init-fly.el +++ b/init/init-fly.el @@ -1,5 +1,3 @@ -(provide 'init-fly) - (use-package flycheck :defer t :init (add-hook 'prog-mode-hook 'flycheck-mode) @@ -34,3 +32,7 @@ popwin:special-display-config))) (use-package flyspell :commands flyspell-mode) + + +(provide 'init-fly) +;;; init-fly.el ends here diff --git a/init/init-git.el b/init/init-git.el index d4a68468d..7e7697e6f 100644 --- a/init/init-git.el +++ b/init/init-git.el @@ -1,5 +1,3 @@ -(provide 'init-git) - (use-package git-commit-mode ; :mode (("/COMMIT_EDITMSG\\'" . git-commit-mode) ("/NOTES_EDITMSG\\'" . git-commit-mode) @@ -111,3 +109,7 @@ (evil-set-initial-state 'git-commit-mode 'insert) (evil-set-initial-state 'git-rebase-mode 'insert) + + +(provide 'init-git) +;;; init-git.el ends here diff --git a/init/init-go.el b/init/init-go.el index 2f0ed3585..1fade870e 100644 --- a/init/init-go.el +++ b/init/init-go.el @@ -1,7 +1,9 @@ -(provide 'init-go) - ;; (use-package go-mode ;; :mode "\\.go\\'" ;; :interpreter "go" ;; :init ;; (require 'go-autocomplete)) + + +(provide 'init-go) +;;; init-go.el ends here diff --git a/init/init-helm.el b/init/init-helm.el index aea54dce3..5e482fd5d 100644 --- a/init/init-helm.el +++ b/init/init-helm.el @@ -1,5 +1,3 @@ -(provide 'init-helm) - (use-package helm :config (progn ; helm settings @@ -210,3 +208,7 @@ "C-u" 'helm-delete-minibuffer-contents "C-r" 'evil-ex-paste-from-register ; Evil registers in helm! Glorious! [escape] 'helm-keyboard-quit))) + + +(provide 'init-helm) +;;; init-helm.el ends here diff --git a/init/init-ido.el b/init/init-ido.el index 5413e12e5..6944cf116 100644 --- a/init/init-ido.el +++ b/init/init-ido.el @@ -1,5 +1,3 @@ -(provide 'init-ido) - ;; ido remaps its keys every time it's invoked, this screws with ;; custom mappings. So we've gotta neuter ido. ;; (defun ido-init-completion-maps ()) @@ -38,3 +36,7 @@ '("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer" "^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-" "_region_" " output\\*$" "^TAGS$" "^\*Ido")) + + +(provide 'init-ido) +;;; init-ido.el ends here diff --git a/init/init-lua.el b/init/init-lua.el index 9f2f57e8d..4e15151cc 100644 --- a/init/init-lua.el +++ b/init/init-lua.el @@ -1,5 +1,3 @@ -(provide 'init-lua) - (use-package lua-mode :mode "\\.lua$" :interpreter "lua" @@ -19,3 +17,7 @@ (defun my--build-love () (shell-command (format "open -a love.app %s" (my--project-root)))) )) + + +(provide 'init-lua) +;;; init-lua.el ends here diff --git a/init/init-project.el b/init/init-project.el index cca7ff829..e1ca0808b 100644 --- a/init/init-project.el +++ b/init/init-project.el @@ -1,6 +1,4 @@ ;; Project nav+search tools (projectile, helm, ag) -(provide 'init-project) - (use-package neotree :commands (neotree-show neotree-hide neotree-toggle) :config @@ -39,3 +37,7 @@ (add-hook! 'dired-mode-hook (use-package 'dired+ :config (toggle-diredp-find-file-reuse-dir 1))))) + + +(provide 'init-project) +;;; init-project.el ends here diff --git a/init/init-projectile.el b/init/init-projectile.el index 7630e3473..1b5491878 100644 --- a/init/init-projectile.el +++ b/init/init-projectile.el @@ -1,5 +1,3 @@ -(provide 'init-projectile) - (use-package projectile :pre-load (setq-default projectile-cache-file (concat my-tmp-dir "projectile.cache") @@ -27,3 +25,7 @@ (after "perspective" (defvar persp-modestring-dividers '("" " |" ",")) (use-package persp-projectile)))) + + +(provide 'init-projectile) +;;; init-projectile.el ends here diff --git a/init/init-python.el b/init/init-python.el index 7a87a1b07..eae0aa91d 100644 --- a/init/init-python.el +++ b/init/init-python.el @@ -1,5 +1,3 @@ -(provide 'init-python) - (use-package python :mode ("\\.py\\'" . python-mode) :interpreter ("python" . python-mode) @@ -96,3 +94,7 @@ ",tA" 'nosetests-pdb-all ",tO" 'nosetests-pdb-one ",tV" 'nosetests-pdb-module)))) + + +(provide 'init-python) +;;; init-python.el ends here diff --git a/init/init-regex.el b/init/init-regex.el index 2d3e00053..8b2572e88 100644 --- a/init/init-regex.el +++ b/init/init-regex.el @@ -1,5 +1,3 @@ -(provide 'init-regex) - (use-package re-builder :defer t :config @@ -27,3 +25,7 @@ (after "re-builder" (setq reb-re-syntax 'pcre)) (after "popwin" (push '("* Regexp Explain *" :position top :height 0.35) popwin:special-display-config)))) + + +(provide 'init-regex) +;;; init-regex.el ends here diff --git a/init/init-ruby.el b/init/init-ruby.el index 4964b18eb..5e4555e84 100644 --- a/init/init-ruby.el +++ b/init/init-ruby.el @@ -1,5 +1,3 @@ -(provide 'init-ruby) - (use-package enh-ruby-mode :mode (("\\.rb$" . enh-ruby-mode) ("\\.ru$" . enh-ruby-mode) @@ -111,3 +109,7 @@ (unless robe-running (robe-start 1)) (when robe-running (ruby-load-file file))))) (add-hook 'after-save-hook 'my--ruby-load-file))))) + + +(provide 'init-ruby) +;;; init-ruby.el ends here diff --git a/init/init-sh.el b/init/init-sh.el index 65a8272dd..f452d3f61 100644 --- a/init/init-sh.el +++ b/init/init-sh.el @@ -1,5 +1,3 @@ -(provide 'init-sh) - (after "popwin" (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) @@ -20,3 +18,7 @@ (string= (buffer-name buf) "*Shell Command Output*") (with-current-buffer buf (ansi-color-apply-on-region (point-min) (point-max)))))) + + +(provide 'init-sh) +;;; init-sh.el ends here diff --git a/init/init-swift.el b/init/init-swift.el index 0b8ccf353..874d6214c 100644 --- a/init/init-swift.el +++ b/init/init-swift.el @@ -1,5 +1,3 @@ -(provide 'init-swift) - (use-package swift-mode :mode "\\.swift$" :config @@ -7,4 +5,7 @@ (after "flycheck" (add-to-list 'flycheck-cehckers 'swift)) (after "company" (company--backend-on 'swift-mode-hook 'company-xcode)))) -;; TODO: Set up emacs task runners for fruitstrap +;; TODO Set up emacs task runners for fruitstrap + +(provide 'init-swift) +;;; init-swift.el ends here diff --git a/init/init-text.el b/init/init-text.el index ac5553f1f..ff1937a5d 100644 --- a/init/init-text.el +++ b/init/init-text.el @@ -1,5 +1,3 @@ -(provide 'init-text) - (add-hook 'text-mode-hook 'turn-on-auto-fill) (add-hook 'prog-mode-hook 'enable-comment-hard-wrap) @@ -50,3 +48,7 @@ (kbd "s-b") 'markdown-insert-bold (kbd "s-i") 'markdown-insert-italic (kbd "s-`") 'markdown-insert-del)))) + + +(provide 'init-text) +;;; init-text.el ends here diff --git a/init/init-tmux.el b/init/init-tmux.el index 4fd778f39..da67d7ab0 100644 --- a/init/init-tmux.el +++ b/init/init-tmux.el @@ -1,5 +1,3 @@ -(provide 'init-tmux) - (defun my--tmux-send (command) (shell-command (format "tmux send-keys %s" command))) @@ -32,3 +30,6 @@ (when (evil-ex-p) (message "[Tmux] cd %s" dir))))) + +(provide 'init-tmux) +;;; init-tmux.el ends here diff --git a/init/init-yasnippet.el b/init/init-yasnippet.el index a5ca49673..b5bbf82a0 100644 --- a/init/init-yasnippet.el +++ b/init/init-yasnippet.el @@ -1,5 +1,3 @@ -(provide 'init-yasnippet) - (use-package yasnippet :mode (("emacs\\.d/snippets/.+$" . snippet-mode)) :pre-load @@ -133,3 +131,7 @@ "" 'my/yas-goto-end-of-field "" 'my/yas-goto-start-of-field [backspace] 'my/yas-clear-field))) + + +(provide 'init-yasnippet) +;;; init-yasnippet.el ends here diff --git a/init/my-bindings.el b/init/my-bindings.el index 124656eab..e05c2503d 100644 --- a/init/my-bindings.el +++ b/init/my-bindings.el @@ -1,5 +1,3 @@ -(provide 'my-bindings) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Global keymaps ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -172,3 +170,7 @@ "[[" 'help-go-back)) (evil-make-overriding-map my-mode-map nil) + + +(provide 'my-bindings) +;;; my-bindings.el ends here diff --git a/init/my-settings.el b/init/my-settings.el index 13a609aea..b2b73d609 100644 --- a/init/my-settings.el +++ b/init/my-settings.el @@ -1,5 +1,3 @@ -(provide 'my-settings) - ;;;; Modes 'n hooks ;;;;;;;;;;;;;;;;; (associate-mode "/LICENSE[^/]*$" 'text-mode) (associate-mode "zsh\\(env\\|rc\\)?$" 'sh-mode) @@ -126,3 +124,7 @@ (message "Gee, I dunno Brain...")) (if is-mac (global-set-key (kbd "s-q") 'my-emacs-is-not-kill)) + + +(provide 'my-settings) +;;; my-settings.el ends here