Config: optimize consult config, change some keybindings and function

This commit is contained in:
User
2026-05-01 20:44:11 +08:00
parent 7e8a801be2
commit 89e7d2954b
6 changed files with 47 additions and 28 deletions

View File

@@ -71,11 +71,15 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(interactive) (interactive)
(consult-directory-externally default-directory)) (consult-directory-externally default-directory))
(defun org-cycle-current-subtree() (defun org-cycle-parent-subtree()
"Cycle current subtree." "Cycle parent org subtree."
(interactive) (interactive)
(org-back-to-heading) (if (org-at-heading-p)
(org-cycle)) (progn
(org-up-heading 1)
(org-cycle))
(org-back-to-heading)
(org-cycle)))
(defun consult-org-ripgrep () (defun consult-org-ripgrep ()
"Search in org files use consult-ripgrep." "Search in org files use consult-ripgrep."

View File

@@ -42,7 +42,8 @@
"l" 'consult-locate "l" 'consult-locate
"m" 'consult-fd-global "m" 'consult-fd-global
"d" 'my-open-current-directory "d" 'my-open-current-directory
"j" 'consult-jinx) "j" 'consult-jinx
"k" 'consult-kmacro)
;; t for modes toggle ;; t for modes toggle
(general-def (general-def
@@ -140,10 +141,11 @@
;; org-mode ;; org-mode
(general-def org-mode-map (general-def org-mode-map
"C-<tab>" 'org-cycle-current-subtree "C-<tab>" 'org-cycle-parent-subtree
"C-c i" 'consult-org-heading "C-c i" 'consult-outline
"C-c o w" 'my-org-refile-to-new-file "C-c o w" 'my-org-refile-to-new-file
"C-c o l" 'org-toggle-link-display) "C-c o l" 'org-toggle-link-display
"C-c C-k" 'kmacro-call-macro)
;; emms ;; emms
(general-def emms-playlist-mode-map (general-def emms-playlist-mode-map
@@ -165,10 +167,12 @@
"e" 'er/expand-region "e" 'er/expand-region
"s" 'consult-focus-lines "s" 'consult-focus-lines
"i" 'consult-imenu "i" 'consult-imenu
"C-i" 'consult-outline
"a" 'org-agenda "a" 'org-agenda
"l" 'org-store-link "l" 'org-store-link
"k" 'comment-line "k" 'comment-line
"v" 'vterm) "v" 'vterm
"C-k" 'kmacro-call-macro)
;; global map ;; global map
(general-def (general-def
@@ -264,7 +268,7 @@
_p_ : prev line _P_ : previous _c_ : edit lines _p_ : prev line _P_ : previous _c_ : edit lines
_n_ : next line _N_ : next _._ : pop _n_ : next line _N_ : next _._ : pop
_b_ : prev word _q_ : quit _b_ : prev word _q_ : quit
_f_ : next word _f_ : next word _i_ : insert numbers
_B_ : prev symbol _B_ : prev symbol
_F_ : next symbol _F_ : next symbol
_s_ : in region _s_ : in region
@@ -281,6 +285,7 @@ _a_ : all dwim
("a" mc/mark-all-dwim) ("a" mc/mark-all-dwim)
("s" mc/mark-all-in-region) ("s" mc/mark-all-in-region)
("c" mc/edit-lines) ("c" mc/edit-lines)
("i" mc/insert-numbers)
("." mc/mark-pop) ("." mc/mark-pop)
("q" nil)) ("q" nil))

View File

@@ -58,7 +58,8 @@
(use-package restart-emacs) (use-package restart-emacs)
;; 安装multiple-cursors ;; 安装multiple-cursors
(use-package multiple-cursors) (use-package multiple-cursors
:config (setq mc/insert-numbers-default 1))
;; 安装crux增强快捷键快捷键配置在init-kbd.el中 ;; 安装crux增强快捷键快捷键配置在init-kbd.el中
(use-package crux) (use-package crux)
@@ -106,18 +107,22 @@
(add-to-list 'process-coding-system-alist '("es" gbk . gbk))) (add-to-list 'process-coding-system-alist '("es" gbk . gbk)))
(when *is-mac* (when *is-mac*
(setopt consult-locate-args "mdfind -name"))) (setopt consult-locate-args "mdfind -name"))
(delete 'consult-source-recent-file consult-buffer-sources))
(use-package consult-dir (use-package consult-dir
:bind (("C-x C-d" . consult-dir) :bind (("C-x C-d" . consult-dir)
:map minibuffer-local-completion-map :map minibuffer-local-completion-map
("C-x C-d" . consult-dir) ("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file))) ("C-x C-j" . consult-dir-jump-file))
:config
(delete 'consult-dir--source-recentf consult-dir-sources))
(use-package consult-notes (use-package consult-notes
:config :config
(setq consult-notes-file-dir-sources '(("org notes" ?n "~/org/my-org-note/") (setq consult-notes-file-dir-sources '(("Org Notes" ?n "~/org/my-org-note/")
("org journal" ?j "~/org/my-org-daily/" :hidden t)))) ("Org Journal" ?j "~/org/my-org-daily/" :hidden t))))
;; embark ;; embark
(use-package embark (use-package embark

View File

@@ -33,15 +33,17 @@
;; 设置字典目录 ;; 设置字典目录
(setq cns-dict-directory "~/emacs-stuff/emacs-chinese-word-segmentation/cppjieba/dict/"))) (setq cns-dict-directory "~/emacs-stuff/emacs-chinese-word-segmentation/cppjieba/dict/")))
;; 其他配置 ;; 其他配置
(setq cns-recent-segmentation-limit 40) (setq cns-recent-segmentation-limit 40)
(require 'cns nil t) (require 'cns nil t)
;; 自动启动 ;; 自动启动
(when (featurep 'cns) (when (featurep 'cns)
(add-hook 'find-file-hook 'global-cns-mode)) (add-hook 'find-file-hook 'global-cns-mode))
;; 取消C-<backspace>绑定 ;; 取消C-<backspace>绑定
(with-eval-after-load 'cns (with-eval-after-load 'cns
(define-key cns-mode-map (kbd "C-<backspace>") nil)) (define-key cns-mode-map (kbd "C-<backspace>") nil))
;; vterm下关闭cns-mode
(add-hook 'vterm-mode-hook (lambda () (setq-local global-cns-mode nil cns-mode nil)))
(provide 'init-segmentation) (provide 'init-segmentation)

View File

@@ -42,12 +42,18 @@
"C-<tab>" 'org-cycle-current-subtree "C-<tab>" 'org-cycle-current-subtree
"C-c o l" 'org-toggle-link-display) "C-c o l" 'org-toggle-link-display)
;; vterm
(general-def vterm-mode-map
"M-]" nil
"C-q" 'vterm-send-next-key)
;; global map with C-c prefix ;; global map with C-c prefix
(general-def (general-def
:prefix "C-c" :prefix "C-c"
"c" 'hydra-multiple-cursors/body "c" 'hydra-multiple-cursors/body
"e" 'er/expand-region "e" 'er/expand-region
"k" 'comment-line) "k" 'comment-line
"v" 'vterm)
;; global map ;; global map
(general-def (general-def

View File

@@ -16,9 +16,6 @@
(set-language-environment "UTF-8") (set-language-environment "UTF-8")
(prefer-coding-system 'utf-8))) (prefer-coding-system 'utf-8)))
;; 高亮当前行
(global-hl-line-mode t)
;; 显示文件大小 ;; 显示文件大小
(size-indication-mode t) (size-indication-mode t)