Add :input chinese module #1371
This commit is contained in:
parent
6ea0c39137
commit
fadbfb321f
4 changed files with 116 additions and 1 deletions
|
@ -8,7 +8,10 @@
|
||||||
;; More information about these modules (and what flags they support) can be
|
;; More information about these modules (and what flags they support) can be
|
||||||
;; found in modules/README.org.
|
;; found in modules/README.org.
|
||||||
|
|
||||||
(doom! :completion
|
(doom! :input
|
||||||
|
;;chinese
|
||||||
|
|
||||||
|
:completion
|
||||||
company ; the ultimate code completion backend
|
company ; the ultimate code completion backend
|
||||||
;;helm ; the *other* search engine for love and life
|
;;helm ; the *other* search engine for love and life
|
||||||
;;ido ; the other *other* search engine...
|
;;ido ; the other *other* search engine...
|
||||||
|
|
42
modules/input/chinese/README.org
Normal file
42
modules/input/chinese/README.org
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#+TITLE: input/chinese
|
||||||
|
#+DATE: May 13, 2019
|
||||||
|
#+SINCE: 2.1
|
||||||
|
#+STARTUP: inlineimages
|
||||||
|
|
||||||
|
* Table of Contents :TOC_3:noexport:
|
||||||
|
- [[#description][Description]]
|
||||||
|
- [[#module-flags][Module Flags]]
|
||||||
|
- [[#plugins][Plugins]]
|
||||||
|
- [[#hacks][Hacks]]
|
||||||
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#features][Features]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
|
* Description
|
||||||
|
This module adds support for traditional Chinese script by introducing two input
|
||||||
|
methods: Pinyin and Wubi.
|
||||||
|
|
||||||
|
#+begin_quote
|
||||||
|
Because I am unable to personally test this module, help to improve this module
|
||||||
|
would be greatly appreciated! Especially where performance is concerned.
|
||||||
|
#+end_quote
|
||||||
|
|
||||||
|
** Module Flags
|
||||||
|
+ =+wubi=
|
||||||
|
|
||||||
|
** Plugins
|
||||||
|
+ [[https://github.com/tumashu/pyim][pyim]] (unless =+wubi=)
|
||||||
|
+ [[https://github.com/zilongshanren/chinese-wbim][chinese-wbim]] (if =+wubi=)
|
||||||
|
+ [[https://github.com/cute-jumper/fcitx.el][fcitx]]
|
||||||
|
+ [[https://github.com/cute-jumper/ace-pinyin][ace-pinyin]]
|
||||||
|
+ [[https://github.com/coldnew/pangu-spacing][pangu-spacing]]
|
||||||
|
|
||||||
|
** Hacks
|
||||||
|
+ ~org-html-paragraph~ has been modified to join consecutive Chinese lines into
|
||||||
|
a single long line without wanted spaced (when exporting org-mode to html).
|
||||||
|
|
||||||
|
* TODO Prerequisites
|
||||||
|
* TODO Features
|
||||||
|
* TODO Configuration
|
||||||
|
* TODO Troubleshooting
|
61
modules/input/chinese/config.el
Normal file
61
modules/input/chinese/config.el
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
;;; input/chinese/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(def-package! pyim
|
||||||
|
:unless (featurep! +wubi)
|
||||||
|
:config
|
||||||
|
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/")
|
||||||
|
pyim-page-tooltip t
|
||||||
|
default-input-method "pyim"))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! chinese-wbim
|
||||||
|
:when (featurep! +wubi)
|
||||||
|
:init
|
||||||
|
(setq chinese-wbim-use-tooltip nil) ; tooptip isn't good enough
|
||||||
|
:config
|
||||||
|
(setq default-input-method 'chinese-wubi)
|
||||||
|
|
||||||
|
(autoload 'chinese-wbim-use-package "chinese-wubi"
|
||||||
|
"Another emacs input method")
|
||||||
|
(register-input-method
|
||||||
|
"chinese-wubi" "euc-cn" 'chinese-wbim-use-package
|
||||||
|
"五笔" "汉字五笔输入法" "wb.txt")
|
||||||
|
(require 'chinese-wbim-extra)
|
||||||
|
(global-set-key ";" 'chinese-wbim-insert-ascii))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! pangu-spacing
|
||||||
|
:hook (doom-after-init . global-pangu-spacing-mode)
|
||||||
|
:config
|
||||||
|
;; Always insert `real' space in org-mode.
|
||||||
|
(setq-hook! 'org-mode-hook pangu-spacing-real-insert-separtor t))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! fcitx
|
||||||
|
:when (executable-find "fcitx-remote")
|
||||||
|
:after evil
|
||||||
|
:config (fcitx-evil-turn-on))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! ace-pinyin
|
||||||
|
:after (:or avy ace-window)
|
||||||
|
:config
|
||||||
|
(setq ace-pinyin-use-avy t)
|
||||||
|
(ace-pinyin-global-mode t))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Hacks
|
||||||
|
|
||||||
|
(defun +chinese*org-html-paragraph (paragraph contents info)
|
||||||
|
"Join consecutive Chinese lines into a single long line without unwanted space
|
||||||
|
when exporting org-mode to html."
|
||||||
|
(let* ((fix-regexp "[[:multibyte:]]")
|
||||||
|
(origin-contents contents)
|
||||||
|
(fixed-contents
|
||||||
|
(replace-regexp-in-string
|
||||||
|
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||||
|
"\\1\\2"
|
||||||
|
origin-contents)))
|
||||||
|
(list paragraph fixed-contents info)))
|
||||||
|
(advice-add #'org-html-paragraph :filter-args #'+chinese*org-html-paragraph)
|
9
modules/input/chinese/packages.el
Normal file
9
modules/input/chinese/packages.el
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
;; -*- no-byte-compile: t; -*-
|
||||||
|
;;; input/chinese/packages.el
|
||||||
|
|
||||||
|
(if (featurep! +wubi)
|
||||||
|
(package! chinese-wbim)
|
||||||
|
(package! pyim))
|
||||||
|
(package! fcitx)
|
||||||
|
(package! ace-pinyin)
|
||||||
|
(package! pangu-spacing)
|
Loading…
Add table
Add a link
Reference in a new issue