WSL2下用 emacs 的一些痛点

目前遇到如下一些问题:

  1. 在终端 ctrl-r 搜索命令历史之后按 tab,终端会卡死几十秒钟(无论是 Windows terminal 还是 emacs 下 vterm 都有这个问题)
  2. spacemacs 无法使用 ripgrep 搜索,在终端可以用 rg 搜索(有一段时间没有升级 counsel 了,等下升级看看能否解决)
  3. WSL2 下 org-download 截屏工具大家用哪一款?(有没有可能用 Windows 上的截图工具,比如 snipaste?)

和大家交流一下,谢谢阅读!

可以试一下 color-rg.el

1 个赞

问题3貌似可以调用windows下面的截图工具,之前调查过,有可行的方案。我觉得麻烦就没搞。WSL内部的截图工具只能截取WSL下的GUI画面。你需要的话只能自己去查查了。我见到的方案是用powershell脚本进行中转处理。

1 个赞

rg不能用是因为windows要配置UTF8。

1 个赞

我开wsl-terminal里面,ctrl-r也会卡住,我现在是看到跳出来需要的选项后不按tab直接c-c。然后鼠标选择复制。

1 个赞

看这里,凑合着用,别管func名字了

wsl 通过powershell保存剪切板里的图片

3 个赞

请问具体在哪里配置?

还是太麻烦了不是,这个 bug 真的挺讨厌

有空我试一下 snipaste 能不能用这种方法调用

1 个赞

谢谢!转帖你的图片,让大家都能看到

image

亲测无效,是不是还有其它要设置的地方?

只有这个地方了,我弄好了UTF8就可以用了。还有,你得恢复自带的rg配置,用最新的spacemacs/doom版本。或者配置

  (when (executable-find "rg")
(setq counsel-grep-base-command "rg -S --no-heading --line-number --color never %s %s")
(setq counsel-rg-base-command (if (memq system-type '(ms-dos windows-nt))
                                  (split-string "rg -M 240 --with-filename --no-heading --line-number --color never %s --path-separator / .")
                                "rg -M 240 --with-filename --no-heading --line-number --color never %s")))
1 个赞

有个问题是在Windows上设置 UTF-8后,我在WSL2里emacs的剪切板内容都不能到 Windows 剪切板了

如果你按照我之前的教程弄的话没有问题的。

“The Ultimate Emacs Hacking Tutorial in Windows 10 WSL 2” by DAMON CHAN

或者你试试 xclip这个包?

不过教程里面忘记提及UTF8的问题了,有空我再补上。

你的xserver配置是不是有问题?我这里用mobaxterm没问题哦。

rg 的问题自己神奇地恢复了,之前不知道是哪里抽风了