Initial commit (brand new NARF)

This commit is contained in:
Henrik Lissner 2015-06-06 06:40:33 -04:00
parent de70863bed
commit d0628e018a
105 changed files with 1837 additions and 16026 deletions

0
private/README.md Normal file
View file

336
private/my-bindings.el Normal file
View file

@ -0,0 +1,336 @@
;;; my-bindings.el
;; Minimalistic key mapping! Why go so far for this?
;; ...
;; Uh. Good question.
(@map
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Global keymaps ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"M-x" 'smex
"M-X" 'smex-major-mode-commands
"M-A-x" 'helm-M-x
"M-;" 'eval-expression
"C-`" 'popwin:toggle-popup-window
"M-=" 'text-scale-increase
"M--" 'text-scale-increase
"M-w" 'evil-window-delete
"M-/" 'evil-commentary-line
"M-b" 'narf:build
"M-t" 'helm-projectile-find-file
:m "M-j" "6j"
:m "M-k" "6k"
:n "M-k" 'narf:eval-buffer
:n "M-d" 'dash-at-point
:n "M-o" 'narf:ido-find-file
:n "M-O" 'narf:ido-find-project-file
(:when IS-MAC
"<A-left>" 'backward-word
"<A-right>" 'forward-word
"<M-backspace>" 'narf:backward-kill-to-bol-and-indent
"A-SPC" 'just-one-space
"M-a" 'mark-whole-buffer
"M-c" 'evil-yank
"M-s" 'save-buffer
"M-v" 'clipboard-yank
"M-q" 'evil-quit-all
"M-z" 'undo
"M-Z" 'redo
"C-M-f" 'narf:toggle-fullscreen)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Local keymaps ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:nmv ";" evil-ex
(:leader "m"
:n "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
:n "<" 'helm-buffers-list
:n "." 'narf:ido-find-file
:n ">" 'narf:ido-find-file-other-window
:n "/" 'helm-projectile-find-file
:n ";" 'helm-semantic-or-imenu
:n "]" 'helm-etags-select
:n "a" 'helm-projectile-find-other-file
:n "E" 'narf::initfiles
:n "h" 'helm-apropos
:n "n" 'narf::notes
:n "m" 'helm-recentf
:n "M" 'helm-projectile-recentf ; recent PROJECT files
:n "p" 'helm-projectile-switch-project
:n "r" 'emr-show-refactor-menu
:n "qq" 'evil-save-and-quit
:n "QQ" (λ (let ((confirm-kill-emacs nil)) (narf::kill-buffers t) (evil-quit-all)))
;; insert lines in-place)
:n "jj" (λ (save-excursion (evil-insert-newline-below)))
:n "kk" (λ (save-excursion (evil-insert-newline-above)))
:n "oo" 'narf:open-with
:n "ob" (λ (narf:open-with "Google Chrome"))
:n "of" (λ (narf:open-with "Finder.app" default-directory))
:n "oF" (λ (narf:open-with "Finder.app" (narf/project-root)))
:n "ou" (λ (narf:open-with "Transmit"))
:n "oU" (λ (narf:open-with "Transmit" default-directory))
:n "ol" (λ (narf:open-with "LaunchBar"))
:n "oL" (λ (narf:open-with "LaunchBar" default-directory))
:n "ot" (λ (narf::tmux-chdir nil t))
:n "oT" 'narf::tmux-chdir)
(:localleader "\\"
:n "\\" 'narf:neotree-toggle
:n "." 'narf:neotree-find
:n ";" 'narf:nlinum-toggle
:n "=" 'toggle-transparency
:n "E" 'evil-emacs-state
:n "]" 'next-buffer
:n "[" 'previous-buffer
:n "s" (λ (narf::snippets t)) ; ido snippets dir
:n "g" 'diff-hl-diff-goto-hunk
:n "e" (λ (call-interactively 'flycheck-buffer) (flycheck-list-errors))
:n "p" 'helm-show-kill-ring
:n "b" 'helm-bookmarks
:n "w" 'helm-wg)
:m :remap "j" "gj"
:m :remap "k" "gk"
:n "Y" "y$"
:n "zr" 'narf:open-folds
:n "zm" 'narf:close-folds
:n "zx" 'narf:kill-real-buffer
:n "zX" 'bury-buffer
:n "]b" 'narf:next-real-buffer
:n "[b" 'narf:previous-real-buffer
:n "]w" 'wg-switch-to-workgroup-right
:n "[w" 'wg-switch-to-workgroup-left
;; don't move cursor on indent
:n "=" (λ (save-excursion (call-interactively 'evil-indent)))
;; Increment/decrement number under cursor
:n "g=" 'evil-numbers/inc-at-pt
:n "g-" 'evil-numbers/dec-at-pt
:n "gR" 'narf::eval-buffer
:n "gc" 'evil-commentary
:n "gy" 'evil-commentary-yank
;; VISUAL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:v "." 'evil-repeat
:v "gR" 'narf::eval-region-and-replace
:v ",=" 'align-regexp
;; vnoremap < <gv
:v "<" (λ (evil-shift-left (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
;; vnoremap > >gv
:v ">" (λ (evil-shift-right (region-beginning) (region-end))
(evil-normal-state)
(evil-visual-restore))
;; undo/redo for regions
;; "u" 'undo-tree-undo
;; "C-r" 'redo-tree-redo
:v "*" 'evil-visualstar/begin-search-forward
:v "#" 'evil-visualstar/begin-search-backward
;; paste from recent yank register; which isn't overwritten by deletes or
;; other operations.
:v "P" "\"0p"
:v "S" 'evil-surround-region
:v "R" 'evil-iedit-state/iedit-mode ; edit all instances of marked region
:v "v" 'er/expand-region
:v "V" 'er/contract-region
;; aliases for %
:m "%" 'evilmi-jump-items
:m [tab] (λ (if (ignore-errors (hs-already-hidden-p))
(hs-toggle-hiding)
(call-interactively 'evilmi-jump-items)))
:m "]g" 'diff-hl-next-hunk
:m "[g" 'diff-hl-previous-hunk
:m "]e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-next-error 'next-error)))
:m "[e" (λ (call-interactively (if (bound-and-true-p flycheck-mode) 'flycheck-previous-error 'previous-error)))
:m "gl" 'narf:goto-line
:m "gs" 'evil-ace-jump-two-chars-mode
:m "gx" 'evil-exchange
:m "gr" 'narf::eval-region
:m "g]" 'smart-down
:m "g[" 'smart-up
:i "<A-backspace>" 'evil-delete-backward-word
:i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word))
:i ;; Newline magic
:i "<backspace>" 'backward-delete-char-untabify
:i "<M-backspace>" 'narf:backward-kill-to-bol-and-indent
:i "<C-return>" 'evil-ret-and-indent
:i ;; Textmate-esque indent shift left/right
:i "M-[" "C-o m l C-o I DEL C-o ` l"
:i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
:i "<backtab>" "M-["
;; escape from insert mode (more responsive than using key-chord-define)
:ir "j" 'narf:exit-mode-maybe
:irv "C-g" 'evil-normal-state
:o "s" 'evil-surround-edit
:o "S" 'evil-Surround-edit
:n "!" 'rotate-word-at-point
:v "!" 'rotate-region
:e [escape] 'evil-normal-state
:i "C-SPC" 'company-complete-common
:i "C-x C-k" 'company-dictionary
:i "C-x C-f" 'company-files
:i "C-x C-]" 'company-tags
:i "C-x s" 'company-ispell
:i "C-x C-s" 'company-yasnippet
:i "C-x C-o" 'company-semantic
:i "C-x C-n" 'company-dabbrev-code
:i "C-x C-p" (λ (let ((company-selection-wrap-around t))
(call-interactively 'company-dabbrev-code)
(company-select-previous-or-abort)))
(:map company-active-map
"C-o" 'company-search-kill-others
"C-n" 'company-select-next-or-abort
"C-p" 'company-select-previous-or-abort
"C-h" 'company-show-doc-buffer
"C-S-h" 'company-show-location
"C-S-s" 'company-search-candidates
"C-s" 'company-filter-candidates
"C-SPC" 'company-complete-common
[tab] 'company-complete
"<backtab>" 'company-select-previous
[escape] 'company-abort
"<C-return>" 'helm-company
:unset "C-w")
(:map company-search-map
"C-n" 'company-search-repeat-forward
"C-p" 'company-search-repeat-backward
[escape] 'company-abort
:unset "C-w")
(keymap evil-window-map
"u" 'winner-undo
"C-u" 'winner-undo
"C-r" 'winner-redo
"C-w" 'ace-window
"C-S-w" (λ (ace-window 4)) ; swap windows
"C-C" (λ (ace-window 16))) ; delete windows
(:after help-mode
(:map help-mode-map
:n "]]" 'help-go-forward
:n "[[" 'help-go-back
:n "<escape>" (λ (kill-buffer)
(if (eq popwin:popup-buffer (current-buffer))
(popwin:close-popup-window)
(evil-window-delete)))))
(:map evil-ex-completion-map
"C-r" 'evil-ex-paste-from-register ; registers in ex-mode
"C-a" 'move-beginning-of-line
"<s-left>" 'move-beginning-of-line
"<s-right>" 'move-beginning-of-line
"<s-backspace>" 'evil-delete-whole-line)
(:map evil-snipe-override-mode-map
"C-;" 'evil-snipe-repeat
"C-," 'evil-snipe-repeat-reverse))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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.
(@map :i "<tab>" 'narf:dumb-indent
:i "<C-tab>" 'indent-for-tab-command
;; No dumb-tab for lisp
:i :map lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command
:i :map emacs-lisp-mode-map [remap narf:dumb-indent] 'indent-for-tab-command
;; Highjacks space/backspace to:
;; a) delete spaces on either side of the cursor, if present ( | ) -> (|)
;; b) allow backspace to delete space-indented blocks intelligently
;; c) and not do any of this magic when inside a string
:i "SPC" 'narf:inflate-space-maybe
:i [remap backward-delete-char-untabify] 'narf:deflate-space-maybe
:i [remap newline] 'narf:newline-and-indent
;; Smarter move-to-beginning-of-line
:i [remap move-beginning-of-line] 'narf:move-to-bol
;; Restore bash-esque keymaps in insert mode; C-w and C-a already exist
:i "C-e" 'narf:move-to-eol
:i "C-u" 'narf:backward-kill-to-bol-and-indent
;; Fixes delete
:i "<kp-delete>" 'delete-char
;; Fix osx keymappings and then some
:i "<M-left>" 'narf:move-to-bol
:i "<M-right>" 'narf:move-to-eol
:i "<M-up>" 'beginning-of-buffer
:i "<M-down>" 'end-of-buffer
:i "<C-up>" 'smart-up
:i "<C-down>" 'smart-down
;; Fix emacs motion keys
:i "A-b" 'evil-backward-word-begin
:i "A-w" 'evil-forward-word-begin
:i "A-e" 'evil-forward-word-end
;; Textmate-esque insert-line before/after
:ni "<M-return>" 'evil-open-below
:ni "<S-M-return>" 'evil-open-above
;; Make ESC quit all the things
:e [escape] narf/minibuffer-quit
(:map (minibuffer-local-map
minibuffer-local-ns-map
minibuffer-local-completion-map
minibuffer-local-must-match-map
minibuffer-local-isearch-map)
[escape] 'narf/minibuffer-quit)
:map read-expression-map "C-w" 'evil-delete-backward-word
;; Line selection via linum
"<left-margin> <down-mouse-1>" 'narf/mouse-select-line
"<left-margin> <mouse-1>" 'narf/mouse-select-line
"<left-margin> <drag-mouse-1>" 'narf/mouse-select-line
"<left-margin> <double-mouse-1>" 'narf/mouse-select-block)
(provide 'my-bindings)
;;; my-bindings.el ends here

72
private/my-commands.el Normal file
View file

@ -0,0 +1,72 @@
;;; my-commands.el
(! (require 'core-defuns))
(@exmap "settr[im]" 'narf:toggle-delete-trailing-whitespace)
(@exmap "l[ast]" 'popwin:popup-last-buffer)
(@exmap "m[sg]" 'popwin:messages)
(@exmap "bcomp[ile]" 'narf:byte-compile)
(@exmap "acomp[ile]" 'narf:autoload-compile)
(@exmap "echo" 'narf:echo)
(@exmap "full[scr]" 'narf/toggle-fullscreen)
(@exmap "ini" 'narf:initfiles)
(@exmap "cd" 'narf:cd)
(@exmap "en[ew]" 'narf:create-file)
(@exmap "ren[ame]" 'narf:rename-this-file) ; rename [NEWNAME] # rename file
(@exmap "del[ete]" 'narf:delete-this-file) ; delete[!]
(@exmap "al[ign]" 'narf:align)
(@exmap "retab" 'narf:retab)
(@exmap "na[rrow]" 'narf:narrow-indirect-or-widen) ; Narrow buffer to selection
(@exmap "x" 'narf:scratch-buffer)
(@exmap "k[ill]" 'kill-this-buffer) ; Kill current buffer
(@exmap "k[ill]o" 'narf:cleanup-buffers) ; Kill current project buffers
(@exmap "k[ill]all" 'narf:kill-buffers) ; Kill all buffers (bang = project buffers only)
(@exmap "k[ill]buried" 'narf:kill-buried-buffers) ; Kill all buffers (bang = project buffers only)
(@exmap "ma[ke]" 'narf:build)
(@exmap "t" 'narf:tmux-run)
(@exmap "tcd" 'narf:tmux-chdir)
(@exmap "a" 'helm-projectile-find-other-file)
(@exmap "proj[ect]" 'helm-projectile-switch-project)
(@exmap "ag" 'narf:ag-search)
(@exmap "agr" 'narf:ag-regex-search)
(@exmap "ag[cw]d" 'narf:ag-search-cwd)
(@exmap "agr[cw]d" 'narf:ag-regex-search-cwd)
(@exmap "sw[oop]" 'narf:swoop)
(@exmap "rec[ent]" 'narf:recentf)
(@exmap "ref[actor]" 'emr-show-refactor-menu)
(@exmap "snip[pets]" 'narf::snippets) ; snip[!]
(@exmap "cap[ture]" 'helm-org-capture-templates)
(@exmap "n[otes]" 'helm-org-agenda-files-headings)
(after "flycheck"
(@exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
(after "re-builder"
(@exmap "re[gex]" 'narf::regex))
(after "org"
(@exmap "o[rg]edit" 'org-edit-special)
(@exmap "o[rg]refile" 'org-refile)
(@exmap "o[rg]archive" 'org-archive-subtree)
(@exmap "o[rg]agenda" 'org-agenda)
(@exmap "o[rg]todo" 'org-show-todo-tree)
(@exmap "o[rg]link" 'org-link)
(@exmap "o[rg]align" 'org-align-all-tags))
(after "workgroups2"
(@exmap "sl[oad]" 'narf:load-session)
(@exmap "ss[ave]" 'narf:save-session)
(@exmap "wg" (λ (message (wg-workgroup-list-display))))
(@exmap "wnew" 'narf:new-workgroup)
(@exmap "wre[name]" 'narf:rename-workgroup)
(@exmap "wn[ext]" 'wg-switch-to-workgroup-right)
(@exmap "wp[rev]" 'wg-switch-to-workgroup-left)
(@exmap "wl[ast]" 'wg-switch-to-previous-workgroup)
(@exmap "k[ill]w" 'wg-kill-workgroup)
(@exmap "k[ill]ow" (λ (let (workgroup (wg-current-workgroup))
(dolist (w (wg-workgroup-list))
(unless (wg-current-workgroup-p w)
(wg-kill-workgroup w)))))))
(provide 'my-commands)
;;; my-commands.el ends here

0
private/themes/README.md Normal file
View file

View file

@ -0,0 +1,142 @@
;; NARF Dark
;; By Henrik Lissner <http://github.com/hlissner/emacs.d>
(deftheme narf-dark "dark theme for narfy emacs")
(custom-theme-set-variables 'narf-dark)
(let ((background "#2b303b")
(gutters "#1f252a")
(gutter-fg "#55616A")
(gutters-active "#1c1f26")
(linum "#1e262c")
(gutter-light "#232830")
(builtin "#d08770")
(foreground "#c0c5ce")
(invisibles "#65737e")
(line-hl "#343d46")
(selection "#4f5b66")
(text "#c0c5ce")
(comments "#65737e")
(punctuation "#8fa1b3")
(delimiters "#c0c5ce")
(operators "#c0c5ce")
(keywords "#b48ead")
(variables "#CBECFF")
(functions "#8fa1b3")
(methods "#8fa1b3")
(strings "#a3be8c")
(constants "#d08770")
(white "#ffffff")
(highlight "orange")
(dim-highlight "#556779")
(git-modified "#55616A")
(git-added "#436b3b")
(git-deleted "#714243"))
(custom-theme-set-faces
'narf-dark
;; Default colors
`(default ((t (:foreground ,text :background ,background) )))
`(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 :weight normal) )))
`(vertical-border ((t (:foreground "#000000") )))
`(mode-line ((t (:foreground ,white
:background ,gutter-light
:box (:line-width 3 :color ,gutter-light)
))))
`(mode-line-inactive ((t (:foreground ,gutter-fg
:background ,gutters-active
:box (:line-width 3 :color ,gutters-active)
))))
`(mode-line-modified-face ((t (:foreground ,builtin))))
`(sml/folder ((t nil)))
`(sml/modified ((t (:foreground ,highlight))))
`(flyspell-incorrect ((t (:underline "#ff5555" :inherit unspecified))))
`(helm-source-header ((t (:background ,gutters-active :foreground ,strings :weight bold :height 1.0))))
`(helm-selection ((t (:background ,selection))))
;; 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))))
`(font-lock-variable-name-face ((t (:foreground ,variables))))
`(font-lock-builtin-face ((t (:foreground ,builtin))))
`(font-lock-string-face ((t (:foreground ,strings))))
`(font-lock-comment-face ((t (:foreground ,comments))))
`(font-lock-comment-delimiter-face ((t (:foreground ,comments))))
`(font-lock-function-name-face ((t (:foreground ,functions))))
`(font-lock-doc-string-face ((t (:foreground ,comments))))
`(font-lock-doc-face ((t (:foreground ,comments))))
`(trailing-whitespace ((t (:background "#884444"))))
`(whitespace-tab ((t (:foreground "#444444"))))
`(whitespace-newline ((t (:foreground "#444444"))))
`(whitespace-trailing ((t (:background "#553333"))))
`(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))))
;; js2-mode
;; *****************************************************************************************
`(js2-function-param ((t (:foreground ,variables))))
`(js2-jsdoc-tag ((t (:foreground ,comments :weight bold :bold t))))
;; company-mode
;; *****************************************************************************************
`(company-tooltip ((t (:inherit default :background "#3e4555"))))
`(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
`(company-tooltip-common ((t (:inherit font-lock-constant-face))))
`(company-scrollbar-bg ((t (:background "#4b5367"))))
`(company-scrollbar-fg ((t (:background "#353b49"))))
`(company-search ((t (:background "#4b5367"))))
;; *****************************************************************************************
`(persp-selected-face ((t (:foreground ,builtin))))
`(org-level-1 ((t (:inherit outline-1 :bold t :foreground ,constants))))
`(org-level-2 ((t (:inherit outline-2 :bold t :foreground ,variables))))
`(show-paren-match ((t (:background nil :foreground ,highlight :weight ultra-bold))))
`(evil-snipe-first-match-face ((t (:background ,highlight :foreground "black"))))
`(evil-snipe-matches-face ((t (:foreground ,highlight :background ,dim-highlight))))
`(isearch ((t (:foreground "black" :background ,highlight :inverse-video nil))))
`(isearch-lazy-highlight-face ((t (:foreground ,text :background ,dim-highlight))))
`(evil-search-highlight-persist-highlight-face ((t (:inherit isearch-lazy-highlight-face))))
))
;; *****************************************************************************************
(provide-theme 'narf-dark)
;; Local Variables:
;; no-byte-compile: t
;; End: