Config: Update docs in init-kbd.el

This commit is contained in:
trogloxene
2026-03-31 07:28:48 +08:00
parent 494873e7f9
commit 25a95c87b2
2 changed files with 39 additions and 30 deletions

View File

@@ -11,7 +11,7 @@
;; 使用F2打开init.el ;; 使用F2打开init.el
(defun open-init-file() (defun open-init-file()
"Open user's init.el file in ~/.emacs.d" "Open user's init.el file in ~/.emacs.d ."
(interactive) (interactive)
(find-file "~/.emacs.d/init.el")) (find-file "~/.emacs.d/init.el"))
@@ -86,6 +86,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; 快速复制当前行 ;; 快速复制当前行
(defun duplicate-and-move-to-next-line() (defun duplicate-and-move-to-next-line()
"Duplicate current line and move to next line."
(interactive) (interactive)
(progn (progn
(duplicate-line) (duplicate-line)
@@ -95,12 +96,12 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; 切换buffer ;; 切换buffer
(defun my-tab-line-buffers () (defun my-tab-line-buffers ()
"Get list of buffers shown in tab-line." "Get list of buffers shown in tab-line."
(mapcar (lambda (tab) (mapcar (lambda (tab)
(if (consp tab) (cdr tab) tab)) (if (consp tab) (cdr tab) tab))
(funcall tab-line-tabs-function))) (funcall tab-line-tabs-function)))
(defun previous-buffer-with-tab-line () (defun previous-buffer-with-tab-line ()
"Switch to previous buffer in tab-line order" "Switch to previous buffer in tab-line order."
(interactive) (interactive)
(let ((already-enabled global-tab-line-mode)) (let ((already-enabled global-tab-line-mode))
(unless already-enabled (unless already-enabled
@@ -109,13 +110,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(current (current-buffer)) (current (current-buffer))
(pos (cl-position current buffers))) (pos (cl-position current buffers)))
(when pos (when pos
(switch-to-buffer (switch-to-buffer
(nth (mod (1- pos) (length buffers)) buffers)))) (nth (mod (1- pos) (length buffers)) buffers))))
(unless already-enabled (unless already-enabled
(run-with-idle-timer 0.5 nil (lambda () (global-tab-line-mode -1)))))) (run-with-idle-timer 0.5 nil (lambda () (global-tab-line-mode -1))))))
(defun next-buffer-with-tab-line () (defun next-buffer-with-tab-line ()
"Switch to next buffer in tab-line order" "Switch to next buffer in tab-line order."
(interactive) (interactive)
(let ((already-enabled global-tab-line-mode)) (let ((already-enabled global-tab-line-mode))
(unless already-enabled (unless already-enabled
@@ -124,7 +125,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(current (current-buffer)) (current (current-buffer))
(pos (cl-position current buffers))) (pos (cl-position current buffers)))
(when pos (when pos
(switch-to-buffer (switch-to-buffer
(nth (mod (1+ pos) (length buffers)) buffers)))) (nth (mod (1+ pos) (length buffers)) buffers))))
(unless already-enabled (unless already-enabled
(run-with-idle-timer 0.5 nil (lambda () (global-tab-line-mode -1)))))) (run-with-idle-timer 0.5 nil (lambda () (global-tab-line-mode -1))))))
@@ -171,11 +172,12 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; popper ;; popper
(global-set-key (kbd "M-`") 'popper-toggle-latest) (global-set-key (kbd "M-`") 'popper-toggle-latest)
(defun popper-toggle-type-delte-other-window() (defun popper-toggle-type-delete-other-window()
"Toggle type of popper window and delete other window."
(interactive) (interactive)
(popper-toggle-type) (popper-toggle-type)
(delete-other-windows)) (delete-other-windows))
(global-set-key (kbd "C-M-=") 'popper-toggle-type-delte-other-window) (global-set-key (kbd "C-M-=") 'popper-toggle-type-delete-other-window)
;; crux相关 ;; crux相关
(global-set-key (kbd "C-<backspace>") 'crux-kill-line-backwards) ;; C-DEL kill line backwards (global-set-key (kbd "C-<backspace>") 'crux-kill-line-backwards) ;; C-DEL kill line backwards
@@ -243,11 +245,11 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(define-key vterm-mode-map (kbd "C-x C-x") 'vterm-send-C-x)) (define-key vterm-mode-map (kbd "C-x C-x") 'vterm-send-C-x))
;; ;; eshell ;; ;; eshell
(with-eval-after-load 'eshell ;; (with-eval-after-load 'eshell
(define-key eshell-mode-map (kbd "M-n") nil) ;; (define-key eshell-mode-map (kbd "M-n") nil)
(define-key eshell-mode-map (kbd "M-p") nil) ;; (define-key eshell-mode-map (kbd "M-p") nil)
(define-key eshell-mode-map (kbd "M-{") 'eshell-previous-matching-input-from-input) ;; (define-key eshell-mode-map (kbd "M-{") 'eshell-previous-matching-input-from-input)
(define-key eshell-mode-map (kbd "M-}") 'eshell-next-matching-input-from-input)) ;; (define-key eshell-mode-map (kbd "M-}") 'eshell-next-matching-input-from-input))
;; 打开目录 ;; 打开目录
(defun consult-directory-externally (file) (defun consult-directory-externally (file)
@@ -270,6 +272,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;;打开当前文件的目录 ;;打开当前文件的目录
(defun my-open-current-directory () (defun my-open-current-directory ()
"Open current directory in default file explorer."
(interactive) (interactive)
(consult-directory-externally default-directory)) (consult-directory-externally default-directory))
@@ -278,7 +281,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; org-mode相关 ;; org-mode相关
;; cycle当前subtree ;; cycle当前subtree
(defun org-cycle-current-subtree() (defun org-cycle-current-subtree()
"Cycle current org-mode subtree." "Cycle current subtree."
(interactive) (interactive)
(org-back-to-heading) (org-back-to-heading)
(org-cycle)) (org-cycle))
@@ -302,11 +305,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; 日记 ;; 日记
(defun org-journal-open-current-journal-file-delete-other-window() (defun org-journal-open-current-journal-file-delete-other-window()
"Call org-journal-open-current-journal-file and delete other window."
(interactive) (interactive)
(org-journal-open-current-journal-file) (org-journal-open-current-journal-file)
(delete-other-windows)) (delete-other-windows))
(defun org-journal-new-entry-delete-other-window() (defun org-journal-new-entry-delete-other-window()
"Call org-journal-new-entry and delete other window."
(interactive) (interactive)
(org-journal-new-entry nil) (org-journal-new-entry nil)
(delete-other-windows)) (delete-other-windows))
@@ -339,10 +344,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(defun switch-to-emms-playlist() (defun switch-to-emms-playlist()
"Switch to emms playlist."
(interactive) (interactive)
(switch-to-buffer "*EMMS Playlist*")) (switch-to-buffer "*EMMS Playlist*"))
(global-set-key (kbd "C-c m l") 'switch-to-emms-playlist) (global-set-key (kbd "C-c m l") 'switch-to-emms-playlist)
(global-set-key (kbd "C-c m d") 'my-emms-play-directory)
(provide 'init-kbd) (provide 'init-kbd)

View File

@@ -127,22 +127,23 @@
:init (ace-pinyin-global-mode +1)) :init (ace-pinyin-global-mode +1))
;; jinx拼写检查 ;; jinx拼写检查
(use-package jinx (unless *is-windows*
:hook (org-mode-hook . jinx-mode) (use-package jinx
:bind ([remap ispell-word] . jinx-correct) :hook (org-mode-hook . jinx-mode)
:config (setq jinx-languages "en_US") :bind ([remap ispell-word] . jinx-correct)
(add-to-list 'jinx-exclude-regexps '(t "\\cc")) :config (setq jinx-languages "en_US")
(with-eval-after-load 'jinx (add-to-list 'jinx-exclude-regexps '(t "\\cc"))
(dolist (range '((#x4E00 . #x9FFF) (with-eval-after-load 'jinx
(#x3400 . #x4DBF) (dolist (range '((#x4E00 . #x9FFF)
(#x3000 . #x303F) (#x3400 . #x4DBF)
(#xFF00 . #xFFEF) (#x3000 . #x303F)
(#x20000 . #x2A6DF))) (#xFF00 . #xFFEF)
(let ((start (car range)) (#x20000 . #x2A6DF)))
(end (cdr range))) (let ((start (car range))
(dotimes (i (- end start)) (end (cdr range)))
(modify-syntax-entry (+ start i) "_" jinx--syntax-table))))) (dotimes (i (- end start))
(require 'init-jinx)) (modify-syntax-entry (+ start i) "_" jinx--syntax-table)))))
(require 'init-jinx)))
;; flycheck ;; flycheck
(use-package flycheck (use-package flycheck