Emacs查字典:使用sdcv,帮助阅读Emacs文档
随着对Emacs更加熟悉,想更进一步的学习需要阅读一些文档,全英文的不免有些吃力,下面记录一下利用sdcv的查字典插件帮助阅读的解决方案。
安装插件
(use-package sdcv
:ensure t
:config
(setq sdcv-dictionary-simple-list
'("懒虫简明英汉词典"
"懒虫简明汉英词典"
"计算机词汇")))
我使用的是Linux Mint,需要apt两个软件:
sudo apt install stardict
sudo apt install sdcv
下载字典资源到目录下,http://download.huzheng.org/zh_CN/,然后把字典copy到资源目录下,下面以计算机词汇为例:
sudo cp -r stardict-kdic-computer-gb-2.4.2 /usr/share/stardict/dic/
我使用evil-mode所以使用evil-leader来绑定使用sdcv的快捷键,不过也写了原生emacs键位的绑定
(use-package evil-leader
:after evil
:init (global-evil-leader-mode)
:config
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"s" 'swiper
"S" 'swiper-isearch-backward
......
"tt" 'neotree-toggle
"dd" 'sdcv-search-pointer+ ;; 光标处查询
"di" 'sdcv-search-input+ ;; 输入查询
"qR" 'restart-emacs
......
)
)
(define-prefix-command 'dictionary-map)
(global-set-key (kbd "C-c d") 'dictionary-map)
(define-key dictionary-map (kbd "d") 'sdcv-search-pointer+)
(define-key dictionary-map (kbd "i") 'sdcv-search-input+)