diff options
Diffstat (limited to 'emacs/work_inits/14-movement.el')
| -rw-r--r-- | emacs/work_inits/14-movement.el | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/emacs/work_inits/14-movement.el b/emacs/work_inits/14-movement.el new file mode 100644 index 0000000..a411277 --- /dev/null +++ b/emacs/work_inits/14-movement.el @@ -0,0 +1,110 @@ +;; Time-stamp: <2021-09-27 08h47 EDT (hobbies)> + +;; ------------------------------------------------------------------- +;; Repeated key presses for region + +(use-package expand-region :ensure t + :bind (("M-r" . er/expand-region)) + :config + (setq expand-region-fast-keys-enabled t + expand-region-contract-fast-key "c" + expand-region-reset-fast-key "e" + expand-region-autocopy-register "i")) + +;; ------------------------------------------------------------------- +;; Window switching + +(use-package switch-window :ensure t + :bind (("C-x o" . switch-window) + ("C-x C-o" . other-frame) + ("C-c o" . switch-window) + ("C-c n" . switch-window-then-maximize) + :map switch-window-extra-map + ("u" . switch-window-mvborder-up) + ("e" . switch-window-mvborder-down) + ("n" . switch-window-mvborder-left) + ("o" . switch-window-mvborder-right) + ("i" . nil) + ("j" . nil) + ("k" . nil) + ("l" . nil)) + :config + (setq switch-window-input-style 'minibuffer + switch-window-shortcut-style 'qwerty + switch-window-multiple-frames nil + switch-window-qwerty-shortcuts + '("a" "r" "s" "t" "n" "e" "i" "o"))) + +;; ------------------------------------------------------------------- +;; Character jumping + +(use-package avy + :ensure t + :demand + :bind (("C-," . avy-goto-char-timer) + ("C-." . avy-goto-char-in-line) + ("M-g s" . avy-goto-word-or-subword-1) + ("M-g w" . avy-goto-word-1) + ("M-g a" . avy-goto-word-0) + ("M-g C-g" . avy-goto-line)) + :config + (setq avy-keys '(?a ?r ?s ?t ?g ?k ?n ?e ?i ?o ?q ?w ?f ?p) + avy-dispatch-alist '((?w . avy-action-kill-move) + (?W . avy-action-kill-stay) + (?j . avy-action-teleport) + (?m . avy-action-mark) + (?c . avy-action-copy) + (?y . avy-action-yank) + (?i . avy-action-ispell) + (?z . avy-action-zap-to-char)))) + +;; ------------------------------------------------------------------- +;; General stuff + +;; (global-set-key (kbd "C-b") 'recenter-top-bottom) +;; (global-set-key (kbd "M-b") 'downcase-word) +;; (global-set-key (kbd "C-l") 'backward-char) +;; (global-set-key (kbd "M-l") 'backward-word) + +(global-set-key (kbd "C-M-e") 'end-of-buffer) +(global-set-key (kbd "C-M-a") 'beginning-of-buffer) + +(global-set-key (kbd "M-h") 'backward-kill-word) + +(global-set-key (kbd "M-z") 'zap-up-to-char) + +;; Fast movement +(global-set-key (kbd "M-n") 'scroll-up-command) +(global-set-key (kbd "M-p") 'scroll-down-command) + +(global-set-key (kbd "C-S-n") + (lambda () (interactive) (ignore-errors (forward-line 5)))) + +(global-set-key (kbd "C-S-p") + (lambda () (interactive) (ignore-errors (forward-line -5)))) + +(global-set-key (kbd "C-S-f") + (lambda () (interactive) (ignore-errors (forward-char 5)))) + +(global-set-key (kbd "C-S-b") + (lambda () (interactive) (ignore-errors (backward-char 5)))) + +;; Hardcore mode +(defconst hardcore-nav-mode nil) +(when hardcore-nav-mode + (global-set-key (kbd "<XF86Back>") nil) + (global-set-key (kbd "<XF86Forward>") nil) + (global-set-key (kbd "<right>") nil) + (global-set-key (kbd "<left>") nil) + (global-set-key (kbd "<up>") nil) + (global-set-key (kbd "<down>") nil) + (global-set-key (kbd "S-<right>") nil) + (global-set-key (kbd "S-<left>") nil) + (global-set-key (kbd "S-<up>") nil) + (global-set-key (kbd "C-<down>") nil) + (global-set-key (kbd "C-<right>") nil) + (global-set-key (kbd "C-<left>") nil) + (global-set-key (kbd "C-<up>") nil) + (global-set-key (kbd "C-<down>") nil) + (global-set-key (kbd "<Home>") nil) + (global-set-key (kbd "<End>") nil)) |
