refactor(segmentation): clean up cns config with use-package
This commit is contained in:
@@ -120,6 +120,9 @@
|
|||||||
(mode . eww-bookmark-mode)
|
(mode . eww-bookmark-mode)
|
||||||
(mode . eww-buffers-mode)
|
(mode . eww-buffers-mode)
|
||||||
(mode . eww-history-mode)))
|
(mode . eww-history-mode)))
|
||||||
|
("Calc" (or
|
||||||
|
(mode . calc-mode)
|
||||||
|
(mode . calc-trail-mode)))
|
||||||
("Shell" (or
|
("Shell" (or
|
||||||
(mode . eshell-mode)
|
(mode . eshell-mode)
|
||||||
(mode . eat-mode)
|
(mode . eat-mode)
|
||||||
@@ -192,8 +195,6 @@
|
|||||||
(name . "^*Buffer List*")
|
(name . "^*Buffer List*")
|
||||||
(name . "\\*discomfort\\*")
|
(name . "\\*discomfort\\*")
|
||||||
(mode . calendar-mode)
|
(mode . calendar-mode)
|
||||||
(mode . calc-mode)
|
|
||||||
(mode . calc-trail-mode)
|
|
||||||
(mode . grep-mode)
|
(mode . grep-mode)
|
||||||
(mode . occur-mode))))))
|
(mode . occur-mode))))))
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
(use-package dashboard
|
(use-package dashboard
|
||||||
:autoload dashboard-setup-startup-hook
|
:autoload dashboard-setup-startup-hook
|
||||||
:init
|
:hook after-init
|
||||||
|
:config
|
||||||
(setq dashboard-banner-logo-title (format "%s" emacs-version)
|
(setq dashboard-banner-logo-title (format "%s" emacs-version)
|
||||||
dashboard-banner-ascii " ##### # # # # ####### # # # ##### ##### \n# # ## # # # # ## ## # # # # # # \n# # # # # # # # # # # # # # # \n# #### # # # # # ##### # # # # # # ##### \n# # # # # # # # # # ####### # # \n# # # ## # # # # # # # # # # # \n ##### # # ##### ####### # # # # ##### ##### "
|
dashboard-banner-ascii " ##### # # # # ####### # # # ##### ##### \n# # ## # # # # ## ## # # # # # # \n# # # # # # # # # # # # # # # \n# #### # # # # # ##### # # # # # # ##### \n# # # # # # # # # # ####### # # \n# # # ## # # # # # # # # # # # \n ##### # # ##### ####### # # # # ##### ##### "
|
||||||
dashboard-startup-banner 'ascii
|
dashboard-startup-banner 'ascii
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
"~/org/hugo/this-is-my-blog/")))
|
"~/org/hugo/this-is-my-blog/")))
|
||||||
(timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
|
(timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
|
||||||
(default-directory blog-dir))
|
(default-directory blog-dir))
|
||||||
(save-buffer)
|
|
||||||
(message "Adding files...")
|
(message "Adding files...")
|
||||||
(eshell-command "git add .")
|
(eshell-command "git add .")
|
||||||
(message "Committing: %s" timestamp)
|
(message "Committing: %s" timestamp)
|
||||||
|
|||||||
@@ -229,7 +229,8 @@
|
|||||||
;; org-mode
|
;; org-mode
|
||||||
(general-def org-mode-map
|
(general-def org-mode-map
|
||||||
"C-<tab>" 'org-cycle-parent-subtree
|
"C-<tab>" 'org-cycle-parent-subtree
|
||||||
"C-c i" 'consult-outline
|
"M-g i" 'consult-outline
|
||||||
|
"M-g M-i" 'consult-outline
|
||||||
"C-c t l" 'org-toggle-link-display
|
"C-c t l" 'org-toggle-link-display
|
||||||
"M-{" 'org-previous-visible-heading
|
"M-{" 'org-previous-visible-heading
|
||||||
"M-}" 'org-next-visible-heading
|
"M-}" 'org-next-visible-heading
|
||||||
@@ -306,8 +307,6 @@
|
|||||||
"r" 'restart-emacs
|
"r" 'restart-emacs
|
||||||
"e" 'er/expand-region
|
"e" 'er/expand-region
|
||||||
"s" 'consult-line
|
"s" 'consult-line
|
||||||
"i" 'consult-imenu
|
|
||||||
"I" 'consult-imenu-multi
|
|
||||||
"a" 'org-agenda
|
"a" 'org-agenda
|
||||||
"l" 'org-store-link
|
"l" 'org-store-link
|
||||||
"k" 'comment-line
|
"k" 'comment-line
|
||||||
@@ -368,6 +367,7 @@
|
|||||||
"M-g g" 'avy-goto-line
|
"M-g g" 'avy-goto-line
|
||||||
"M-g M-g" 'consult-goto-line
|
"M-g M-g" 'consult-goto-line
|
||||||
"M-g i" 'consult-imenu
|
"M-g i" 'consult-imenu
|
||||||
|
"M-g I" 'consult-imenu-multi
|
||||||
"M-g M-i" 'consult-imenu
|
"M-g M-i" 'consult-imenu
|
||||||
|
|
||||||
;; window
|
;; window
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
(org-mode . electric-pair-local-mode)
|
(org-mode . electric-pair-local-mode)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(require 'org-tempo)
|
|
||||||
|
|
||||||
(defun my-org-electric-pair-fix ()
|
(defun my-org-electric-pair-fix ()
|
||||||
(setq-local electric-pair-inhibit-predicate
|
(setq-local electric-pair-inhibit-predicate
|
||||||
(lambda (char)
|
(lambda (char)
|
||||||
|
|||||||
@@ -5,37 +5,38 @@
|
|||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;; emacs-chinese-word-segmentation
|
;; emacs-chinese-word-segmentation
|
||||||
(cond
|
(use-package cns
|
||||||
(*is-windows*
|
:straight nil
|
||||||
(add-to-list 'load-path "h:/emacs/emacs-chinese-word-segmentation/") ;设置为进程调用方式
|
:hook
|
||||||
(setq cns-process-type 'shell) ;设置可执行文件路径
|
(after-init . require-cns)
|
||||||
(setq cns-prog "h:/emacs/emacs-chinese-word-segmentation/cnws.exe") ;设置字典目录
|
(after-init . global-cns-mode)
|
||||||
(setq cns-dict-directory "h:/emacs/emacs-chinese-word-segmentation/cppjieba/dict") ;直接设置进程命令,绕过 Windows shell 检测
|
:init
|
||||||
(setq cns-process-shell-command
|
(cond
|
||||||
(format "%s %s %s %s %s %s"
|
(*is-windows*
|
||||||
cns-prog
|
(add-to-list 'load-path "h:/emacs/emacs-chinese-word-segmentation/") ;设置为进程调用方式
|
||||||
(concat (file-name-as-directory cns-dict-directory) "jieba.dict.utf8")
|
(setq cns-process-type 'shell) ;设置可执行文件路径
|
||||||
(concat (file-name-as-directory cns-dict-directory) "hmm_model.utf8")
|
(setq cns-prog "h:/emacs/emacs-chinese-word-segmentation/cnws.exe") ;设置字典目录
|
||||||
(concat (file-name-as-directory cns-dict-directory) "user.dict.utf8")
|
(setq cns-dict-directory "h:/emacs/emacs-chinese-word-segmentation/cppjieba/dict") ;直接设置进程命令,绕过 Windows shell 检测
|
||||||
(concat (file-name-as-directory cns-dict-directory) "idf.utf8")
|
(setq cns-process-shell-command
|
||||||
(concat (file-name-as-directory cns-dict-directory) "stop_words.utf8"))))
|
(format "%s %s %s %s %s %s"
|
||||||
|
cns-prog
|
||||||
|
(concat (file-name-as-directory cns-dict-directory) "jieba.dict.utf8")
|
||||||
|
(concat (file-name-as-directory cns-dict-directory) "hmm_model.utf8")
|
||||||
|
(concat (file-name-as-directory cns-dict-directory) "user.dict.utf8")
|
||||||
|
(concat (file-name-as-directory cns-dict-directory) "idf.utf8")
|
||||||
|
(concat (file-name-as-directory cns-dict-directory) "stop_words.utf8"))))
|
||||||
|
|
||||||
(t
|
(t
|
||||||
(add-to-list 'load-path "~/emacs-stuff/emacs-chinese-word-segmentation/")
|
(add-to-list 'load-path "~/emacs-stuff/emacs-chinese-word-segmentation/")
|
||||||
(setq cns-process-type 'shell)
|
(setq cns-process-type 'shell)
|
||||||
(setq cns-prog "~/emacs-stuff/emacs-chinese-word-segmentation/cnws")
|
(setq cns-prog "~/emacs-stuff/emacs-chinese-word-segmentation/cnws")
|
||||||
(setq cns-dict-directory "~/emacs-stuff/emacs-chinese-word-segmentation/cppjieba/dict/")))
|
(setq cns-dict-directory "~/emacs-stuff/emacs-chinese-word-segmentation/cppjieba/dict/")))
|
||||||
|
|
||||||
;; 其他配置
|
:config
|
||||||
(setq cns-recent-segmentation-limit 40)
|
(defun require-cns ()
|
||||||
(require 'cns nil t)
|
(require 'cns nil t))
|
||||||
|
|
||||||
;; 自动启动
|
(setq cns-recent-segmentation-limit 40)
|
||||||
(when (featurep 'cns)
|
|
||||||
(add-hook 'after-init-hook 'global-cns-mode))
|
|
||||||
|
|
||||||
;; 取消C-<backspace>绑定
|
|
||||||
(with-eval-after-load 'cns
|
|
||||||
(define-key cns-mode-map (kbd "C-<backspace>") nil))
|
(define-key cns-mode-map (kbd "C-<backspace>") nil))
|
||||||
|
|
||||||
(provide 'init-segmentation)
|
(provide 'init-segmentation)
|
||||||
|
|||||||
Reference in New Issue
Block a user