Skip to content

Commit

Permalink
more ergo movements (other key always at other side of Ctrl/Hyper)
Browse files Browse the repository at this point in the history
  • Loading branch information
JJPandari committed Apr 23, 2023
1 parent 2ad48df commit 778ed4f
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 75 deletions.
3 changes: 2 additions & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
(add-hook 'emacs-startup-hook
(lambda () (setq gc-cons-threshold normal-gc-cons-threshold)
(run-with-idle-timer 30 t 'garbage-collect)
(add-hook 'focus-out-hook 'garbage-collect))))
;; (add-hook 'focus-out-hook 'garbage-collect)
)))

;;----------------------------------------------------------------------------
;; Bootstrap config
Expand Down
6 changes: 3 additions & 3 deletions modes/init-editing-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
:commands er/expand-region
:init
(general-define-key
"<C-backspace>" 'er/expand-region))
"C-l" 'er/expand-region))


(use-package page-break-lines
Expand Down Expand Up @@ -203,8 +203,8 @@
(insert-or-remove-trailing-char ?,))

(general-define-key
"C-;" 'insert-or-remove-trailing-semi
"C-," 'insert-or-remove-trailing-comma)
"H-;" 'insert-or-remove-trailing-semi
"H-," 'insert-or-remove-trailing-comma)

;;----------------------------------------------------------------------------
;; Move lines up and down.
Expand Down
76 changes: 41 additions & 35 deletions modes/init-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -586,48 +586,52 @@

(general-define-key
:states '(normal visual motion operator)
"C-a" 'evil-first-non-blank
"C-e" 'evil-end-of-line)
"C-," 'evil-first-non-blank
"C-." 'evil-end-of-line)

(general-define-key
:states '(insert)
"M-v" 'evil-scroll-down
"M-c" 'evil-scroll-up
"C-b" 'delete-forward-char
"C-d" 'backward-char
"S-<backspace>" 'delete-forward-char
"C-," 'backward-char
"C-." 'forward-char
"C-n" 'next-line
"C-p" 'previous-line
"C-a" 'beginning-of-line-text
"C-e" 'move-end-of-line
"<C-i>" 'beginning-of-line-text
"C-o" 'move-end-of-line
"C-k" 'kill-line
"C-w" 'evil-delete-backward-word
"C-x" 'kill-region
"C-v" 'yank
;; leave C-r for commands similar to backward-search
"H-w" 'evil-delete-backward-word
"H-x" 'kill-region
"H-c" 'kill-ring-save
"H-v" 'yank
;; reserve C-r for commands similar to backward-search
"C-y" 'evil-paste-from-register
"M-d" 'backward-word
"M-b" 'kill-word
"H-x" ctl-x-map)
"M-." 'forward-word
"M-," 'backward-word
"M-<backspace>" 'kill-word)

(general-define-key
:states '(emacs)
"M-v" 'evil-scroll-down
"M-c" 'evil-scroll-up
"C-b" 'delete-forward-char
"C-d" 'backward-char
"S-<backspace>" 'delete-forward-char
"C-," 'backward-char
"C-." 'forward-char
"C-n" 'next-line
"C-p" 'previous-line
"C-a" 'beginning-of-line-text
"C-e" 'move-end-of-line
"<C-i>" 'beginning-of-line-text
"C-o" 'move-end-of-line
"C-k" 'kill-line
"C-w" 'backward-kill-word
"C-x" 'kill-region
"C-v" 'yank
;; leave C-r for commands similar to backward-search
"H-w" 'backward-kill-word
"H-x" 'kill-region
"H-c" 'kill-ring-save
"H-v" 'yank
;; reserve C-r for commands similar to backward-search
;; "C-y" 'evil-paste-from-register
"M-d" 'backward-word
"M-b" 'kill-word
"H-x" ctl-x-map
"M-." 'forward-word
"M-," 'backward-word
"M-<backspace>" 'kill-word
"<escape>" 'evil-exit-emacs-state)

;;----------------------------------------------------------------------------
Expand All @@ -641,21 +645,23 @@
;; copy insert state bindings here, so keys do the same when evil disabled
"M-v" 'evil-scroll-down
"M-c" 'evil-scroll-up
"C-b" 'delete-forward-char
"C-d" 'backward-char
"S-<backspace>" 'delete-forward-char
"C-," 'backward-char
"C-." 'forward-char
"C-n" 'next-line
"C-p" 'previous-line
"C-a" 'beginning-of-line-text
"C-e" 'move-end-of-line
"<C-i>" 'beginning-of-line-text
"C-o" 'move-end-of-line
"C-k" 'kill-line
"C-w" 'backward-kill-word
"C-x" 'kill-region
"C-v" 'yank
;; leave C-r for commands similar to backward-search
"H-w" 'backward-kill-word
"H-x" 'kill-region
"H-c" 'kill-ring-save
"H-v" 'yank
;; reserve C-r for commands similar to backward-search
;; "C-y" 'evil-paste-from-register
"M-d" 'backward-word
"M-b" 'kill-word
"H-x" ctl-x-map
"M-." 'forward-word
"M-," 'backward-word
"M-<backspace>" 'kill-word
"<escape>" 'keyboard-quit)

;;----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions modes/init-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

(use-package all-the-icons
:demand t)
;; (use-package nerd-icons
;; :demand t)

;;----------------------------------------------------------------------------
;; highlight region with symbol-overlay
Expand Down
2 changes: 1 addition & 1 deletion modes/init-help.el
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"U" 'Info-up
"H" 'Info-prev
"L" 'Info-next
"C-r" 'Info-history
"H-r" 'Info-history
"f" 'link-hint-open-link
"<return>" 'Info-follow-nearest-node
"g g" 'evil-goto-first-line)
Expand Down
22 changes: 14 additions & 8 deletions modes/init-ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"g r" 'ivy-occur-revert-buffer
"<return>" 'ivy-occur-press-and-switch
"f" 'ivy-occur-press)
(evil-set-initial-state 'ivy-occur-mode 'motion)
(defun jester/ivy-copy-current-line ()
"Copy current line in ivy."
(interactive)
Expand All @@ -38,9 +39,9 @@
"s B" (lambda! (swiper-all (jester/region-or-symbol))))

(general-define-key
"C-s" 'swiper
"C-S-s" (lambda! (swiper (jester/region-or-symbol)))
"H-s" 'swiper-isearch)
"H-s" 'swiper
"H-S-s" (lambda! (swiper (jester/region-or-symbol)))
"C-s" 'swiper-isearch)

(defun jester/maybe-run-ivy-hydra ()
"Run `hydra-ivy/body' if there is any content in minibuffer."
Expand Down Expand Up @@ -126,14 +127,19 @@ If swiper started with any input, enable ivy-hydra automatically. (so I can h/j/
"M-d" #'backward-word
"M-b" #'kill-word
"C-w" #'backward-kill-word
"C-d" #'backward-char
"C-b" #'delete-char
"C-v" 'yank
"C-S-k" 'jester/kill-back-to-indentation
"C-," #'backward-char
"C-." #'forward-char
"<C-i>" 'beginning-of-line-text
"C-o" 'move-end-of-line
"S-<backspace>" 'delete-forward-char
"H-w" 'evil-delete-backward-word
"H-x" 'kill-region
"H-c" 'jester/ivy-copy-current-line
"H-v" 'yank
"C-S-k" 'jester/kill-back-to-indentation
"H-r" 'ivy-reverse-i-search
"<escape>" #'keyboard-escape-quit
"C-g" #'keyboard-escape-quit
"M-w" 'jester/ivy-copy-current-line
"<C-return>" 'ivy-call)

(general-define-key
Expand Down
8 changes: 4 additions & 4 deletions modes/init-javascript.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
((t (:inherit web-mode-html-tag-face)))))
:mode "\\.jsx\\'"
:config
(evil-define-key 'insert rjsx-mode-map (kbd "C-b") #'rjsx-delete-creates-full-tag)
(evil-define-key 'insert rjsx-mode-map (kbd "S-<backspace>") #'rjsx-delete-creates-full-tag)
(modify-syntax-entry ?_ "w" rjsx-mode-syntax-table))


Expand All @@ -113,9 +113,9 @@

(use-package eacl
:init
(general-define-key
"H-," 'eacl-complete-line
"H-." 'eacl-complete-multiline)
;; (general-define-key
;; "H-," 'eacl-complete-line
;; "H-." 'eacl-complete-multiline)
:commands (eacl-complete-line eacl-complete-multiline))


Expand Down
4 changes: 2 additions & 2 deletions modes/init-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
(general-define-key
:states '(emacs insert)
:keymaps jester-lispy-maps
"C-;" 'jester/insert-lisp-comment-start)
"H-;" 'jester/insert-lisp-comment-start)


(push (expand-file-name "elispfl" jester-submodules-dir) load-path)
Expand Down Expand Up @@ -213,7 +213,7 @@
(general-define-key
:states '(emacs insert normal visual)
:keymaps jester-lispy-maps
"H-w" 'lispyville-wrap-round)
"H-a" 'lispyville-wrap-round)
;; ugly fix
(general-define-key
:states '(emacs insert normal visual)
Expand Down
4 changes: 2 additions & 2 deletions modes/init-minibuffer.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"C-w" #'backward-kill-word
"C-f" #'forward-char
"C-d" #'backward-char
"C-b" #'delete-char
"S-<backspace>" #'delete-char
"C-v" #'yank
"C-y" #'evil-paste-from-register
"C-S-k" 'jester/kill-back-to-indentation
"C-r" 'counsel-minibuffer-history
"H-r" 'counsel-minibuffer-history
"H-x" 'kill-region
"<escape>" 'keyboard-escape-quit)

Expand Down
8 changes: 4 additions & 4 deletions modes/init-paredit.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
;; "\"" 'awesome-pair-double-quote
"SPC" 'awesome-pair-space
;; "<backspace>" 'awesome-pair-backward-delete
;; "C-b" 'awesome-pair-forward-delete
;; "S-<backspace>" 'awesome-pair-forward-delete
)
(general-define-key
:states '(emacs insert normal visual)
"H-w" (lambda! (awesome-pair-wrap-round-pair)))
"H-a" (lambda! (awesome-pair-wrap-round-pair)))

;; TODO append \n to make it evil style
(defun jester/semantic-kill-maybe-whole-line ()
Expand All @@ -42,9 +42,9 @@
(general-define-key
:states '(normal)
"d" (general-key-dispatch 'evil-delete
"L" 'jester/semantic-kill-maybe-whole-line)
"l" 'jester/semantic-kill-maybe-whole-line)
"c" (general-key-dispatch 'evil-change
"L" (lambda! (awesome-pair-kill) (evil-insert-state))))
"l" (lambda! (awesome-pair-kill) (evil-insert-state))))
;; binding to normal state implicitly binds to visual state, gotta fix it.
(general-define-key
:states '(visual)
Expand Down
25 changes: 18 additions & 7 deletions modes/init-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
:states '(insert emacs)
:keymaps 'comint-mode-map
"C-d" 'backward-char
"C-b" 'comint-delchar-or-maybe-eof
"C-r" 'comint-history-isearch-backward
"S-<backspace>" 'comint-delchar-or-maybe-eof
"H-r" 'comint-history-isearch-backward
"C-l" 'comint-clear-buffer)

(general-define-key
:states '(insert emacs)
:keymaps 'shell-mode-map
"C-r" 'counsel-shell-history)
"H-r" 'counsel-shell-history)

(defface jester-shell-face '((t :family "JetBrains Mono" :height 140))
"Face for shell buffers. Use a different font and smaller font size.")
Expand Down Expand Up @@ -42,10 +42,10 @@
:hook (vterm-mode . evil-insert-state)
:config
;; vterm-mode-map won't work because evil-insert-state-map takes precedence
;; copy them to insert-state|vterm-mode map
;; copy them to insert-state>vterm-mode map
(dolist (key '("<tab>"
"C-f" "C-d" "C-a" "C-e" "C-n" "C-p"
"C-b" "C-w" "C-k"
"S-<backspace>" "C-w" "C-k"
"C-r" "C-t" "C-/"
"M-c" "M-f" "M-d" "M-b"))
(general-define-key
Expand All @@ -62,8 +62,19 @@
:keymaps 'vterm-mode-map
"C-h" nil
"C-c" 'vterm--self-insert
"C-v" 'vterm-yank
"C-s" 'swiper)
"C-," (lambda! (vterm--backward-char))
"C-." (lambda! (vterm--forward-char))
"<C-i>" 'vterm-beginning-of-line
"C-o" 'vterm-end-of-line
"S-<backspace>" 'vterm-send-delete
"H-w" (lambda! (vterm-send "C-w"))
"H-v" 'vterm-yank
"H-s" 'swiper
"H-r" (lambda! (vterm-send "C-r"))
"<escape>" 'evil-motion-state
"M-." (lambda! (vterm-send "M-f"))
"M-," (lambda! (vterm-send "M-d"))
"M-<backspace>" (lambda! (vterm-send "M-b")))

(general-define-key
:states '(normal motion)
Expand Down
2 changes: 1 addition & 1 deletion modes/init-web.el
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
(general-define-key
:states '(insert emacs)
:keymaps '(web-mode-map js2-mode-map typescript-mode-map css-mode-map sass-mode-map)
"C-l" 'emmet-expand-line))
"H-e" 'emmet-expand-line))

;;----------------------------------------------------------------------------
;; evil text object for html attribute
Expand Down
12 changes: 7 additions & 5 deletions modes/init-windows.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(setq golden-ratio-auto-scale t))

(jester/with-leader
"w h" 'split-window-below
"w j" 'split-window-below
"w l" 'split-window-right
"w k" 'delete-window
"w H" 'evil-window-move-far-left
Expand Down Expand Up @@ -59,10 +59,11 @@


(use-package ace-window
:commands ace-swap-window
:commands (ace-window ace-swap-window)
:init
(jester/with-leader
"w M" 'ace-swap-window))
"w w" 'ace-window
"w s" 'ace-swap-window))


(use-package shackle
Expand Down Expand Up @@ -175,9 +176,10 @@ bound to KEY in the leader sub-keymap."
"Wrapper for `recenter', taking whatever arguments and ignore them."
(recenter))
(dolist (command '(xref-pop-marker-stack
evil-goto-mark evil-goto-last-change evil-goto-last-change-reverse
;; evil-goto-mark ; advicing this would recenter when paste, bad
evil-goto-last-change evil-goto-last-change-reverse
evil-search-next evil-search-previous
evilmi-jump-items
;; evilmi-jump-items
symbol-overlay-jump-next symbol-overlay-jump-prev
flycheck-next-error flycheck-previous-error
magit-diff-visit-file))
Expand Down
2 changes: 1 addition & 1 deletion modes/init-yas.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"<return>" #'yas-next-field
"C-g" 'jester/abort-company-or-yas
"C-d" nil
"C-b" 'yas-skip-and-clear-or-delete-char)
"S-<backspace>" 'yas-skip-and-clear-or-delete-char)

(jester/with-leader
"s v" 'yas-visit-snippet-file
Expand Down
Loading

0 comments on commit 778ed4f

Please sign in to comment.