- Remove consult-dir, nerd-icons-completion, org-contrib and some other unused package - Delete init-org-refile.el and related keybindings - Prune EMMS config - Remove EXWM flatpak launcher helpers (vscodium, localsend, steam) - Extract Windows dirvish video preview fix to standalone module - Drop built-in settings moved elsewhere (startup defaults, whitespace, etc.) - Clean up trailing whitespace / process list prettify configs
151 lines
4.1 KiB
EmacsLisp
151 lines
4.1 KiB
EmacsLisp
;;; init-terminal-kbd.el --- keybindings -*- lexical-binding: t -*-
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(defun open-init-file()
|
|
"Open user's init.el file in ~/.emacs.d ."
|
|
(interactive)
|
|
(find-file "~/.emacs.d/init.el"))
|
|
|
|
(defun duplicate-and-move-to-next-line()
|
|
"Duplicate current line and move to next line."
|
|
(interactive)
|
|
(progn
|
|
(duplicate-line)
|
|
(next-line)))
|
|
|
|
(defun popper-toggle-type-delete-other-window()
|
|
"Toggle type of popper window and delete other window."
|
|
(interactive)
|
|
(popper-toggle-type)
|
|
(delete-other-windows))
|
|
|
|
;; scratch buffer
|
|
(if *is-mac*
|
|
(general-def "C-c <f12>" 'scratch-buffer)
|
|
(general-def "C-c <delete>" 'scratch-buffer))
|
|
|
|
;; org-mode
|
|
(general-def org-mode-map
|
|
"C-<tab>" 'org-cycle-parent-subtree
|
|
"C-c o l" 'org-toggle-link-display
|
|
"C-c C-k" 'kmacro-call-macro
|
|
"M-{" 'org-previous-visible-heading
|
|
"M-}" 'org-next-visible-heading)
|
|
|
|
;; global map with C-c prefix
|
|
(general-def
|
|
:prefix "C-c"
|
|
"c" 'hydra-multiple-cursors/body
|
|
"e" 'er/expand-region
|
|
"k" 'comment-line
|
|
"v" 'vterm)
|
|
|
|
;; global map
|
|
(general-def
|
|
|
|
;; buffer, file, and window
|
|
"<f2>" 'open-init-file
|
|
"M-[" 'previous-buffer
|
|
"M-]" 'next-buffer
|
|
"C-x C-b" 'ibuffer-other-window
|
|
"C-x K" 'crux-kill-other-buffers
|
|
|
|
;; edit
|
|
"M-c" 'capitalize-dwim
|
|
"M-u" 'upcase-dwim
|
|
"M-l" 'downcase-dwim
|
|
"C-," 'duplicate-and-move-to-next-line
|
|
"C-k" 'crux-smart-kill-line
|
|
"C-<backspace>" 'crux-kill-line-backwards
|
|
"C-o" 'open-line
|
|
"C-a" 'crux-move-beginning-of-line
|
|
"M-y" 'consult-yank-from-kill-ring
|
|
"C-c <backspace>" 'hungry-delete-backward
|
|
"C-c C-<backspace>" 'hungry-delete-forward
|
|
"M-P" 'drag-stuff-up
|
|
"M-N" 'drag-stuff-down
|
|
|
|
;; undo
|
|
"C-/" 'undo-fu-only-undo
|
|
"C-?" 'undo-fu-only-redo
|
|
|
|
;; navigate
|
|
"M-p" 'backward-paragraph
|
|
"M-n" 'forward-paragraph
|
|
"<mouse-2>" 'xref-find-definitions-at-mouse
|
|
"C-M-;" 'avy-goto-char
|
|
"C-M-'" 'avy-goto-word-1
|
|
"M-g g" 'avy-goto-line
|
|
|
|
;; window
|
|
"M-<left>" 'shrink-window-horizontally
|
|
"M-<right>" 'enlarge-window-horizontally
|
|
"M-<down>" 'shrink-window
|
|
"M-<up>" 'enlarge-window
|
|
"M-`" 'popper-toggle
|
|
"C-M-=" 'popper-toggle-type-delete-other-window
|
|
"M-o" 'other-window
|
|
"<f10>" 'esw/swap-two-windows
|
|
|
|
;; other
|
|
"<mouse-3>" 'global-tab-line-mode)
|
|
|
|
;; expand region
|
|
(setq expand-region-reset-fast-key "r")
|
|
(setq expand-region-contract-fast-key "c")
|
|
|
|
;; save-some-buffer时diff更改
|
|
(add-to-list 'save-some-buffers-action-alist
|
|
(list "d"
|
|
(lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
|
|
"show diff between the buffer and its file"))
|
|
|
|
;; hydra
|
|
(use-package hydra
|
|
:defines (consult-imenu-config)
|
|
:init
|
|
(with-eval-after-load 'consult-imenu
|
|
(setq consult-imenu-config
|
|
'((emacs-lisp-mode :toplevel "Functions"
|
|
:types ((?f "Functions" font-lock-function-name-face)
|
|
(?h "Hydras" font-lock-constant-face)
|
|
(?m "Macros" font-lock-function-name-face)
|
|
(?p "Packages" font-lock-constant-face)
|
|
(?t "Types" font-lock-type-face)
|
|
(?v "Variables" font-lock-variable-name-face)))))))
|
|
|
|
;; multiple-cursors
|
|
(defhydra hydra-multiple-cursors ()
|
|
"
|
|
^Mark^ ^Unmark^ ^Other^
|
|
------------------------------------------------------------------
|
|
_p_ : prev line _P_ : previous _c_ : edit lines
|
|
_n_ : next line _N_ : next _._ : pop
|
|
_b_ : prev word _q_ : quit
|
|
_f_ : next word
|
|
_B_ : prev symbol
|
|
_F_ : next symbol
|
|
_s_ : in region
|
|
_a_ : all dwim
|
|
"
|
|
("p" mc/mark-previous-like-this)
|
|
("n" mc/mark-next-like-this)
|
|
("b" mc/mark-previous-like-this-word)
|
|
("f" mc/mark-next-like-this-word)
|
|
("B" mc/mark-previous-like-this-symbol)
|
|
("F" mc/mark-next-like-this-symbol)
|
|
("P" mc/unmark-previous-like-this)
|
|
("N" mc/unmark-next-like-this)
|
|
("a" mc/mark-all-dwim)
|
|
("s" mc/mark-all-in-region)
|
|
("c" mc/edit-lines)
|
|
("." mc/mark-pop)
|
|
("q" nil))
|
|
|
|
(provide 'init-terminal-kbd)
|
|
|
|
;;; init-terminal-kbd.el ends here
|