Skip to content

Commit

Permalink
speedup general
Browse files Browse the repository at this point in the history
  • Loading branch information
tshu-w committed Jul 12, 2022
1 parent 7be17b8 commit 6f709a9
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 86 deletions.
55 changes: 30 additions & 25 deletions lisp/core-keybinds.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@
:straight t
:after evil
:config
(general-create-definer tyrant-def
:states '(normal insert motion emacs)
:keymaps 'override
:prefix "SPC"
:non-normal-prefix "M-SPC")
(setq general-emit-autoloads nil)

(general-define-key
:states '(normal insert motion emacs)
:keymaps 'override
:prefix-map 'tyrant-map
:prefix "SPC"
:non-normal-prefix "M-SPC")

(general-create-definer tyrant-def :keymaps 'tyrant-map)
(tyrant-def "" nil)

(general-create-definer despot-def
Expand All @@ -43,16 +48,16 @@
"SPC u" 'universal-argument-more)

(tyrant-def
"SPC" '(execute-extended-command :which-key "M-x")
"TAB" '(alternate-buffer :whick-key "last buffer")
"!" '(shell-command :which-key "shell cmd")
"SPC" '("M-x" . execute-extended-command)
"TAB" '("last buffer" . alternate-buffer)
"!" '("shell cmd" . shell-command)

"a" '(:ignore t :which-key "applications")
"a" (cons "applications" (make-sparse-keymap))
"ac" 'calc-dispatch
"ap" 'list-processes
"aP" 'proced

"b" '(:ignore t :which-key "buffers")
"b" (cons "buffers" (make-sparse-keymap))
"bb" 'switch-to-buffer
"bB" 'ibuffer
"bd" 'kill-current-buffer
Expand All @@ -61,7 +66,7 @@
"bu" 'reopen-killed-buffer
"bx" 'kill-buffer-and-window

"c" '(:ignore t :which-key "code")
"c" (cons "code" (make-sparse-keymap))
"cb" 'flymake-show-buffer-diagnostics
"cc" 'compile
"cn" 'next-error
Expand All @@ -70,8 +75,8 @@
"cx" 'kill-compilation
"c=" 'indent-region-or-buffer

"f" '(:ignore t :which-key "files")
"fC" '(write-file :which-key "copy-file")
"f" (cons "files" (make-sparse-keymap))
"fC" '("copy-file" . write-file)
"fD" 'delete-current-buffer-file
"fe" 'find-library
"fE" 'sudo-edit
Expand All @@ -82,18 +87,18 @@
"fr" 'read-only-mode
"fR" 'rename-current-buffer-file
"fs" 'save-buffer
"fv" '(:ignore t :which-key "variables")
"fv" (cons "variables" (make-sparse-keymap))
"fvd" 'add-dir-local-variable
"fvf" 'add-file-local-variable
"fvp" 'add-file-local-variable-prop-line

"F" '(:ignore t :which-key "frame")
"F" (cons "frame" (make-sparse-keymap))
"Fd" 'delete-frame
"FD" 'delete-other-frames
"Fn" 'make-frame
"Fo" 'other-frame

"h" '(:ignore t :which-key "help")
"h" (cons "help" (make-sparse-keymap))
"ha" 'apropos
"hb" 'describe-bindings
"hc" 'describe-char
Expand All @@ -108,32 +113,32 @@
"hp" 'describe-package
"ht" 'describe-text-properties
"hv" 'describe-variable
"hP" '(:ignore t :which-key "profiler")
"hP" (cons "profiler" (make-sparse-keymap))
"hPs" 'profiler-start
"hPk" 'profiler-stop
"hPr" 'profiler-report

"j" '(:ignore t :which-key "jump")
"j" (cons "jump" (make-sparse-keymap))
"ji" 'imenu
"jg" 'avy-goto-char-2

"m" '(:ignore t :which-key "major mode")
"m" (cons "major mode" (make-sparse-keymap))

"p" '(:keymap project-prefix-map :which-key "projects")
"p" (cons "projects" project-prefix-map)

"q" '(:ignore t :which-key "quit")
"q" (cons "quit" (make-sparse-keymap))
"qd" 'restart-emacs-debug-init
"qr" 'restart-emacs
"qR" 'restart-emacs-without-desktop
"qq" 'save-buffers-kill-terminal
"qQ" 'kill-emacs

"s" '(:ignore t :which-key "spelling")
"s" (cons "spelling" (make-sparse-keymap))
"sb" 'flyspell-buffer
"sn" 'flyspell-goto-next-error
"sr" 'flyspell-region

"T" '(:ignore t :which-key "toggles")
"T" (cons "toggles" (make-sparse-keymap))
"Ta" 'auto-fill-mode
"Td" 'toggle-debug-on-error
"Tf" 'display-fill-column-indicator-mode
Expand All @@ -144,9 +149,9 @@
"Tw" 'whitespace-mode
"TW" 'toggle-word-wrap

"u" '(universal-argument :which-key "universal arg")
"u" '("universal arg" . universal-argument)

"w" '(:ignore t :which-key "windows")
"w" (cons "windows" (make-sparse-keymap))
"w TAB" 'alternate-window
"w+" 'window-layout-toggle
"wb" 'switch-to-minibuffer-window
Expand Down
8 changes: 4 additions & 4 deletions lisp/editor-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@
[remap imenu] 'consult-imenu
[remap apropos] 'consult-apropos)
(tyrant-def
"jI" '(consult-imenu-multi :which-key "imenu-multi")
"fl" '(consult-find :which-key "locate-files")
"jj" '(consult-line :which-key "search lines")
"jJ" '(consult-line-multi :which-key "search lines a/ buffers")
"jI" '("imenu-multi" . consult-imenu-multi)
"fl" '("locate-files" . consult-find)
"jj" '("search lines" . consult-line)
"jJ" '("search lines a/ buffers" . consult-line-multi)
"Tt" 'consult-minor-mode-menu)
(org-mode-map
[remap consult-imenu] 'consult-org-heading
Expand Down
3 changes: 2 additions & 1 deletion lisp/editor-mail.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

(use-package mu4e
:load-path "/usr/local/share/emacs/site-lisp/mu/mu4e"
:commands (mu4e-org-open
:commands (mu4e
mu4e-org-open
mu4e-org-store-link)
:init
(setq mu4e-maildir "$XDG_DATA_HOME/mail"
Expand Down
42 changes: 23 additions & 19 deletions lisp/editor-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ reuse it's window, otherwise create new one."
(use-package winum
:straight t
:hook (after-init . winum-mode)
:init
(with-eval-after-load 'which-key
(push '((nil . "winum-select-window-[1-9]") . t) which-key-replacement-alist)
(push '((nil . "buffer-to-window-[1-9]") . t) which-key-replacement-alist))
:config
(setq winum-auto-assign-0-to-minibuffer t
winum-auto-setup-mode-line t
Expand Down Expand Up @@ -297,25 +301,25 @@ stays on current"
(swap-buffers-to-window ,n t))))))
:general
(tyrant-def
"0" '(winum-select-window-0-or-10 :which-key "select window 0 or 10")
"1" '(winum-select-window-1 :which-key ("1\.\.9" . "select window 1..9"))
"2" '(winum-select-window-2 :which-key t)
"3" '(winum-select-window-3 :which-key t)
"4" '(winum-select-window-4 :which-key t)
"5" '(winum-select-window-5 :which-key t)
"6" '(winum-select-window-6 :which-key t)
"7" '(winum-select-window-7 :which-key t)
"8" '(winum-select-window-8 :which-key t)
"9" '(winum-select-window-9 :which-key t)
"b1" '(buffer-to-window-1 :which-key ("1\.\.9" . "Move buffer to window 1..9"))
"b2" '(buffer-to-window-2 :which-key t)
"b3" '(buffer-to-window-3 :which-key t)
"b4" '(buffer-to-window-4 :which-key t)
"b5" '(buffer-to-window-5 :which-key t)
"b6" '(buffer-to-window-6 :which-key t)
"b7" '(buffer-to-window-7 :which-key t)
"b8" '(buffer-to-window-8 :which-key t)
"b9" '(buffer-to-window-9 :which-key t)))
"0" '("select window 0 or 10" . winum-select-window-0-or-10)
"1" '("select window 1..9" . winum-select-window-1)
"2" 'winum-select-window-2
"3" 'winum-select-window-3
"4" 'winum-select-window-4
"5" 'winum-select-window-5
"6" 'winum-select-window-6
"7" 'winum-select-window-7
"8" 'winum-select-window-8
"9" 'winum-select-window-9
"b1" '("Move buffer to window 1..9" . buffer-to-window-1)
"b2" 'buffer-to-window-2
"b3" 'buffer-to-window-3
"b4" 'buffer-to-window-4
"b5" 'buffer-to-window-5
"b6" 'buffer-to-window-6
"b7" 'buffer-to-window-7
"b8" 'buffer-to-window-8
"b9" 'buffer-to-window-9))

(use-package wakatime-mode
:straight t
Expand Down
6 changes: 3 additions & 3 deletions lisp/editor-vsc.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
(advice-add 'magit-diff-visit-worktree-file :after #'org-reveal-advice)
:general
(tyrant-def
"g" '(:ignore t :which-key "git")
"g" (cons "git" (make-sparse-keymap))
"gb" 'magit-blame
"gc" 'magit-clone
"gd" 'magit-diff
Expand Down Expand Up @@ -110,7 +110,7 @@
(call-interactively 'git-link-commit)))
:general
(tyrant-def
"gL" '(:ignore t :which-key "links")
"gL" (cons "links" (make-sparse-keymap))
"gLc" 'git-link-commit
"gLC" 'git-link-commit-copy-url-only
"gLl" 'git-link
Expand All @@ -123,7 +123,7 @@
(setq gitignore-templates-api 'github)
:general
(tyrant-def
"gI" '(:ignore t :which-key "gitignore")
"gI" (cons "gitignore" (make-sparse-keymap))
"gIn" 'gitignore-templates-new-file
"gIi" 'gitignore-templates-insert))

Expand Down
6 changes: 3 additions & 3 deletions lisp/lang-emacs-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
:config
(despot-def :keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map)
"'" 'ielm
"c" '(:ignore t :which-key "compile")
"c" (cons "compile" (make-sparse-keymap))
"cc" 'emacs-lisp-byte-compile
"e" '(:ignore t :which-key "eval")
"e" (cons "eval" (make-sparse-keymap))
"eb" 'eval-buffer
"ee" 'eval-last-sexp
"er" 'eval-region
"ef" 'eval-defun
"t" '(:ignore t :which-key "tests")
"t" (cons "tests" (make-sparse-keymap))
"tb" 'ert-run-tests-buffer
"tq" 'ert))

Expand Down
20 changes: 10 additions & 10 deletions lisp/lang-latex.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,26 @@
"a" 'TeX-command-run-all ;; C-c C-a
"b" 'TeX-build
;; TeX-doc is a very slow function
"h" '(:ignore t :which-key "help")
"h" (cons "help" (make-sparse-keymap))
"hd" 'TeX-doc
"k" 'TeX-kill-job ;; C-c C-k
"l" 'TeX-recenter-output-buffer ;; C-c C-l
"m" 'TeX-insert-macro ;; C-c C-m
"n" 'TeX-next-error ;; C-c `
"N" 'TeX-previous-error ;; M-g p
"v" 'TeX-view ;; C-c C-v
"x" '(:ignore t :which-key "text/fonts")
"x" (cons "text/fonts" (make-sparse-keymap))
"xb" 'font-bold
"xc" 'font-code
"xe" 'font-emphasis
"xi" 'font-italic
"xr" 'font-clear
"xo" 'font-oblique
"xf" '(:ignore t :which-key "fonts")
"xf" (cons "fonts" (make-sparse-keymap))
"xfc" 'font-small-caps
"xff" 'font-sans-serif
"xfr" 'font-serif
"z" '(:ignore t :which-key "fold")
"z" (cons "fold" (make-sparse-keymap))
"z=" 'TeX-fold-math
"zb" 'TeX-fold-buffer
"zB" 'TeX-fold-clearout-buffer
Expand All @@ -106,14 +106,14 @@
"." 'LaTeX-mark-environment ;; C-c .
"c" 'LaTeX-close-environment ;; C-c ]
"e" 'LaTeX-environment ;; C-c C-e
"f" '(:ignore t :which-key "fill")
"f" (cons "fill" (make-sparse-keymap))
"fe" 'LaTeX-fill-environment ;; C-c C-q C-e
"fp" 'LaTeX-fill-paragraph ;; C-c C-q C-p
"fr" 'LaTeX-fill-region ;; C-c C-q C-r
"fs" 'LaTeX-fill-section ;; C-c C-q C-s
"i" '(:ignore t :which-key "insert")
"i" (cons "insert" (make-sparse-keymap))
"ii" 'LaTeX-insert-item ;; C-c C-j
"p" '(:ignore t :which-key "preview")
"p" (cons "preview" (make-sparse-keymap))
"pb" 'preview-buffer
"pc" 'preview-clearout
"pd" 'preview-document
Expand All @@ -123,9 +123,9 @@
"pr" 'preview-region
"ps" 'preview-section
"s" 'LaTeX-section ;; C-c C-s
"x" '(:ignore t :which-key "text/fonts")
"x" (cons "text/fonts" (make-sparse-keymap))
"xB" 'font-medium
"xf" '(:ignore t :which-key "fonts")
"xf" (cons "fonts" (make-sparse-keymap))
"xfa" 'font-calligraphic
"xfn" 'font-normal
"xfu" 'font-upright
Expand All @@ -142,7 +142,7 @@

(despot-def (TeX-mode-map LaTeX-mode-map)
:major-modes '(tex-mode latex-mode)
"r" '(:ignore t :which-key "reftex")
"r" (cons "reftex" (make-sparse-keymap))
"rc" 'reftex-citation
"rg" 'reftex-grep-document
"ri" 'reftex-index-selection-or-word
Expand Down
14 changes: 7 additions & 7 deletions lisp/lang-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
">" 'markdown-indent-region
"<" 'markdown-outdent-region
"-" 'markdown-insert-hr
"c" '(:ignore t :which-key "command")
"c" (cons "command" (make-sparse-keymap))
"c]" 'markdown-complete-buffer
"cc" 'markdown-check-refs
"ce" 'markdown-export
Expand All @@ -63,7 +63,7 @@
"cv" 'markdown-export-and-preview
"cw" 'markdown-kill-ring-save
"f" 'markdown-follow-thing-at-point
"h" '(:ignore t :which-key "header")
"h" (cons "header" (make-sparse-keymap))
"hi" 'markdown-insert-header-dwim
"hI" 'markdown-insert-header-setext-dwim
"h1" 'markdown-insert-header-atx-1
Expand All @@ -74,18 +74,18 @@
"h6" 'markdown-insert-header-atx-6
"h!" 'markdown-insert-header-setext-1
"h@" 'markdown-insert-header-setext-2
"i" '(:ignore t :which-key "insert")
"i" (cons "insert" (make-sparse-keymap))
"if" 'markdown-insert-footnote
"ii" 'markdown-insert-image
"il" 'markdown-insert-link
"iw" 'markdown-insert-wiki-link
"iu" 'markdown-insert-uri
"k" 'markdown-kill-thing-at-point
"N" 'markdown-next-link
"l" '(:ignore t :which-key "lists")
"l" (cons "lists" (make-sparse-keymap))
"li" 'markdown-insert-list-item
"P" 'markdown-previous-link
"t" '(:ignore t :which-key "table")
"t" (cons "table" (make-sparse-keymap))
"tp" 'markdown-table-move-row-up
"tn" 'markdown-table-move-row-down
"tf" 'markdown-table-move-column-right
Expand All @@ -97,13 +97,13 @@
"ts" 'markdown-table-sort-lines
"td" 'markdown-table-convert-region
"tt" 'markdown-table-transpose
"T" '(:ignore t :which-key "toggle")
"T" (cons "toggles" (make-sparse-keymap))
"Ti" 'markdown-toggle-inline-images
"Tl" 'markdown-toggle-url-hiding
"Tm" 'markdown-toggle-markup-hiding
"Tt" 'markdown-toggle-gfm-checkbox
"Tw" 'markdown-toggle-wiki-links
"x" '(:ignore t :which-key "text")
"x" (cons "text" (make-sparse-keymap))
"xb" 'markdown-insert-bold
"xB" 'markdown-insert-gfm-checkbox
"xc" 'markdown-insert-code
Expand Down
Loading

0 comments on commit 6f709a9

Please sign in to comment.