UP | HOME

emacs-Windows上使用Emacs

[2024-04-24 周三 16:14]

1. 字体编码处理

org-roam和ripgrep:

设置org-mode的字符编码,同时开启自动revert功能

(use-package lazy-revert
  :ensure nil
  ;; :quelpa (lazy-revert :fetcher github
  ;;                      :repo "yilin-zhang/lazy-revert")
  :hook (after-init . lazy-revert-mode)
  ;; Optional
  :config
  (setq auto-revert-verbose t ; let us know when it happens
        auto-revert-use-notify nil
        auto-revert-stop-on-user-input nil
        ;; Only prompts for confirmation when buffer is unsaved.
        revert-without-query (list ".")))
(add-to-list 'file-coding-system-alist '("\\.org\\'" . utf-8))

设置ripgrep的字符编码

(add-to-list 'process-coding-system-alist
                        '("[rR][gG]" . (utf-8 . gbk-dos)))

其他编码设置

(prefer-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(set-default 'process-coding-system-alist
             '(("[pP][lL][iI][nN][kK]" gbk-dos . gbk-dos)
               ("[cC][mM][dD][pP][rR][oO][xX][yY]" gbk-dos . gbk-dos)))

2. consult

2.1. 调用Everything进行搜索

下载命令行接口 es.exe

https://www.voidtools.com/zh-cn/downloads/#cli

consult调用everything

consult配置

(use-package consult
  :defer t
  :init
  (progn
    (add-to-list 'process-coding-system-alist '("es" gbk . gbk))
    (add-to-list 'process-coding-system-alist '("explorer" gbk . gbk))
    (setq consult-locate-args (encode-coding-string "es.exe -i -p -r" 'gbk)))
  :custom
  (consult-async-min-input 2) ;;中文2字符开搜
  )

模糊搜索技巧

貌似目前只能通过单个单词搜索之后,在搜索结果后面加上 # 再用orderless的规则去弄。

比如 搜索 #emacs#keyword1 keyword2 来过滤,此时可以添加空格

▲ 编辑于 [2024-05-22 周三 22:08] | © Published by Emacs 31.0.50 (Org mode 9.7.16) on [2024-11-21 周四 00:22] | RSS