在wsl2中使用emacs-gui
1. 安装WSL2+Debian
略
2. 将Debian切换至SID版本
sudo nano /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free non-free-firmware
sudo apt update && sudo apt install apt-transport-https ca-certificates
sudo nano /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free non-free-firmware
sudo apt install emacs-pgtk gcc make git librime-dev fonts-cascadia-code wget python3-pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
wget https://github.moeyy.xyz/https://github.com/uniartisan/fonts-harmonyos-sans-cn/releases/download/v1.0.0/harmonyos_sans.deb
sudo dpkg -i harmonyos_sans.deb
3. 设置中文环境
sudo nano /etc/locale.gen
zh_CN.UTF-8 UTF-8
sudo locale-gen
echo 'export LANG=zh_CN.UTF-8' >> ~/.bashrc
echo 'export LC_ALL=zh_CN.UTF-8' >> ~/.bashrc
4. 配置RIME
安装雾凇拼音输入方案
git clone https://github.moeyy.xyz/https://github.com/iDvel/rime-ice --depth=1
cp -r ./rime-ice/* /usr/share/rime-data/
(use-package rime
:custom
(default-input-method "rime")
(rime-show-candidate 'posframe)
:config
(setq rime-translate-keybindings
'("C-f" "C-b" "C-n" "C-p" "C-g" "C-`" "<left>" "<right>" "<up>" "<down>" "<prior>" "<next>" "<delete>"))
:bind
("C-\\" . toggle-input-method)
)
测试启用Emacs-rime之后,编辑配置文件 rime-open-configuration
patch:
schema_list:
- {schema: double_pinyin_flypy}
ascii_composer/good_old_caps_lock: true # true | false
ascii_composer/switch_key:
Caps_Lock: clear # commit_code | commit_text | clear
Shift_L: commit_code # commit_code | commit_text | inline_ascii | clear | noop
Shift_R: commit_code # commit_code | commit_text | inline_ascii | clear | noop
Control_L: noop # commit_code | commit_text | inline_ascii | clear | noop
Control_R: noop # commit_code | commit_text | inline_ascii | clear | noop
key_binder/bindings:
# Tab / Shift+Tab 切换光标至下/上一个拼音
- { when: composing, accept: Shift+Tab, send: Shift+Left }
- { when: composing, accept: Tab, send: Shift+Right }
# Tab / Shift+Tab 翻页
# - { when: has_menu, accept: Shift+Tab, send: Page_Up }
# - { when: has_menu, accept: Tab, send: Page_Down }
# Option/Alt + ←/→ 切换光标至下/上一个拼音
- { when: composing, accept: Alt+Left, send: Shift+Left }
- { when: composing, accept: Alt+Right, send: Shift+Right }
# 翻页 - =
- { when: has_menu, accept: minus, send: Page_Up }
- { when: has_menu, accept: equal, send: Page_Down }
# 翻页 , .
- { when: paging, accept: comma, send: Page_Up }
- { when: has_menu, accept: period, send: Page_Down }
# 翻页 [ ]
# - { when: paging, accept: bracketleft, send: Page_Up }
# - { when: has_menu, accept: bracketright, send: Page_Down }
# 两种按键配置,鼠须管 Control+Shift+4 生效,小狼毫 Control+Shift+dollar 生效,都写上了。
# numbered_mode_switch:
# - { when: always, select: .next, accept: Control+Shift+1 } # 在最近的两个方案之间切换
# - { when: always, select: .next, accept: Control+Shift+exclam } # 在最近的两个方案之间切换
# - { when: always, toggle: ascii_mode, accept: Control+Shift+2 } # 切换中英
# - { when: always, toggle: ascii_mode, accept: Control+Shift+at } # 切换中英
- { when: always, toggle: ascii_punct, accept: Control+Shift+3 } # 切换中英标点
- { when: always, toggle: ascii_punct, accept: Control+Shift+numbersign } # 切换中英标点
- { when: always, toggle: traditionalization, accept: Control+Shift+4 } # 切换简繁
- { when: always, toggle: traditionalization, accept: Control+Shift+dollar } # 切换简繁
# - { when: always, toggle: full_shape, accept: Control+Shift+5 } # 切换全半角
# - { when: always, toggle: full_shape, accept: Control+Shift+percent } # 切换全半角
5. 杂项
5.1. 设置剪切板格式以便与Windows互通
(set-clipboard-coding-system 'gbk)