[已解决] Spacemacs 不支持 C-u M-x

如题,Spacemacs 不支持 C-u M-x. 虽然不常用,但比较复杂的对齐功能会用到 C-u M-x align-regexp . Error: Specifying a prefix arg before calling `helm-M-x’

有什么办法让Spacemacs支持 C-u M-x吗?

C-u 在 spacemacs 里面使用 SPC u 代替。

2 个赞

这是 helm 的锅。你需要使用 M-x C-u 而不是 C-u M-x

1 个赞

两种方法都不行。其实就是想实现这个功能,alignment - Align to columns in emacs? - Stack Overflow ,不然很少用 C-u M-x

你的 M-x 绑定的命令是哪个?

helm 呀,我找到替代的命令了, 用 spacemacs/align-repeat

我一般是先C-z退出evil,然后C-u xxxx正常操作,完了再C-z,恩…有点麻烦,好在不太常用

并没有 helm 这个命令,helm 下有个 helm-M-x 命令,但是你完全有可能用的是别的命令,比如:helm-my-M-x。

M-x runs the command helm-M-x, which is an interactive autoloaded compiled Lisp function in `helm-command.el’.

It is bound to M-m :, M-x.

我没有用evil,应该是helm-M-x不支持C-u

@cutejumper 前面提过了:helm-M-x 不允许 前置 C-u,并不是不支持 C-u,而要求你在选好命令之后、用 RET 执行之前指定 C-u,也就是说:

正常的

C-u M-x align-regexp RET

变成

(helm-)M-x align-regexp C-u RET

helm-M-x 处理 prefix argument 的方式应该是设计上的考量,其实支持在 helm-M-x 之前指定 prefix argument 实现起来没有任何难度。不喜欢这种方式的话,重写个 helm-foo-M-x 并不困难。

2 个赞

原来是这样。

试试加个选项允许前置的 prefix argument

helm-M-x 现在也支持前置的 prefix argument 了,可以通过 C-h mCommands · emacs-helm/helm Wiki · GitHub 了解这个新功能。

1 个赞