Config: add jinx spell check, org-download, and keybinding updates

This commit is contained in:
User
2026-03-30 11:59:47 +08:00
parent e7a0e1b382
commit 8e0d0a7551
4 changed files with 127 additions and 32 deletions

View File

@@ -8,8 +8,7 @@
;; 使用F2打开init.el
(defun open-init-file()
"Open user's init.el file in ~/.emacs.d
这是一段文档"
"Open user's init.el file in ~/.emacs.d"
(interactive)
(find-file "~/.emacs.d/init.el"))
@@ -54,27 +53,30 @@
(global-set-key (kbd "M-l") 'downcase-dwim)
;; jinx相关
(with-eval-after-load 'jinx
(defun my/jinx-smart-toggle ()
"Toggle jinx-mode smartly.
(defun my/jinx-smart-toggle ()
"Toggle jinx-mode smartly.
Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise toggle global-jinx-mode."
(interactive)
(let ((local-on (bound-and-true-p jinx-mode))
(global-on (bound-and-true-p global-jinx-mode)))
(cond
((and local-on (not global-on))
(message "disable jinx-mode in current buffer")
(jinx-mode -1))
(t
(if global-on
(progn
(message "disable global-jinx-mode")
(global-jinx-mode -1))
(interactive)
(unless (featurep 'jinx)
(require 'jinx))
(let ((local-on (bound-and-true-p jinx-mode))
(global-on (bound-and-true-p global-jinx-mode)))
(cond
((and local-on (not global-on))
(message "disable jinx-mode in current buffer")
(jinx-mode -1))
(t
(if global-on
(progn
(message "enable global-jinx-mode")
(global-jinx-mode 1))))))))
(message "disable global-jinx-mode")
(global-jinx-mode -1))
(progn
(message "enable global-jinx-mode")
(global-jinx-mode 1)))))))
(global-set-key (kbd "C-c j j") 'my/jinx-smart-toggle)
(with-eval-after-load 'init-jinx
(global-set-key (kbd "C-c f j") 'consult-jinx))
;; pair编辑
(global-set-key (kbd "C-c p d") 'delete-pair)
@@ -146,7 +148,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
;; 中键使用embark打开定义
(global-set-key (kbd "<mouse-2>") 'xref-find-definitions)
;; 使用快速切换到scrath buffer
;; 使用快速切换到scratch buffer
(if *is-mac*
(global-set-key (kbd "C-C <f12>") 'scratch-buffer)
(global-set-key (kbd "C-c <delete>") 'scratch-buffer))
@@ -194,6 +196,7 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(global-set-key (kbd "C-c y") 'consult-yank-from-kill-ring) ;; 从kill ring中粘贴
(global-set-key (kbd "C-x r b") 'consult-bookmark) ;; 书签菜单embark中有更多操作
(define-key minibuffer-local-map (kbd "C-c C-e") 'embark-export) ;; 把minibuffer结果在一个菜单中显示
(global-set-key (kbd "C-c f e") 'consult-flycheck) ;; flycheck菜单
(if *is-mac*
(progn
(global-set-key (kbd "C-c f l") 'consult-fd-global)
@@ -201,6 +204,12 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
(global-set-key (kbd "C-c f l") 'consult-locate)
(global-set-key (kbd "C-c f m") 'consult-fd-global))
;; flycheck
(global-set-key (kbd "C-c f c") 'global-flycheck-mode)
(with-eval-after-load 'flycheck
(define-key flycheck-mode-map (kbd "M-{") 'flycheck-previous-error)
(define-key flycheck-mode-map (kbd "M-}") 'flycheck-next-error))
;; avy
(global-set-key (kbd "C-M-;") 'avy-goto-char)
(global-set-key (kbd "C-M-'") 'ace-pinyin-jump-char)