spacemacs/layers/chinese/README.org

135 lines
6.2 KiB
Org Mode
Raw Normal View History

#+TITLE: Chinese layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../css/readtheorg.css" />
2015-06-27 15:12:43 +00:00
[[file:img/China.png]] [[file:img/Chinese.png]]
2015-06-27 15:12:43 +00:00
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Layer][Layer]]
- [[Configuration][Configuration]]
- [[Configure the Default Input Method(配置默认中文输入法)][Configure the Default Input Method(配置默认中文输入法)]]
- [[Configure the =Chinese-pyim= Input Method(配置中文拼音输入法)][Configure the =Chinese-pyim= Input Method(配置中文拼音输入法)]]
2015-11-17 00:23:02 +00:00
- [[Enable fcitx][Enable fcitx]]
- [[Requirement][Requirement]]
- [[Enable YouDao(有道) Dictionary(激活有道字典)][Enable YouDao(有道) Dictionary(激活有道字典)]]
- [[Set monospaced font size(设置等宽字体)][Set monospaced font size(设置等宽字体)]]
2015-11-08 08:59:51 +00:00
- [[Enable/Disable ace-pinyin in =avy-goto-char=][Enable/Disable ace-pinyin in =avy-goto-char=]]
- [[Key Bindings][Key Bindings]]
- [[Youdao Dictionary][Youdao Dictionary]]
- [[Find-by-pinyin-dired][Find-by-pinyin-dired]]
2015-06-27 15:12:43 +00:00
* Description
This Layer adds Chinese related packages:
- [[https://github.com/tumashu/chinese-pyim][chinese-pyim]] : The best Chinese Pinyin(拼音) input method.
- [[https://github.com/andyque/chinese-wbim][chinese-wbim]]: The best Chinese Wubi(五笔) input method.
2015-11-17 00:23:02 +00:00
- [[https://github.com/cute-jumper/fcitx.el][cute-jumper/fcitx.el]]: This package provides a set of functions to make fcitx work better in Emacs.
2015-06-27 15:12:43 +00:00
- [[https://github.com/xuchunyang/youdao-dictionary.el][youdao-dictionary]]: The Youdao(有道) Dictionary interface for Emacs.
- [[https://github.com/redguardtoo/find-by-pinyin-dired][find-by-pinyin-dired]]: Find file by first Pinyin characters of Chinese Hanzi.
- [[https://github.com/cute-jumper/ace-pinyin][ace-pinyin]]: Jump to Chinese character by pinyin with `ace-jump-mode'.
- [[https://github.com/coldnew/pangu-spacing][coldnew/pangu-spacing]] : emacs minor-mode to add space between Chinese and English characters.
- Join consecutive Chinese lines into a single long line without unwanted space when exporting org-mode to html.
2015-06-27 15:12:43 +00:00
* Install
** Layer
To use this contribution add it to your =~/.spacemacs=
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(chinese))
#+END_SRC
2015-06-27 15:12:43 +00:00
** Configuration
*** Configure the Default Input Method(配置默认中文输入法)
The default Chinese input method is =Chinese-pyim=, if you are a Wubi(五笔) user,
2015-11-08 08:59:51 +00:00
you could set the variable =chinese-default-input-method= to =wubi=:
2015-06-27 15:12:43 +00:00
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(chinese :variables chinese-default-input-method 'wubi)))
#+end_src
2015-06-27 15:12:43 +00:00
*** Configure the =Chinese-pyim= Input Method(配置中文拼音输入法)
When the first time you use =Chinese-pyim=, you should install the lexicon(词库)
file. You could call =pyim-dicts-manager= to open up the settings buffer and
press =i e= to install the default lexicon. The lexicon is about 20M, so you
should be patient when downloading starts. After the lexicon file is downloaded,
just press =s= to save and =R= to restart configuration.
2015-11-17 00:23:02 +00:00
*** Enable fcitx
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '((chinese :variables
chinese-enable-fcitx t)))
#+END_SRC
If you dont need to type Chinese in minibuffer, you could temporarily disable fcitx in minibuffer
with the following configuration.
#+BEGIN_SRC emacs-lisp
(fcitx-aggressive-setup)
#+END_SRC
**** Requirement
***** Linux
You need use this with =fcitx= and make sure =fcitx-remote= is in your search path.
***** Mac OS X
We don't have a =fcitx= in OS X for now.But we already had a simulate =fcitx-remote= to make you happy with other Chinese input-methods.
2015-11-17 00:23:02 +00:00
You can install [[https://github.com/CodeFalling/fcitx-remote-for-osx][fcitx-remote-for-osx]] from homebrew.
#+BEGIN_SRC shell
brew install fcitx-remote-for-osx --with-input-method=baidu-pinyin
#+END_SRC
=--with-input-method=baidu-pinyin= means install for Baidu-pinyin Input Method.
You can use =brew info fcitx-remote-for-osx= to get more options info for input method support.
#+BEGIN_EXAMPLE
--with-input-method=
Select input method: baidu-pinyin(default), baidu-wubi, sogou-pinyin, qq-wubi, squirrel-rime, osx-pinyin
#+END_EXAMPLE
***** Windows
=fcitx.el= dosen't support Windows for now.We just disable it in layer.
*** Enable YouDao(有道) Dictionary(激活有道字典)
The YouDao Dictionary is disabled by default, if you want enable it.
2015-11-08 08:59:51 +00:00
You should set =chinese-enable-youdao-dict= to =t=.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '((chinese :variables
chinese-enable-youdao-dict t)))
#+END_SRC
2015-06-27 15:12:43 +00:00
*** Set monospaced font size(设置等宽字体)
If you are mixing Chinese words with English words, the text is not perfectly
aligned in org table. That's because normally the Chinese font size is not equal
to the English font size. You could call =spacemacs//set-monospaced-font= with
your own Chinese font name in =dotspacemacs/user-config= function.
2015-06-27 15:12:43 +00:00
Example configuration:
#+BEGIN_SRC emacs-lisp
;; Note: The Hiragino Sans GB is bundled with MacOS X.
;; If you are not using MacOS X, you should change it to another Chinese font name.
2015-06-27 15:12:43 +00:00
(spacemacs//set-monospaced-font "Source Code Pro" "Hiragino Sans GB" 14 16)
#+END_SRC
2015-06-27 15:12:43 +00:00
2015-11-08 08:59:51 +00:00
*** Enable/Disable ace-pinyin in =avy-goto-char=
You can use =avy-goto-char= with pinyin supported by default, if you want to
disable it.You can set =chinese-enable-avy-pinyin= to =nil=.
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '((chinese :variables
chinese-enable-avy-pinyin nil)))
#+END_SRC
2015-06-27 15:12:43 +00:00
* Key Bindings
Currently, there are no built-in key bindings for this layer. You could define
your own preference.
2015-06-27 15:12:43 +00:00
Here are a few suggested key bindings (remember that ~SPC o~ is reserved for
personal usage, spacemacs won´t put any binding under this prefix):
2015-06-27 15:12:43 +00:00
** Youdao Dictionary
Bind ~SPC o y~ to =youdao-dictionary-search-at-point+=.
2015-06-27 15:12:43 +00:00
** Find-by-pinyin-dired
Bind ~SPC o d~ to =find-by-pinyin-dired=
2015-06-27 15:12:43 +00:00