Config: streamline minimal terminal config

This commit is contained in:
User
2026-05-05 18:54:16 +08:00
parent d323b23bee
commit 8ecbd64595
8 changed files with 123 additions and 113 deletions

View File

@@ -16,32 +16,18 @@
(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)
"f r" 'recentf
"i" 'imenu)
;; global map
(general-def
@@ -52,6 +38,7 @@
"M-]" 'next-buffer
"C-x C-b" 'ibuffer-other-window
"C-x K" 'crux-kill-other-buffers
"C-x C-b" 'ibuffer-other-window
;; edit
"M-c" 'capitalize-dwim
@@ -62,9 +49,9 @@
"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-y" 'yank-from-kill-ring
"C-c DEL" 'hungry-delete-backward
"C-c C-DEL" 'hungry-delete-forward
"M-P" 'drag-stuff-up
"M-N" 'drag-stuff-down
@@ -75,27 +62,13 @@
;; 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")
"M-o" 'other-window)
;; save-some-buffer时diff更改
(add-to-list 'save-some-buffers-action-alist
@@ -103,47 +76,6 @@
(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)