2

I use dabbrev as my auto-complete function (and since most of what I code is snake_case it works well). However, I'm now doing a Java project and everything is CamelCase. How do I make dabbrev support CamelCase? Or is there a different auto-complete function I should be using in .java buffers?

In particular, if the text dabbrev is copying is in some form of CamelCase e.g.

GenericValue genericValue = new Ge...

and I type M-/ where the ... is, I'd like it to expand the rest of the text in CamelCase without touching the case of the letters currently typed and thus correctly cased. thus geM-/ -> genericValue and GeM-/ -> GenericValue.

I am willing to try another function to see if it works better. And, if I have to hack dabbrev, I can do that too.

intel_chris
  • 329
  • 2
  • 12

1 Answers1

3

Since you seem to use dabbrev without company setting following 2 variables, could help:

(setq dabbrev-case-fold-search nil
     dabbrev-case-replace nil)

To see documentation and other possible settings you could use:

M-x customize-group <RET> dabbrev <RET>

An alternative to dabbrev would be hippie-expand

jue
  • 4,476
  • 8
  • 20
  • I still have some cases where it doesn't quite work like I want, but I'm going to try company mode next, not that I expect it to fix this problem, but it looks like a step to modernize my practices. – intel_chris Oct 15 '20 at 19:24