Revert macros to ...! name convention (elisp doesn't like @...)

This commit is contained in:
Henrik Lissner 2017-02-23 00:06:12 -05:00
parent b64d5554e3
commit 33c88d4f82
125 changed files with 877 additions and 880 deletions

View file

@ -4,7 +4,7 @@
(setq x-super-keysym 'alt
x-alt-keysym 'meta)
(defmacro @find-file-in (path &optional project-p)
(defmacro find-file-in! (path &optional project-p)
"Returns a interactive function for searching files"
`(lambda () (interactive)
(let ((default-directory ,path))
@ -12,7 +12,7 @@
'(call-interactively (command-remapping 'projectile-find-file))
'(call-interactive (command-remapping 'find-file))))))
(@map
(map!
;; Essential
"M-x" 'execute-extended-command
"A-x" 'execute-extended-command
@ -22,7 +22,7 @@
[f9] 'doom/what-face
"C-`" 'doom/popup-toggle
;; Text-scaling
"M-0" (@λ (text-scale-set 0))
"M-0" (λ! (text-scale-set 0))
"M-=" 'text-scale-increase
"M--" 'text-scale-decrease
;; Simple window navigation/manipulation
@ -46,15 +46,15 @@
:n [C-escape] 'evil-normal-state
;; Switching tabs (workgroups)
"M-1" (@λ (+workspace/switch-to 0))
"M-2" (@λ (+workspace/switch-to 1))
"M-3" (@λ (+workspace/switch-to 2))
"M-4" (@λ (+workspace/switch-to 3))
"M-5" (@λ (+workspace/switch-to 4))
"M-6" (@λ (+workspace/switch-to 5))
"M-7" (@λ (+workspace/switch-to 6))
"M-8" (@λ (+workspace/switch-to 7))
"M-9" (@λ (+workspace/switch-to 8))
"M-1" (λ! (+workspace/switch-to 0))
"M-2" (λ! (+workspace/switch-to 1))
"M-3" (λ! (+workspace/switch-to 2))
"M-4" (λ! (+workspace/switch-to 3))
"M-5" (λ! (+workspace/switch-to 4))
"M-6" (λ! (+workspace/switch-to 5))
"M-7" (λ! (+workspace/switch-to 6))
"M-8" (λ! (+workspace/switch-to 7))
"M-9" (λ! (+workspace/switch-to 8))
"M-0" '+workspace/switch-to-last
[M-backspace] 'doom/backward-kill-to-bol-and-indent
@ -115,7 +115,7 @@
(:desc "SSH/FTP"
:prefix "u"
:desc "Upload local" :n "u" '+upload/local
:desc "Upload local (force)" :n "U" (@λ (+upload/local t))
:desc "Upload local (force)" :n "U" (λ! (+upload/local t))
:desc "Download remote" :n "d" '+upload/remote-download
:desc "Diff local & remote" :n "D" '+upload/diff
:desc "Browse remote files" :n "." '+upload/browse
@ -245,7 +245,7 @@
:i "C-s" 'company-yasnippet
:i "C-o" 'company-capf
:i "C-n" 'company-dabbrev-code
:i "C-p" (@λ (let ((company-selection-wrap-around t))
:i "C-p" (λ! (let ((company-selection-wrap-around t))
(call-interactively 'company-dabbrev-code)
(company-select-previous-or-abort))))
;; evil-visual-star
@ -286,7 +286,7 @@
;; This section is dedicated to "fixing" certain keys so that they behave
;; properly or more like vim (or how I like it).
(@map (:unless window-system "TAB" [tab]) ; Fix TAB in terminal
(map! (:unless window-system "TAB" [tab]) ; Fix TAB in terminal
;; I want C-a and C-e to be a little smarter. C-a will jump to
;; indentation. Pressing it again will send you to the true bol. Same goes
@ -300,7 +300,7 @@
:i "<tab>" 'doom/dumb-indent
:i "<backtab>" 'doom/dumb-dedent
:i "<C-tab>" 'indent-for-tab-command
:i "<A-tab>" (@λ (insert "\t"))
:i "<A-tab>" (λ! (insert "\t"))
;; 'smart' indentation for lisp modes
(:after lisp-mode
(:map lisp-mode-map :i [remap doom/dumb-indent] 'indent-for-tab-command))

View file

@ -1,86 +1,86 @@
(defalias '@ex 'evil-ex-define-cmd)
(defalias 'ex! 'evil-ex-define-cmd)
;;; Custom commands
;; Emacs utilities
(@ex "bc[omp]" '+hlissner:byte-compile)
(@ex "clog" 'global-command-log-mode)
(@ex "minor" 'describe-minor-mode) ; list minor modes
(@ex "re[load]" 'doom/reload)
(@ex "re[load]au" 'doom/reload-autoloads)
(ex! "bc[omp]" '+hlissner:byte-compile)
(ex! "clog" 'global-command-log-mode)
(ex! "minor" 'describe-minor-mode) ; list minor modes
(ex! "re[load]" 'doom/reload)
(ex! "re[load]au" 'doom/reload-autoloads)
;; Editing
(@ex "@" '+evil:macro-on-all-lines) ; TODO Test me
(@ex "date" '+text:insert-date)
(@ex "enhtml" '+hlissner:encode-html-entities)
(@ex "dehtml" '+hlissner:decode-html-entities)
(@ex "ie[dit]" 'evil-multiedit-ex-match)
(@ex "na[rrow]" '+hlissner:narrow-buffer)
(@ex "ref[actor]" 'emr-show-refactor-menu)
(@ex "retab" '+hlissner:retab)
(ex! "@" '+evil:macro-on-all-lines) ; TODO Test me
(ex! "date" '+text:insert-date)
(ex! "enhtml" '+hlissner:encode-html-entities)
(ex! "dehtml" '+hlissner:decode-html-entities)
(ex! "ie[dit]" 'evil-multiedit-ex-match)
(ex! "na[rrow]" '+hlissner:narrow-buffer)
(ex! "ref[actor]" 'emr-show-refactor-menu)
(ex! "retab" '+hlissner:retab)
;; External resources
;; TODO (@ex "db" 'doom:db)
;; TODO (@ex "dbu[se]" 'doom:db-select)
;; TODO (@ex "go[ogle]" 'doom:google-search)
(@ex "http" 'httpd-start) ; start http server
(@ex "repl" '+repl/run) ; invoke or send to repl
;; TODO (@ex "rx" 'doom:regex) ; open re-builder
(@ex "sh[ell]" '+eshell:run)
(@ex "t[mux]" '+tmux:run) ; send to tmux
(@ex "tcd" '+tmux:cd-here) ; cd to default-directory in tmux
(@ex "x" 'doom:scratch-buffer)
;; TODO (ex! "db" 'doom:db)
;; TODO (ex! "dbu[se]" 'doom:db-select)
;; TODO (ex! "go[ogle]" 'doom:google-search)
(ex! "http" 'httpd-start) ; start http server
(ex! "repl" '+repl/run) ; invoke or send to repl
;; TODO (ex! "rx" 'doom:regex) ; open re-builder
(ex! "sh[ell]" '+eshell:run)
(ex! "t[mux]" '+tmux:run) ; send to tmux
(ex! "tcd" '+tmux:cd-here) ; cd to default-directory in tmux
(ex! "x" 'doom:scratch-buffer)
;; GIT
(@ex "gbrowse" '+vcs/git-browse) ; show file in github/gitlab
(@ex "gissues" '+vcs/git-browse-issues) ; show github issues
(@ex "git" 'magit-status) ; open magit status window
(@ex "gstage" 'magit-stage)
(@ex "gunstage" 'magit-unstage)
(ex! "gbrowse" '+vcs/git-browse) ; show file in github/gitlab
(ex! "gissues" '+vcs/git-browse-issues) ; show github issues
(ex! "git" 'magit-status) ; open magit status window
(ex! "gstage" 'magit-stage)
(ex! "gunstage" 'magit-unstage)
;; TODO :gblame
;; TODO :grevert
;; TODO :gblame
;; Dealing with buffers
(@ex "clean[up]" 'doom:cleanup-buffers) ; Clean up old/unreal buffers
(@ex "k[ill]" 'doom/kill-real-buffer) ; Kill current buffer
(@ex "k[ill]all" 'doom:kill-all-buffers) ; Kill buffers (bang = in project)
(@ex "k[ill]m" 'doom:kill-matching-buffers) ; kill buffers by regexp
(@ex "k[ill]o" 'doom:kill-other-buffers) ; kill other buffers
(@ex "l[ast]" 'doom/popup-last-buffer) ; pop up last popup
(@ex "m[sg]" 'view-echo-area-messages) ; open *messages* in popup
(@ex "pop[up]" 'doom/popup) ; open current buffer in popup
(ex! "clean[up]" 'doom/cleanup-buffers) ; Clean up old/unreal buffers
(ex! "k[ill]" 'doom/kill-real-buffer) ; Kill current buffer
(ex! "k[ill]all" 'doom:kill-all-buffers) ; Kill buffers (bang = in project)
(ex! "k[ill]m" 'doom:kill-matching-buffers) ; kill buffers by regexp
(ex! "k[ill]o" 'doom:kill-other-buffers) ; kill other buffers
(ex! "l[ast]" 'doom/popup-last-buffer) ; pop up last popup
(ex! "m[sg]" 'view-echo-area-messages) ; open *messages* in popup
(ex! "pop[up]" 'doom/popup) ; open current buffer in popup
;; Project navigation
(@ex "a" 'projectile-find-other-file)
(@ex "ag" '+ivy:ag-search)
(@ex "ag[cw]d" '+ivy:ag-search-cwd)
(@ex "cd" '+hlissner:cd)
(@ex "sw[iper]" '+ivy:swiper) ; in-file search
(ex! "a" 'projectile-find-other-file)
(ex! "ag" '+ivy:ag-search)
(ex! "ag[cw]d" '+ivy:ag-search-cwd)
(ex! "cd" '+hlissner:cd)
(ex! "sw[iper]" '+ivy:swiper) ; in-file search
;; Project tools
(@ex "build" '+eval/build)
(@ex "debug" '+debug/run)
(@ex "er[rors]" 'flycheck-list-errors)
(@ex "todo" '+ivy/tasks)
(ex! "build" '+eval/build)
(ex! "debug" '+debug/run)
(ex! "er[rors]" 'flycheck-list-errors)
(ex! "todo" '+ivy/tasks)
;; File operations
(@ex "mv" '+evil:file-move)
(@ex "rm" '+evil:file-delete)
(ex! "mv" '+evil:file-move)
(ex! "rm" '+evil:file-delete)
;; Sessions/tabs
(@ex "sclear" '+workspace/kill-session)
(@ex "sl[oad]" '+workspace:load-session) ; TODO :sload [NAME]
(@ex "ss[ave]" '+workspace:save-session) ; TODO :ssave [NAME]
(@ex "tabc[lose]" '+workspace:delete)
(@ex "tabclear" 'doom/kill-all-buffers)
(@ex "tabl[ast]" '+workspace/switch-to-list)
(@ex "tabload" '+workspace:load)
(@ex "tabn[ew]" '+workspace:new)
(@ex "tabn[ext]" '+workspace:switch-next)
(@ex "tabp[rev]" '+workspace:switch-previous)
(@ex "tabr[ename]" '+workspace:rename)
(@ex "tabs" '+workspace/display)
(@ex "tabsave" '+workspace:save)
(ex! "sclear" '+workspace/kill-session)
(ex! "sl[oad]" '+workspace:load-session) ; TODO :sload [NAME]
(ex! "ss[ave]" '+workspace:save-session) ; TODO :ssave [NAME]
(ex! "tabc[lose]" '+workspace:delete)
(ex! "tabclear" 'doom/kill-all-buffers)
(ex! "tabl[ast]" '+workspace/switch-to-list)
(ex! "tabload" '+workspace:load)
(ex! "tabn[ew]" '+workspace:new)
(ex! "tabn[ext]" '+workspace:switch-next)
(ex! "tabp[rev]" '+workspace:switch-previous)
(ex! "tabr[ename]" '+workspace:rename)
(ex! "tabs" '+workspace/display)
(ex! "tabsave" '+workspace:save)
;; Org-mode
(@ex "org" '+org:capture)
(ex! "org" '+org:capture)

View file

@ -1,8 +1,8 @@
;;; private/hlissner/config.el
(@load +bindings) ; my key bindings
(load! +bindings) ; my key bindings
(when (featurep 'evil)
(@load +commands)) ; my custom ex commands
(load! +commands)) ; my custom ex commands
(defvar +hlissner-snippets-dir
(expand-file-name "snippets/" (file-name-directory load-file-name)))
@ -12,19 +12,19 @@
;; the right side of the frame (which causes display glitches). I fix this by
;; simply cycling fullscreen:
(when (and (display-graphic-p) IS-LINUX)
(@add-hook 'after-init-hook
(add-hook! 'after-init-hook
(set-frame-parameter nil 'fullscreen 'fullboth)
(set-frame-parameter nil 'fullscreen nil)))
;; Don't use default snippets, use mine.
(@after yasnippet
(after! yasnippet
(setq yas-snippet-dirs (append (list '+hlissner-snippets-dir)
(delete 'yas-installed-snippets-dir yas-snippet-dirs))))
;; Repeat all sorts of motion and searches with SPC & C-SPC
(defmacro +my@repeat-with-spc (command next-func prev-func)
(defmacro +my!repeat-with-spc (command next-func prev-func)
"Repeat motions with SPC/S-SPC"
(let ((fn-sym (intern (format "+evil*repeat-%s" command))))
`(progn
@ -33,31 +33,31 @@
(define-key evil-motion-state-map (kbd "S-SPC") ',prev-func))
(advice-add ',command :before ',fn-sym))))
(@after evil
(after! evil
;; n/N
(+my@repeat-with-spc evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
(+my@repeat-with-spc evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
(+my@repeat-with-spc evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
(+my@repeat-with-spc evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
(+my!repeat-with-spc evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
(+my!repeat-with-spc evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
(+my!repeat-with-spc evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
(+my!repeat-with-spc evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
;; f/F/t/T/s/S
(@after evil-snipe
(after! evil-snipe
(setq evil-snipe-repeat-keys nil
evil-snipe-override-evil-repeat-keys nil) ; causes problems with remapped ;
(+my@repeat-with-spc evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
(+my@repeat-with-spc evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
(+my!repeat-with-spc evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
(+my!repeat-with-spc evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
;; */#
(@after evil-visualstar
(+my@repeat-with-spc evil-visualstar/begin-search-forward
(after! evil-visualstar
(+my!repeat-with-spc evil-visualstar/begin-search-forward
evil-ex-search-next evil-ex-search-previous)
(+my@repeat-with-spc evil-visualstar/begin-search-backward
(+my!repeat-with-spc evil-visualstar/begin-search-backward
evil-ex-search-previous evil-ex-search-next)))