1

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.

1 Answer 1

2

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

1
  • 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. Oct 15, 2020 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.