λ macro => λ!
This commit is contained in:
parent
aa26332d00
commit
045e7a6971
8 changed files with 70 additions and 70 deletions
|
@ -7,7 +7,7 @@
|
|||
(defmacro with-eval-after-load (file &rest body)
|
||||
`(eval-after-load ,file (lambda () ,@body))))
|
||||
|
||||
(defmacro λ (&rest body)
|
||||
(defmacro λ! (&rest body)
|
||||
"A shortcut for: `(lambda () (interactive) ,@body)"
|
||||
`(lambda () (interactive) ,@body))
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
'(?☑ ?☐ ?✍ ?⚠))
|
||||
|
||||
(mapc (lambda (x) (set-fontset-font "fontset-default" `(,x . ,x) (font-spec :name "DejaVu Sans" :size 10) nil))
|
||||
'(?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓))
|
||||
'(?➊ ?➋ ?➌ ?➍ ?➎ ?❻ ?➐ ?➑ ?➒ ?➓ ?λ))
|
||||
|
||||
(blink-cursor-mode 1) ; do blink cursor
|
||||
(tooltip-mode -1) ; show tooltips in echo area
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
(defun narf|ido-setup-home-keybind ()
|
||||
"Go to $HOME with ~"
|
||||
(define-key ido-file-completion-map (kbd "~")
|
||||
(λ (if (looking-back "/")
|
||||
(insert "~/")
|
||||
(call-interactively 'self-insert-command)))))
|
||||
(λ! (if (looking-back "/")
|
||||
(insert "~/")
|
||||
(call-interactively 'self-insert-command)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ido-find-file (&optional dir)
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
(map! :map omnisharp-mode-map
|
||||
"gd" 'omnisharp-go-to-definition
|
||||
(:prefix "\\"
|
||||
"tr" (λ (omnisharp-unit-test "fixture"))
|
||||
"ts" (λ (omnisharp-unit-test "single"))
|
||||
"ta" (λ (omnisharp-unit-test "all"))))
|
||||
"tr" (λ! (omnisharp-unit-test "fixture"))
|
||||
"ts" (λ! (omnisharp-unit-test "single"))
|
||||
"ta" (λ! (omnisharp-unit-test "all"))))
|
||||
|
||||
(after! company
|
||||
(define-company-backend! csharp-mode (omnisharp))
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"<M-right>" nil
|
||||
|
||||
;; Assumes you have a markdown renderer plugin in chrome
|
||||
:nv "M-r" (λ (narf-open-with "Google Chrome"))
|
||||
:nv "M-r" (λ! (narf-open-with "Google Chrome"))
|
||||
|
||||
"M-*" 'markdown-insert-list-item
|
||||
"M-b" 'markdown-insert-bold
|
||||
|
|
|
@ -448,17 +448,17 @@ will function properly."
|
|||
:nv "k" 'evil-previous-visual-line
|
||||
:v "<S-tab>" 'narf/yas-insert-snippet
|
||||
|
||||
:i "M-a" (λ (evil-visual-state) (org-mark-element))
|
||||
:i "M-a" (λ! (evil-visual-state) (org-mark-element))
|
||||
:n "M-a" 'org-mark-element
|
||||
:v "M-a" 'mark-whole-buffer
|
||||
|
||||
:ni "<M-return>" (λ (narf/org-insert-item 'below))
|
||||
:ni "<S-M-return>" (λ (narf/org-insert-item 'above))
|
||||
:ni "<M-return>" (λ! (narf/org-insert-item 'below))
|
||||
:ni "<S-M-return>" (λ! (narf/org-insert-item 'above))
|
||||
|
||||
:i "M-b" (λ (narf/org-surround "*")) ; bold
|
||||
:i "M-u" (λ (narf/org-surround "_")) ; underline
|
||||
:i "M-i" (λ (narf/org-surround "/")) ; italics
|
||||
:i "M-`" (λ (narf/org-surround "+")) ; strikethrough
|
||||
:i "M-b" (λ! (narf/org-surround "*")) ; bold
|
||||
:i "M-u" (λ! (narf/org-surround "_")) ; underline
|
||||
:i "M-i" (λ! (narf/org-surround "/")) ; italics
|
||||
:i "M-`" (λ! (narf/org-surround "+")) ; strikethrough
|
||||
|
||||
:v "M-b" "S*"
|
||||
:v "M-u" "S_"
|
||||
|
@ -474,7 +474,7 @@ will function properly."
|
|||
:n "/" 'org-sparse-tree
|
||||
:n "?" 'org-tags-view
|
||||
|
||||
:n "n" (λ (if (buffer-narrowed-p) (widen) (org-narrow-to-subtree)))
|
||||
:n "n" (λ! (if (buffer-narrowed-p) (widen) (org-narrow-to-subtree)))
|
||||
:n "e" 'org-edit-special
|
||||
:n "=" 'org-align-all-tags
|
||||
:nv "l" 'org-insert-link
|
||||
|
@ -491,11 +491,11 @@ will function properly."
|
|||
:n "d" 'org-time-stamp
|
||||
:n "D" 'org-time-stamp-inactive
|
||||
:n "i" 'narf/org-toggle-inline-images-at-point
|
||||
:n "t" (λ (org-todo (if (org-entry-is-todo-p) 'none 'todo)))
|
||||
:n "t" (λ! (org-todo (if (org-entry-is-todo-p) 'none 'todo)))
|
||||
:n "T" 'org-todo
|
||||
:n "s" 'org-schedule
|
||||
:n "r" 'org-refile
|
||||
:n "R" (λ (org-metaleft) (org-archive-to-archive-sibling)) ; archive to parent sibling
|
||||
:n "R" (λ! (org-metaleft) (org-archive-to-archive-sibling)) ; archive to parent sibling
|
||||
|
||||
:n "op" 'narf/org-open-project-at-pt
|
||||
:n "oc" 'narf/org-open-contact-at-pt
|
||||
|
@ -505,16 +505,16 @@ will function properly."
|
|||
;; TODO Improve folding bindings
|
||||
:n "za" 'org-cycle
|
||||
:n "zA" 'org-shifttab
|
||||
:n "zm" (λ (outline-hide-sublevels 1))
|
||||
:n "zm" (λ! (outline-hide-sublevels 1))
|
||||
:n "zr" 'outline-show-all
|
||||
:n "zo" 'outline-show-subtree
|
||||
:n "zO" 'outline-show-all
|
||||
:n "zc" 'outline-hide-subtree
|
||||
:n "zC" (λ (outline-hide-sublevels 1))
|
||||
:n "zC" (λ! (outline-hide-sublevels 1))
|
||||
:n "zd" (lambda (&optional arg) (interactive "p") (outline-hide-sublevels (or arg 3)))
|
||||
|
||||
:m "]]" (λ (call-interactively 'org-forward-heading-same-level) (org-beginning-of-line))
|
||||
:m "[[" (λ (call-interactively 'org-backward-heading-same-level) (org-beginning-of-line))
|
||||
:m "]]" (λ! (call-interactively 'org-forward-heading-same-level) (org-beginning-of-line))
|
||||
:m "[[" (λ! (call-interactively 'org-backward-heading-same-level) (org-beginning-of-line))
|
||||
:m "]l" 'org-next-link
|
||||
:m "[l" 'org-previous-link
|
||||
|
||||
|
@ -523,10 +523,10 @@ will function properly."
|
|||
:m "gh" 'outline-up-heading
|
||||
:m "gj" 'org-forward-heading-same-level
|
||||
:m "gk" 'org-backward-heading-same-level
|
||||
:m "gl" (λ (call-interactively 'outline-next-visible-heading) (show-children))
|
||||
:m "gl" (λ! (call-interactively 'outline-next-visible-heading) (show-children))
|
||||
|
||||
:n "go" 'org-open-at-point
|
||||
:n "gO" (λ (let ((org-link-frame-setup (append '((file . find-file-other-window)) org-link-frame-setup))
|
||||
:n "gO" (λ! (let ((org-link-frame-setup (append '((file . find-file-other-window)) org-link-frame-setup))
|
||||
(org-file-apps '(("\\.org$" . emacs)
|
||||
(t . "open \"%s\""))))
|
||||
(call-interactively 'org-open-at-point)))
|
||||
|
@ -536,13 +536,13 @@ will function properly."
|
|||
:m "^" 'org-beginning-of-line
|
||||
:n "<" 'org-metaleft
|
||||
:n ">" 'org-metaright
|
||||
:v "<" (λ (org-metaleft) (evil-visual-restore))
|
||||
:v ">" (λ (org-metaright) (evil-visual-restore))
|
||||
:v "<" (λ! (org-metaleft) (evil-visual-restore))
|
||||
:v ">" (λ! (org-metaright) (evil-visual-restore))
|
||||
:n "-" 'org-cycle-list-bullet
|
||||
:n [tab] 'org-cycle)
|
||||
|
||||
(:map org-src-mode-map
|
||||
:n "<escape>" (λ (message "Exited") (org-edit-src-exit)))
|
||||
:n "<escape>" (λ! (message "Exited") (org-edit-src-exit)))
|
||||
|
||||
(:after org-agenda
|
||||
(:map org-agenda-mode-map
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"A-;" 'eval-expression
|
||||
"A-/" 'evil-commentary-line
|
||||
|
||||
"M-0" (λ (text-scale-set 0))
|
||||
"M-0" (λ! (text-scale-set 0))
|
||||
"M-=" 'text-scale-increase
|
||||
"M--" 'text-scale-decrease
|
||||
|
||||
|
@ -57,15 +57,15 @@
|
|||
:n "M-o" 'narf/ido-find-file
|
||||
:n "M-O" 'narf/ido-find-project-file
|
||||
|
||||
:m "M-1" (λ (narf:switch-to-workgroup-at-index 0))
|
||||
:m "M-2" (λ (narf:switch-to-workgroup-at-index 1))
|
||||
:m "M-3" (λ (narf:switch-to-workgroup-at-index 2))
|
||||
:m "M-4" (λ (narf:switch-to-workgroup-at-index 3))
|
||||
:m "M-5" (λ (narf:switch-to-workgroup-at-index 4))
|
||||
:m "M-6" (λ (narf:switch-to-workgroup-at-index 5))
|
||||
:m "M-7" (λ (narf:switch-to-workgroup-at-index 6))
|
||||
:m "M-8" (λ (narf:switch-to-workgroup-at-index 7))
|
||||
:m "M-9" (λ (narf:switch-to-workgroup-at-index 8))
|
||||
:m "M-1" (λ! (narf:switch-to-workgroup-at-index 0))
|
||||
:m "M-2" (λ! (narf:switch-to-workgroup-at-index 1))
|
||||
:m "M-3" (λ! (narf:switch-to-workgroup-at-index 2))
|
||||
:m "M-4" (λ! (narf:switch-to-workgroup-at-index 3))
|
||||
:m "M-5" (λ! (narf:switch-to-workgroup-at-index 4))
|
||||
:m "M-6" (λ! (narf:switch-to-workgroup-at-index 5))
|
||||
:m "M-7" (λ! (narf:switch-to-workgroup-at-index 6))
|
||||
:m "M-8" (λ! (narf:switch-to-workgroup-at-index 7))
|
||||
:m "M-9" (λ! (narf:switch-to-workgroup-at-index 8))
|
||||
|
||||
(:when IS-MAC
|
||||
"<A-left>" 'backward-word
|
||||
|
@ -85,11 +85,11 @@
|
|||
|
||||
;; Textmate-esque indent shift left/right
|
||||
:i "M-[" (kbd "C-o m l C-o I DEL C-o ` l")
|
||||
:i "M-]" (λ (evil-shift-right (point-at-bol) (point-at-eol)))
|
||||
:i "M-]" (λ! (evil-shift-right (point-at-bol) (point-at-eol)))
|
||||
|
||||
;; Restore osx text objects
|
||||
:i "<A-backspace>" 'evil-delete-backward-word
|
||||
:i "<A-delete>" (λ (evil-forward-word) (evil-delete-backward-word)))
|
||||
:i "<A-delete>" (λ! (evil-forward-word) (evil-delete-backward-word)))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -187,7 +187,7 @@
|
|||
:nv "K" 'smart-up
|
||||
|
||||
;; Don't move cursor on indent
|
||||
:n "=" (λ (save-excursion (call-interactively 'evil-indent)))
|
||||
:n "=" (λ! (save-excursion (call-interactively 'evil-indent)))
|
||||
:v "=" 'evil-indent
|
||||
|
||||
:n "zr" 'narf/evil-open-folds
|
||||
|
@ -224,13 +224,13 @@
|
|||
:v "." 'evil-repeat
|
||||
|
||||
;; vnoremap < <gv
|
||||
:v "<" (λ (evil-shift-left (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
: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))
|
||||
:v ">" (λ! (evil-shift-right (region-beginning) (region-end))
|
||||
(evil-normal-state)
|
||||
(evil-visual-restore))
|
||||
|
||||
;; undo/redo for regions
|
||||
;; :nv "u" 'undo-tree-undo
|
||||
|
@ -251,11 +251,11 @@
|
|||
|
||||
;; aliases for %
|
||||
:m "%" 'evilmi-jump-items
|
||||
:m [tab] (λ (cond ((eq major-mode 'org-mode)
|
||||
(org-cycle))
|
||||
(t (if (ignore-errors (hs-already-hidden-p))
|
||||
(hs-toggle-hiding)
|
||||
(call-interactively 'evilmi-jump-items)))))
|
||||
:m [tab] (λ! (cond ((eq major-mode 'org-mode)
|
||||
(org-cycle))
|
||||
(t (if (ignore-errors (hs-already-hidden-p))
|
||||
(hs-toggle-hiding)
|
||||
(call-interactively 'evilmi-jump-items)))))
|
||||
|
||||
;; Textmate-esque newlines
|
||||
:i "<backspace>" 'backward-delete-char-untabify
|
||||
|
@ -295,8 +295,8 @@
|
|||
"C-l" 'evil-window-right ; don't accidentally invoke help
|
||||
|
||||
"C-w" 'ace-window
|
||||
"C-S-w" (λ (ace-window 4)) ; swap windows
|
||||
"C-C" (λ (ace-window 16))) ; delete windows
|
||||
"C-S-w" (λ! (ace-window 4)) ; swap windows
|
||||
"C-C" (λ! (ace-window 16))) ; delete windows
|
||||
|
||||
;; Vim omni-complete emulation
|
||||
:i "C-SPC" 'company-complete-common
|
||||
|
@ -309,9 +309,9 @@
|
|||
:i "C-s" 'company-yasnippet
|
||||
:i "C-o" 'company-semantic
|
||||
:i "C-n" 'company-dabbrev-code
|
||||
:i "C-p" (λ (let ((company-selection-wrap-around t))
|
||||
(call-interactively 'company-dabbrev-code)
|
||||
(company-select-previous-or-abort))))
|
||||
:i "C-p" (λ! (let ((company-selection-wrap-around t))
|
||||
(call-interactively 'company-dabbrev-code)
|
||||
(company-select-previous-or-abort))))
|
||||
|
||||
(:after company
|
||||
(:map company-active-map
|
||||
|
@ -325,7 +325,7 @@
|
|||
"C-SPC" 'company-complete-common-or-cycle
|
||||
[tab] 'narf/company-complete-common-or-complete-full
|
||||
"<backtab>" 'company-select-previous
|
||||
[escape] (λ (company-abort) (evil-normal-state 1))
|
||||
[escape] (λ! (company-abort) (evil-normal-state 1))
|
||||
"<C-return>" 'helm-company)
|
||||
(:map company-search-map
|
||||
"C-n" 'company-search-repeat-forward
|
||||
|
@ -341,10 +341,10 @@
|
|||
(:map help-mode-map
|
||||
:n "]]" 'help-go-forward
|
||||
:n "[[" 'help-go-back
|
||||
:n "<escape>" (λ (kill-buffer)
|
||||
(if (narf/popup-p (current-buffer))
|
||||
(narf/popup-close)
|
||||
(evil-window-delete))))))
|
||||
:n "<escape>" (λ! (kill-buffer)
|
||||
(if (narf/popup-p (current-buffer))
|
||||
(narf/popup-close)
|
||||
(evil-window-delete))))))
|
||||
|
||||
;; Line-wise mouse selection on margin
|
||||
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'narf/mouse-drag-line)
|
||||
|
@ -403,8 +403,8 @@
|
|||
:i "<M-return>" 'evil-open-below
|
||||
:i "<S-M-return>" 'evil-open-above
|
||||
;; insert lines in-place)
|
||||
:n "<M-return>" (λ (save-excursion (evil-insert-newline-below)))
|
||||
:n "<S-M-return>" (λ (save-excursion (evil-insert-newline-above)))
|
||||
:n "<M-return>" (λ! (save-excursion (evil-insert-newline-below)))
|
||||
:n "<S-M-return>" (λ! (save-excursion (evil-insert-newline-above)))
|
||||
|
||||
;; Make ESC quit all the things
|
||||
:e [escape] 'evil-normal-state
|
||||
|
@ -423,11 +423,11 @@
|
|||
(:map evil-ex-completion-map "C-a" 'move-beginning-of-line))
|
||||
|
||||
;; Common unicode characters
|
||||
(map! :i "A-o" (λ (insert "ø"))
|
||||
:i "A-O" (λ (insert "Ø"))
|
||||
(map! :i "A-o" (λ! (insert "ø"))
|
||||
:i "A-O" (λ! (insert "Ø"))
|
||||
|
||||
:i "A--" (λ (insert "–"))
|
||||
:i "A-_" (λ (insert "—")))
|
||||
:i "A--" (λ! (insert "–"))
|
||||
:i "A-_" (λ! (insert "—")))
|
||||
|
||||
(provide 'my-bindings)
|
||||
;;; my-bindings.el ends here
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
(exmap "repl" 'narf:repl)
|
||||
(exmap "t[mux]" 'narf:send-to-tmux)
|
||||
(exmap "t[mux]s" 'narf/tmux-split-window)
|
||||
(exmap "t[mux]v" (λ (narf/tmux-split-window t)))
|
||||
(exmap "t[mux]v" (λ! (narf/tmux-split-window t)))
|
||||
(exmap "t[mux]w" 'narf/tmux-new-window)
|
||||
(exmap "tcd" 'narf:tmux-cd)
|
||||
(exmap "x" 'narf:scratch-buffer)
|
||||
|
@ -68,7 +68,7 @@
|
|||
|
||||
;; Plugins
|
||||
(after! flycheck
|
||||
(exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
||||
(exmap "er[rors]" (λ! (flycheck-buffer) (flycheck-list-errors))))
|
||||
|
||||
(after! workgroups2
|
||||
(exmap "sl[oad]" 'narf:load-session)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue