Too lazy for a commit message. Sue me!

This commit is contained in:
Henrik Lissner 2015-11-10 18:10:32 -05:00
parent 7f8350c9be
commit 85770497d0
11 changed files with 158 additions and 58 deletions

View file

@ -16,6 +16,9 @@
scroll-conservatively 1001
scroll-preserve-screen-position t
hscroll-step 5
hscroll-margin 6
shift-select-mode nil
tabify-regexp "^\t* [ \t]+"
whitespace-style '(face tabs tab-mark newline newline-mark)

View file

@ -230,16 +230,16 @@
(?\] "[]})]")
(?\; "[;:]")))
(define-key evil-normal-state-map (kbd "s") nil)
(define-key evil-normal-state-map (kbd "S") nil)
(define-key evil-motion-state-map (kbd "s") 'evil-snipe-s)
(define-key evil-motion-state-map (kbd "S") 'evil-snipe-S)
(define-key evil-motion-state-map (kbd "f") 'evil-snipe-f)
(define-key evil-motion-state-map (kbd "F") 'evil-snipe-F)
(define-key evil-motion-state-map (kbd "t") 'evil-snipe-t)
(define-key evil-motion-state-map (kbd "T") 'evil-snipe-T)
(define-key evil-operator-state-map (kbd "z") 'evil-snipe-s)
(define-key evil-operator-state-map (kbd "Z") 'evil-snipe-S)
(define-key evil-normal-state-map "s" nil)
(define-key evil-normal-state-map "S" nil)
(define-key evil-motion-state-map "s" 'evil-snipe-s)
(define-key evil-motion-state-map "S" 'evil-snipe-S)
(define-key evil-motion-state-map "f" 'evil-snipe-f)
(define-key evil-motion-state-map "F" 'evil-snipe-F)
(define-key evil-motion-state-map "t" 'evil-snipe-t)
(define-key evil-motion-state-map "T" 'evil-snipe-T)
(define-key evil-operator-state-map "z" 'evil-snipe-s)
(define-key evil-operator-state-map "Z" 'evil-snipe-S)
:config
(evil-snipe-mode 1)
(evil-snipe-override-mode 1))
@ -251,6 +251,19 @@
evil-surround-region)
:config
(global-evil-surround-mode 1)
(add-hook! org-mode
(mapc (lambda (p) (add-to-list 'evil-surround-pairs-alist p))
'((?l . narf/evil-surround-latex))))
(add-hook! emacs-lisp-mode
(setq evil-surround-pairs-alist
(cons '(?\` . ("`" . "*")) evil-surround-pairs-alist)))
(add-hook! python-mode
(setq evil-surround-pairs-alist
(cons '(?d . ("\"\"\"" . "\"\"\"")) evil-surround-pairs-alist)))
;; Escaped surround characters
(setq-default evil-surround-pairs-alist
(cons '(?\\ . narf/evil-surround-escaped)

View file

@ -9,10 +9,12 @@
mac-option-modifier 'alt
;; sane trackpad/mouse scroll settings
mac-redisplay-dont-reset-vscroll t
mac-mouse-wheel-smooth-scroll nil
mouse-wheel-scroll-amount '(8 ((shift) . 2)) ;; one line at a time
mouse-wheel-progressive-speed nil ;; don't accelerate scrolling
;;; NOTE These mean nothing to railwaycat's emacs-mac build on OSX
;; Curse Lion and its sudden but inevitable fullscreen mode!
ns-use-native-fullscreen nil
@ -42,8 +44,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(after! evil
(when (featurep 'ns)
(after! evil
;; On OSX, stop copying each visual state move to the clipboard:
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
;; Most of this code grokked from:

View file

@ -17,13 +17,13 @@
(hs-minor-mode 1))
(if count (hs-hide-level count) (evil-close-folds)))
;;;###autoload (autoload 'narf-multi-next-line "defuns-evil" nil t)
(evil-define-motion narf-multi-next-line (count)
;;;###autoload (autoload 'narf/multi-next-line "defuns-evil" nil t)
(evil-define-motion narf/multi-next-line (count)
"Move down 6 lines"
:type line (evil-line-move 6))
;;;###autoload (autoload 'narf-multi-previous-line "defuns-evil" nil t)
(evil-define-motion narf-multi-previous-line (count)
;;;###autoload (autoload 'narf/multi-previous-line "defuns-evil" nil t)
(evil-define-motion narf/multi-previous-line (count)
"Move up 6 lines"
:type line (evil-line-move -6))
@ -53,7 +53,7 @@
(defun narf/evil-surround-escaped ()
"Escaped surround characters."
(let* ((char (string (read-char "\\")))
(pair (cond ((string-match "[]})[{(]" char)
(pair (cond ((string-match-p "[]})[{(]" char)
(let ((-pair (cdr (assoc (string-to-char char) evil-surround-pairs-alist))))
`(,(car -pair) . ,(cdr -pair))))
(t
@ -62,6 +62,12 @@
(cons (format format (car pair))
(format format (cdr pair)))))
;;;###autoload
(defun narf/evil-surround-latex ()
"LaTeX commands"
(let* ((command (read-string "\\")))
(cons (format "\\%s{" command) "}")))
;;;###autoload (autoload 'narf/evil-macro-on-all-lines "defuns-evil" nil t)
(evil-define-operator narf/evil-macro-on-all-lines (beg end &optional arg)
"Apply macro to each line. Courtesy of PythonNut/emacs-config"
@ -75,5 +81,17 @@
(single-key-description
(read-char "What macro?"))))))
;;;###autoload
(defun narf/evil-window-split ()
(interactive)
(call-interactively 'evil-window-split)
(evil-window-down 1))
;;;###autoload
(defun narf/evil-window-vsplit ()
(interactive)
(call-interactively 'evil-window-vsplit)
(evil-window-right 1))
(provide 'defuns-evil)
;;; defuns-evil.el ends here

View file

@ -15,8 +15,38 @@
(interactive "<!>")
(if bang
(writeroom-mode (if writeroom-mode -1 1))
(set-frame-parameter nil 'fullscreen
(when (not (frame-parameter nil 'fullscreen)) 'fullboth))))
(set-frame-parameter nil 'fullscreen (if (not (frame-parameter nil 'fullscreen)) 'fullboth))))
;;;###autoload
(defvar narf--write-mode nil)
(defun narf:toggle-write-mode ()
(interactive)
(require 'writeroom-mode)
(let ((writeroom-width 100)
(writeroom-extra-line-spacing 12))
(writeroom-mode (if writeroom-mode -1 1))
(setq narf--write-mode writeroom-mode)
;; (setq truncate-lines (not narf--write-mode))
;; (setq word-wrap narf--write-mode)
(variable-pitch-mode narf--write-mode)
(if narf--write-mode
(narf/load-theme 'solarized-light)
(narf/reset-theme))
(fringe-mode (if narf--write-mode 0 '(3 . 6)))
(auto-fill-mode (if narf--write-mode -1 +1))
(text-scale-set (if narf--write-mode 2.5 0))
(scroll-bar-mode (if narf--write-mode 1 -1))
(when IS-MAC
(setq ;; sane trackpad/mouse scroll settings
mac-mouse-wheel-smooth-scroll narf--write-mode
mouse-wheel-progressive-speed narf--write-mode))
(when (eq major-mode 'org-mode)
(org-indent-mode (if narf--write-mode -1 1)))))
(defvar narf--big-mode nil)
;;;###autoload
@ -28,7 +58,15 @@
;;;###autoload
(defun narf/reset-theme ()
(interactive)
(load-theme (if window-system narf-theme narf-term-theme) t))
(narf/load-theme 'narf-dark))
;;;###autoload
(defun narf/load-theme (theme)
(interactive)
(mapc (lambda (th)
(when (custom-theme-enabled-p th) (disable-theme th)))
custom-enabled-themes)
(load-theme theme t))
;;;###autoload
(defun narf/default-font ()
@ -40,5 +78,14 @@
(interactive)
(set-frame-font narf-big-font))
;;;###autoload
(defun narf/show-as (how &optional pred)
(let* ((beg (match-beginning 1))
(end (match-end 1))
(ok (or (not pred) (funcall pred beg end))))
(when ok
(compose-region beg end how 'decompose-region))
nil))
(provide 'defuns-ui)
;;; defuns-ui.el ends here

View file

@ -3,7 +3,9 @@
;;;###autoload
(defmacro add-template! (regexp-or-major-mode uuid yas-mode &optional project-only)
`(define-auto-insert ,regexp-or-major-mode
`(define-auto-insert ,(if (stringp regexp-or-major-mode)
regexp-or-major-mode
(eval regexp-or-major-mode))
(lambda ()
(unless (or (and ,project-only (not (narf/project-p)))
(not (or (eq major-mode ,yas-mode)

View file

@ -1,6 +1,6 @@
;;; init-load-path.el
(setq gc-cons-threshold 84857600)
(setq gc-cons-threshold 169715200)
(eval-and-compile
(defconst narf-emacs-dir user-emacs-directory)

11
init.el
View file

@ -2,7 +2,7 @@
;;
;; Author: Henrik Lissner <henrik@lissner.net>
;; URL: https://github.com/hlissner/emacs.d
;; Version: 0.4.0
;; Version: 0.5.0
;;
;;; Are you pondering what I'm pondering, Pinky?
;;
@ -41,9 +41,8 @@
;;; License: GPLv3
(defconst narf-theme 'narf-dark)
(defconst narf-term-theme 'wombat)
(defconst narf-default-font (font-spec :family "DejaVu Sans Mono" :size 12))
(defconst narf-big-font (font-spec :family "Ubuntu Mono" :size 18))
(defconst narf-default-font (font-spec :family "DejaVu Sans Mono" :size 12 :antialias t))
(defconst narf-big-font (font-spec :family "Inconsolata" :size 20 :antialias t))
(scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar
@ -51,7 +50,7 @@
;; prematurely optimize for faster startup
(let (file-name-handler-alist)
(load (concat user-emacs-directory "init-load-path.el"))
(load-theme (if window-system narf-theme narf-term-theme) t)
(load-theme narf-theme t)
(mapc 'require
`(core ; core/core.el
@ -78,7 +77,7 @@
module-collab ; wonewy, I'm so wonewy~
module-data ; dbs 'n data formats
module-elisp ; drowning in parentheses
module-eshell ; eshell (on windows)
;; module-eshell ; eshell (on windows)
module-go ; a hipster dialect
module-java ; the poster child for carpal tunnel syndome
module-js ; alert("not java, javascript!")

View file

@ -27,6 +27,9 @@
`((,(concat "(\\s-*" (regexp-opt keywords 'paren) "\\_>")
1 font-lock-keyword-face)) 'append))
(font-lock-add-keywords
'emacs-lisp-mode `(("\\(lambda\\)" (0 (narf/show-as )))))
;; Real go-to-definition for elisp
(bind! :map emacs-lisp-mode-map
:m "gd" 'narf/elisp-find-function-at-pt

View file

@ -50,8 +50,8 @@
"C-h" 'evil-window-left
"C-l" 'evil-window-right
:m "M-j" 'narf-multi-next-line
:m "M-k" 'narf-multi-previous-line
:m "M-j" 'narf/multi-next-line
:m "M-k" 'narf/multi-previous-line
:n "M-r" 'narf:eval-buffer
:v "M-r" 'narf:eval-region
@ -97,7 +97,7 @@
;; <leader>
(:prefix ","
:nv "," (λ (if (narf/project-p) (helm-projectile-switch-to-buffer) (helm-buffers-list)))
:nv "<" 'helm-mini
:nv "<" 'helm-buffers-list
:nv "." 'helm-find-files
:nv ">" 'helm-projectile-find-file-in-known-projects
:nv "/" 'helm-projectile-find-file
@ -219,8 +219,7 @@
:m "%" 'evilmi-jump-items
:m [tab] (λ (cond ((eq major-mode 'org-mode)
(org-cycle))
(t
(if (ignore-errors (hs-already-hidden-p))
(t (if (ignore-errors (hs-already-hidden-p))
(hs-toggle-hiding)
(call-interactively 'evilmi-jump-items)))))
@ -247,6 +246,11 @@
(:map evil-window-map ; prefix "C-w"
"u" 'winner-undo
;; Jump to new splits
"s" 'narf/evil-window-split
"v" 'narf/evil-window-vsplit
"C-u" 'winner-undo
"C-r" 'winner-redo
"C-h" 'evil-window-left ; don't accidentally invoke help
@ -276,7 +280,7 @@
"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-h" 'company-quickhelp-manual-begin
"C-S-h" 'company-show-location
"C-S-s" 'company-search-candidates
"C-s" 'company-filter-candidates
@ -311,6 +315,10 @@
(global-set-key (kbd "<left-margin> <mouse-1>") 'narf/mouse-select-line)
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'narf/mouse-select-line)
;; Horizontal Scrolling
(global-set-key (kbd "<wheel-right>") (λ (evil-scroll-column-right 2)))
(global-set-key (kbd "<wheel-left>") (λ (evil-scroll-column-left 2)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keymap fixes ;;
@ -321,8 +329,8 @@
;; Restores "dumb" indentation to the tab key. This rustles a lot of
;; peoples' jimmies, apparently, but it's how I like it.
(bind! :i "<tab>" 'narf/dumb-indent
:i "<C-tab>" 'indent-for-tab-command
(bind! :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
@ -378,7 +386,10 @@
:map read-expression-map "C-w" 'evil-delete-backward-word)
(bind! :i "A-o" (λ (insert "ø"))
:i "A-O" (λ (insert "Ø")))
:i "A-O" (λ (insert "Ø"))
:i "A--" (λ (insert ""))
:i "A-_" (λ (insert "")))
;; Disable the global drag-mouse map; clicking in new buffers often sends evil
;; into visual mode, which is UN...ACCEPTAABBLLLEEEE!

View file

@ -11,12 +11,14 @@
(exmap "agr[cw]d" 'narf:helm-regex-search-cwd)
(exmap "al[ign]" 'narf:whitespace-align)
(exmap "bcomp[ile]" 'narf:compile-el)
(exmap "big" 'narf:toggle-big-mode)
(exmap "cap[ture]" 'helm-org-capture-templates)
(exmap "cd" 'narf:cd)
(exmap "dash" 'dash-at-point)
(exmap "echo" 'narf:echo)
(exmap "en[ew]" 'narf:file-create)
(exmap "full[scr]" 'narf:toggle-fullscreen)
(exmap "fullw[rite]" 'narf:toggle-write-mode)
(exmap "gith[ub]" 'narf:github-browse-file)
(exmap "http" 'httpd-start)
(exmap "ini" 'narf:ido-find-file-in-emacsd)