diff --git a/.gitignore b/.gitignore index 3a7b964d7..923e6474e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ eshell/ -init/autoloads.el +core/autoloads.el auto-save-list recentf savehist @@ -9,6 +9,7 @@ semanticdb ede-projects.el tramp smex-items +elpa # compiled files .* diff --git a/Cask b/Cask index 1afae7316..a3bdf7bb4 100644 --- a/Cask +++ b/Cask @@ -48,6 +48,7 @@ (depends-on "anzu") (depends-on "iedit") (depends-on "quickrun") +(depends-on "goto-last-change") ;; Auto-completion (depends-on "company") diff --git a/core/autoloads.el b/core/autoloads.el index 17702ebe8..682b77a2b 100644 --- a/core/autoloads.el +++ b/core/autoloads.el @@ -164,7 +164,7 @@ Rotate word at point based on sets in `rotate-text-rotations'. ;;;*** ;;;### (autoloads nil "defuns-buffers" "defuns-buffers.el" (21869 -;;;;;; 35086 0 0)) +;;;;;; 43589 0 0)) ;;; Generated autoloads from defuns-buffers.el (autoload 'narf:narrow-to-region-indirect "defuns-buffers" "\ @@ -240,7 +240,7 @@ Kill buffer (but only bury scratch buffer) ;;;*** -;;;### (autoloads nil "defuns-code" "defuns-code.el" (21869 24069 +;;;### (autoloads nil "defuns-code" "defuns-code.el" (21871 23781 ;;;;;; 0 0)) ;;; Generated autoloads from defuns-code.el @@ -283,7 +283,7 @@ Tells you the name of the face (point) is on. ;;;*** -;;;### (autoloads nil "defuns-edit" "defuns-edit.el" (21866 40579 +;;;### (autoloads nil "defuns-edit" "defuns-edit.el" (21869 43444 ;;;;;; 0 0)) ;;; Generated autoloads from defuns-edit.el @@ -317,7 +317,7 @@ Link with anchor ;;;*** -;;;### (autoloads nil "defuns-extern" "defuns-extern.el" (21866 18425 +;;;### (autoloads nil "defuns-extern" "defuns-extern.el" (21869 43359 ;;;;;; 0 0)) ;;; Generated autoloads from defuns-extern.el @@ -351,7 +351,7 @@ Select the current block of text between blank lines. ;;;*** -;;;### (autoloads nil "defuns-org" "defuns-org.el" (21866 45401 0 +;;;### (autoloads nil "defuns-org" "defuns-org.el" (21869 43512 0 ;;;;;; 0)) ;;; Generated autoloads from defuns-org.el @@ -389,7 +389,7 @@ Inserts a new heading or item, depending on the context. ;;;*** -;;;### (autoloads nil "defuns-search" "defuns-search.el" (21866 51196 +;;;### (autoloads nil "defuns-search" "defuns-search.el" (21869 45131 ;;;;;; 0 0)) ;;; Generated autoloads from defuns-search.el @@ -506,19 +506,19 @@ spaces on either side of the point if so. Resorts to ;;;;;; "../contrib/ruby-mode-indent-fix.el" "../contrib/shaderlab-mode.el" ;;;;;; "../contrib/unityjs-mode.el" "../init/autoloads.el" "../init/init-auto-insert.el" ;;;;;; "../init/init-cc.el" "../init/init-cscope.el" "../init/init-csharp.el" -;;;;;; "../init/init-eshell.el" "../init/init-fly.el" "../init/init-go.el" -;;;;;; "../init/init-helm.el" "../init/init-ido.el" "../init/init-java.el" -;;;;;; "../init/init-js.el" "../init/init-lisp.el" "../init/init-lua.el" -;;;;;; "../init/init-org.el" "../init/init-php.el" "../init/init-project.el" -;;;;;; "../init/init-python.el" "../init/init-r.el" "../init/init-regex.el" -;;;;;; "../init/init-ruby.el" "../init/init-rust.el" "../init/init-scss.el" -;;;;;; "../init/init-sh.el" "../init/init-swift.el" "../init/init-text.el" -;;;;;; "../init/init-vc.el" "../init/init-vim.el" "../init/init-web.el" -;;;;;; "../init/init-workgroups.el" "../init/init-yasnippet.el" +;;;;;; "../init/init-data.el" "../init/init-eshell.el" "../init/init-fly.el" +;;;;;; "../init/init-go.el" "../init/init-helm.el" "../init/init-ido.el" +;;;;;; "../init/init-java.el" "../init/init-js.el" "../init/init-lisp.el" +;;;;;; "../init/init-lua.el" "../init/init-org.el" "../init/init-php.el" +;;;;;; "../init/init-project.el" "../init/init-python.el" "../init/init-r.el" +;;;;;; "../init/init-regex.el" "../init/init-ruby.el" "../init/init-rust.el" +;;;;;; "../init/init-scss.el" "../init/init-sh.el" "../init/init-swift.el" +;;;;;; "../init/init-text.el" "../init/init-vc.el" "../init/init-vim.el" +;;;;;; "../init/init-web.el" "../init/init-workgroups.el" "../init/init-yasnippet.el" ;;;;;; "../init/narf-bindings.el" "../init/narf-commands.el" "../init/narf-settings.el" ;;;;;; "benchmark.el" "core-company.el" "core-editor.el" "core-evil.el" ;;;;;; "core-linux.el" "core-osx.el" "core-splash.el" "core-ui.el" -;;;;;; "core.el" "defuns.el" "startup.el") (21869 35551 604587 0)) +;;;;;; "core.el" "defuns.el" "startup.el") (21873 3804 549513 0)) ;;;*** diff --git a/core/core-editor.el b/core/core-editor.el index cc734ff34..fe3a84823 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -33,11 +33,11 @@ (after "isearch" (diminish 'isearch-mode)) ;; Fix code folding -(defun narf|init-hs-minor-mode-maybe () - (unless (bound-and-true-p hs-minor-mode) - (hs-minor-mode 1) - (diminish 'hs-minor-mode))) -(add-hook 'prog-mode-hook 'narf|init-hs-minor-mode-maybe) +;; (defun narf|init-hs-minor-mode-maybe () +;; (unless (bound-and-true-p hs-minor-mode) +;; (hs-minor-mode 1) +;; (diminish 'hs-minor-mode))) +;; (add-hook 'prog-mode-hook 'narf|init-hs-minor-mode-maybe) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/core/core-evil.el b/core/core-evil.el index 6289a1480..4730fd3d5 100644 --- a/core/core-evil.el +++ b/core/core-evil.el @@ -34,7 +34,6 @@ (interactive "P") (if count (hs-hide-level count) (evil-close-folds)))) - (evil-select-search-module 'evil-search-module 'evil-search) (setq evil-magic t evil-want-C-u-scroll t ; enable C-u for scrolling evil-ex-visual-char-range t ; column range for ex commands @@ -50,8 +49,9 @@ evil-visual-state-cursor '("white" hollow) evil-iedit-state-cursor '("orange" box)) - (add-to-list 'evil-overriding-maps 'narf-mode-map) + (add-to-list 'evil-overriding-maps '(narf-mode-map)) (evil-mode 1) + (evil-select-search-module 'evil-search-module 'evil-search) (defadvice evil-ex-hl-do-update-highlight (around evil-ex-hl-shut-up activate) (ignore-errors ad-do-it)) @@ -98,10 +98,11 @@ "za" 'iedit-toggle-unmatched-lines-visible visual "SPC" (λ (if (iedit-current-occurrence-string) - (progn + (let ((current-prefix-arg '(4))) + (iedit-done) + (call-interactively 'iedit-mode) (save-excursion (iedit-restrict-region (region-beginning) (region-end))) - (evil-previous-line) - (evil-iedit-state/iedit-mode)) + (evil-previous-line)) (call-interactively 'evil-ret)))))) @@ -185,70 +186,54 @@ (use-package evil-visualstar :commands (global-evil-visualstar-mode - evil-visualstar/begin-search evil-visualstar/begin-search-forward evil-visualstar/begin-search-backward) :config - (progn - ;; I cut this down because the original visualstar wouldn't remember - ;; the last search if evil-search-module was 'evil-search. - (defun narf/evil-visualstar/begin-search (beg end direction) - (when (evil-visual-state-p) - (evil-exit-visual-state) - (let ((selection (regexp-quote (buffer-substring-no-properties beg end)))) - (setq isearch-forward direction) - (evil-search selection direction t)))) - (advice-add 'evil-visualstar/begin-search :override 'narf/evil-visualstar/begin-search) - (global-evil-visualstar-mode 1))) + (global-evil-visualstar-mode 1)) (use-package evil-snipe :diminish evil-snipe-mode + :init + (setq evil-snipe-smart-case t + evil-snipe-scope 'line + evil-snipe-repeat-scope 'buffer + evil-snipe-symbol-groups '((?\[ "[[{(]") + (?\] "[]})]"))) :config (progn - (setq evil-snipe-smart-case t - evil-snipe-scope 'line - evil-snipe-repeat-scope 'buffer - evil-snipe-override-evil-repeat-keys nil) - - (setq-default evil-snipe-symbol-groups - '((?\[ "[[{(]") - (?\] "[]})]"))) - (evil-snipe-mode 1) - (evil-snipe-override-mode 1))) + (evil-snipe-override-mode 1) + + (bind motion :map evil-snipe-mode-map + "C-;" 'evil-snipe-repeat + "C-," 'evil-snipe-repeat-reverse))) (use-package evil-space - :disabled t :diminish (evil-space-mode . "_") :config (progn - (add-to-list 'evil-overriding-maps 'evil-space-mode-map) + (evil-space-mode 1) (evil-space-setup "/" "n" "N") - (evil-space-setup "?" "N" "n") + (evil-space-setup "?" "n" "N") + + (after "evil-snipe" + (evil-space-setup evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse) + (evil-space-setup evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse) + (evil-space-setup evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse) + (evil-space-setup evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse) + (evil-space-setup evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse) + (evil-space-setup evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)) (after "evil-numbers" (let ((map (evil-get-auxiliary-keymap narf-mode-map 'normal))) (evil-space-setup "g=" "g=" "g-" map) (evil-space-setup "g-" "g-" "g=" map))) - (after "evil-snipe" - (let ((map (evil-get-auxiliary-keymap evil-snipe-override-mode-map 'motion))) - (evil-space-setup "t" "C-;" "C-," map) - (evil-space-setup "f" "C-;" "C-," map) - (evil-space-setup "T" "C-," "C-;" map) - (evil-space-setup "F" "C-," "C-;" map)) - (let ((map (evil-get-auxiliary-keymap evil-snipe-mode-map 'motion))) - (evil-space-setup "s" "C-;" "C-," map) - (evil-space-setup "S" "C-," "C-;" map))) - (after "evil-visualstar" (let ((map (evil-get-auxiliary-keymap evil-visualstar-mode-map 'visual))) - (message "VISUALSTAR") - (evil-space-setup "*" "n" "N" map) - (evil-space-setup "#" "n" "N" map))) - - (evil-space-mode)))) + (evil-space-setup "*" "*" "#" map) + (evil-space-setup "#" "#" "*" map)))))) (progn ; evil hacks (defadvice evil-force-normal-state (before evil-esc-quit activate) diff --git a/core/defuns-code.el b/core/defuns-code.el index 35f88ef7f..aeee18891 100644 --- a/core/defuns-code.el +++ b/core/defuns-code.el @@ -51,7 +51,7 @@ If ARG is nil this function calls `recompile', otherwise it calls (insert out) (beginning-of-buffer) (read-only-mode 1) - (popwin:popup-buffer buf :height lines)))))) + (popwin:popup-buffer buf :height (if (> lines 25) 25 (1+ lines)))))))) (t (quickrun-region beg end)))) ;;;###autoload (autoload 'narf::eval-buffer "defuns-code") diff --git a/core/defuns.el b/core/defuns.el index acdbe47ea..c4cfa8b28 100644 --- a/core/defuns.el +++ b/core/defuns.el @@ -58,7 +58,7 @@ (defmacro add-hook! (hook &rest body) "A shortcut macro for `add-hook' that auto-wraps `body' in a lambda" - (declare (indent defun)) + (declare (indent 1)) `(add-hook ,hook (lambda() ,@body))) ;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/core/startup.el b/core/startup.el index dd8cf43d9..f9285ad8a 100644 --- a/core/startup.el +++ b/core/startup.el @@ -14,11 +14,11 @@ (defmacro narf/init-load-path () "Collect and verify `load-path'. Compile me!" (let (paths '()) - (dolist (dir (append (directory-files CONTRIB-DIR t "^[^.]" t) - (directory-files ELPA-DIR t "^[^.]" t))) + (dolist (dir (append (directory-files ELPA-DIR t "^[^.]" t) + (directory-files CONTRIB-DIR t "^[^.]" t))) (when (file-directory-p dir) (push dir paths))) - `(setq load-path ',(append (list CORE-DIR MODULES-DIR CONTRIB-DIR) + `(setq load-path ',(append (list CORE-DIR CONTRIB-DIR MODULES-DIR) (if (listp load-path) load-path (list load-path)) paths)))) @@ -32,7 +32,7 @@ (setq custom-theme-directory THEMES-DIR) (setq use-package-verbose DEBUG-MODE) -(setq use-package-expand-minimally (not DEBUG-MODE)) +;;(setq use-package-expand-minimally (not DEBUG-MODE)) (eval-when-compile (require 'use-package)) (require 'diminish) diff --git a/init.el b/init.el index 6dbb7edfd..bda1341a2 100644 --- a/init.el +++ b/init.el @@ -1,78 +1,94 @@ -;;; Emacs for the jaded vimmer +;;; NARF! Emacs for the jaded vimmer ;; ;; Author: Henrik Lissner ;; URL: https://github.com/hlissner/emacs.d ;; -;;; Description: +;;; Narf! ;; -;; My emacs.d sets out to rustle emacs users' jimmies by making emacs as -;; vim-like as possible. +;; ,,, !/:. +;; /::\". !!::: +;; :::::\". ," \:,:: +;; ::::::\ ". ,","\::. +;; \:::::":\ "/""V' :' +;; !::::\ ! \ \ __ +;; "::::\ \ ! \.&&&&, +;; ," __ ", CD,&&&&&&' +;; \ ". "" / \&&&" _,--- +;; "",__\_ / _,:"::::: +;; _," ,"" ,-,__,/":,_ ,","::::::: +;; _," ," `'' ::::,",__,,----,,__," /::::::::: +;; ," ,".__, \:::," " /:::":::::/ +;; ," ,/"::::::\ >" (_-"/:::::: +;; / ,"_!:::::::/, ," _,,--, /::::::/ +;; / "" _,"\:::::::' ! ," ){:::::/ +;; ! _," \ "", \,"""-,____,"__,,,"_," _/ +;; ""T" \\ \ "-,_(*)&&&&(*)," \ ." +;; / \", ! , \ ! - ) +;; ! \ "" ! !==!"-,__,' +;; ! \ """_""""`, ", /"_ +;; \ , .L /" " ", \! ,_/ +;; ), \ / \ \/ ,, /! ! +;; ,::\ \," \ ! \/ ! ! +;; _,::::" ) )\ ," ___ \ -,_, ,"",! ! +;; __,,,::::"" ," ,":::,-:::--:" __\_!__/_""-,_! +;; ,,:::""""""" ,:_,""__...._"""::::"" /:::::" "":::::: +;; (:._ L::::::::::::\\/ "" "" +;; """"--,,,--- """" ;; ;;; Code: (defconst DEBUG-MODE nil) -(defconst my-dir user-emacs-directory) -(defconst my-modules-dir (concat my-dir "init/")) -(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-" (system-name) "/")) +(defconst DEFAULT-FONT (font-spec :family "Terminus (TTF)" :size 12 :antialias nil)) +(defconst DEFAULT-THEME 'narf-dark) ; for GUI client +(defconst TERM-THEME 'wombat) ; for <256 color terminals -(defconst *default-theme 'v0) -(defconst *default-font (font-spec :family "Terminus (TTF)" :size 12 :antialias nil)) +(load (concat user-emacs-directory "core/startup.el")) +(narf/init + '(core ; yoink @ core.el + core-ui ; aesthetics + core-evil ; evil-mode and its plugins + core-editor ; completing the editor + core-company ; for the lazy typist -(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)) + init-auto-insert ; see above + init-fly ; fly(check|spell) + 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 ; dired, neotree -;;;; Load Packages ;;;;;;;;;;;;;;;;;;;;; -(require 'use-package) -(mapc 'require - ;; ls init/{init,my}* | xargs basename | sed -e 's/\..*$//' - '(core - core-ui ; aesthetics - core-evil ; evil-mode and its plugins - core-editor ; completing the editor + init-cc ; C/C++/Obj-C madness + ;; init-cscope + ;; init-csharp ; unity, mono and xamarin + init-data ; DBs 'n data formats + ;; init-eshell + ;; init-go + init-java ; the poster child for carpal tunnel syndome + init-js ; alert("not java, javascript!") + init-lisp ; elisp, clisp and clojure + init-lua ; one-based indices? One-based indices. + 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]*/ + init-ruby ; <3 + init-scss ; @include magic; + init-sh ; #!/bin/bash_your_head_in - init-auto-insert ; for the lazy typist - init-company ; see above - init-fly ; fly(check|spell) - 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 ; dired, neotree - init-present ; for when I need to show off + ;; init-sonicpi ; + ;; init-swift ; yay, emoji variabless! + init-text ; I got nothing... + ;; init-rust + ;; init-r ; for science! + init-vim ; the confessional + init-web ; for the 2.0'er + init-workgroups ; session management I can understand + init-yasnippet ; type for me - init-cc ; C/C++/Obj-C madness - ;; init-cscope - init-csharp - ;; init-eshell - ;; 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-php ; making php less painful to work with - init-python ; beautiful is better than ugly - init-regex ; /^[^\s](meaning)[^\n]*/ - init-ruby ; <3 - init-scss ; @include magic; - init-sh ; #!/bin/bash_your_head_in - init-swift ; yay, emoji variables! - init-text ; I got nothing... - init-tmux - ;; init-rust - ;; init-R - init-web ; For the 2.0'er - init-workgroups ; session management I can understand - init-yasnippet ; type for me + narf-bindings + narf-commands + narf-settings + )) - my-defuns - my-bindings - my-commands - my-settings - )) -;; I've created a monster! +;;; Are you pondering what I'm pondering Pinky? diff --git a/init/init-org.el b/init/init-org.el index 29f68d03f..94fbb839a 100644 --- a/init/init-org.el +++ b/init/init-org.el @@ -1,5 +1,12 @@ +(define-minor-mode evil-org-mode + "Evil-mode bindings for org-mode." + :init-value nil + :lighter "!" + :keymap (make-sparse-keymap) ; defines evil-org-mode-map + :group 'evil-org) + (use-package org - :defines (org-directory) + :defines (org-directory) :functions (org-bookmark-jump-unhide outline-next-heading org-end-of-subtree outline-flag-region org-remove-inline-images org-display-inline-images org-at-item-checkbox-p org-toggle-checkbox org-entry-is-todo-p org-todo @@ -10,14 +17,11 @@ ("\\.opml$" . org-mode)) :init (progn - (define-minor-mode evil-org-mode - "Evil-mode bindings for org-mode." - :init-value nil - :lighter "!" - :keymap (make-sparse-keymap) ; defines evil-org-mode-map - :group 'evil-org) - - (add-to-hook 'org-mode-hook '(narf|enable-tab-width-2 'narf|enable-hard-wrap 'iimage-mode 'org-indent-mode 'evil-org-mode)) + (add-hook 'org-mode-hook 'narf|enable-tab-width-2) + (add-hook 'org-mode-hook 'narf|enable-hard-wrap) + (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 @@ -154,9 +158,10 @@ "C-j" nil "C-k" nil - :insert [remap narf:inflate-space-maybe] 'self-insert-command + insert [remap narf:inflate-space-maybe] 'self-insert-command - :normal :insert :map evil-org-mode-map + normal insert + :map evil-org-mode-map "A-l" 'org-metaright ; M-j "A-h" 'org-metaleft ; M-h "A-k" 'org-metaup ; M-k @@ -175,7 +180,7 @@ "M-a" 'mark-whole-buffer ", l" 'org-insert-link - :insert + insert "C-e" 'org-end-of-line "C-a" 'org-beginning-of-line ;; Add new header line before this line @@ -188,13 +193,13 @@ "M-i" (λ (narf/org-surround "/")) ; italics "M-`" (λ (narf/org-surround "+")) ; strikethrough - :visual + visual "M-b" "S*" "M-u" "S_" "M-i" "S/" "M-`" "S+" - :normal + normal ",=" 'org-align-all-tags ",/" 'org-sparse-tree ",?" 'org-tags-view @@ -238,7 +243,7 @@ [tab] 'org-cycle) (after "org-agenda" - (bind :emacs :map org-agenda-mode-map + (bind emacs :map org-agenda-mode-map "" 'org-agenda-Quit "C-j" 'org-agenda-next-item "C-k" 'org-agenda-previous-item diff --git a/init/narf-bindings.el b/init/narf-bindings.el index e1efa29a7..8d89473ea 100644 --- a/init/narf-bindings.el +++ b/init/narf-bindings.el @@ -29,7 +29,7 @@ "M-R" 'narf::eval-buffer) -;; Restore text nav keys +;; restore text nav keys (bind :if IS-MAC "" 'backward-word "" 'forward-word @@ -162,6 +162,9 @@ (hs-toggle-hiding) (call-interactively 'evilmi-jump-items))) + "j" 'evil-next-line + "k" 'evil-previous-line + "]g" 'diff-hl-next-hunk "[g" 'diff-hl-previous-hunk @@ -265,10 +268,6 @@ [escape] 'company-abort "C-w" nil) -(bind :map evil-snipe-override-mode-map - "C-;" 'evil-snipe-repeat - "C-," 'evil-snipe-repeat-reverse) - ;; TODO: Swap helm's C-z and Tab