Emacs 自动完成与camelcase

Emacs 自动完成与camelcase,emacs,autocomplete,Emacs,Autocomplete,如果我使用Meta-/自动完成像ThisClass这样的单词,emacs会感到困惑,并给出ThisClass或ThisClass。更糟糕的是,如果我输入了ThisC,然后自动完成,它会给出thisglass,这非常令人沮丧 有没有办法改变这种行为?是的,请使用嬉皮扩展: (全局设置键(kbd“M-/”)嬉皮士扩展) 看看上面的文字和简洁的文字 hippie expand类似于dabbrev(M-/)的默认绑定),但增加了更多功能,并且在此过程中修复了您指出的camelcase问题。除了hipp

如果我使用
Meta-/
自动完成像
ThisClass
这样的单词,emacs会感到困惑,并给出
ThisClass
ThisClass
。更糟糕的是,如果我输入了
ThisC
,然后自动完成,它会给出
thisglass
,这非常令人沮丧


有没有办法改变这种行为?

是的,请使用
嬉皮扩展

(全局设置键(kbd“M-/”)嬉皮士扩展)
看看上面的文字和简洁的文字


hippie expand
类似于
dabbrev
(M-/)的默认绑定),但增加了更多功能,并且在此过程中修复了您指出的camelcase问题。

除了hippie expand之外,您还可以通过自定义以下变量,使用dabbrev实现所需的行为:

dabbrev-case-fold-search is a variable defined in `dabbrev.el'.
Its value is nil

  This variable is potentially risky when used as a file local variable.

Documentation:
Control whether dabbrev searches should ignore case.
A value of nil means case is significant.
A value of `case-fold-search' means case is significant
 if `case-fold-search' is nil.
Any other non-nil version means case is not significant.

You can customize this variable.

虽然修改搜索行为是解决问题的一种方法,但另一种可能更好的方法是保持搜索行为不变,而是修改替换行为

要完成此操作,请设置变量 达布列夫箱更换 零

这种方法可能更好,因为即使您键入的大小写不正确,它仍然会正确匹配,然后按照正确的大小写完成

示例:假设您有变量“aVariable”。如果更改搜索行为(将dabbrev case fold search设置为nil),则键入“av”将与变量不匹配。但是,如果您改为更改替换行为(将dabbrev case replace设置为nil),则键入“av”将扩展为“aVariable”


参考资料:

不错,我喜欢。它还解决了如何自动完成整行的问题。谢谢:)看看这一个这一个适合我。