Giles Roberts
Giles Roberts

Reputation: 6883

Emacs auto-complete.el switch tab to spacebar

I've used auto-complete.el in Emacs for ages. I'm using Emacs a bit more these days and my left pinky is starting to get RSI from hitting TAB and ctrl all the time. I've done some keyboard remapping to alleviate the situation but every few characters I'm generally pressing tab to complete a word. Is there any way to switch auto-complete.el from using TAB for completion to spacebar with my less used and stronger thumbs?

Edit2: I was using a really old version of auto-complete.el which meant that @hd1 suggestion didn't work for me immediately.

Upvotes: 1

Views: 1475

Answers (2)

sp3ctum
sp3ctum

Reputation: 465

I think ac-complete-mode-map is a keymap used when the auto-complete menu is shown. How about trying something like this instead (this is my setting):

(define-key evil-insert-state-map (kbd "C-SPC") 'auto-complete)

If you don't use evil, you need to find another keymap. Perhaps a mode-specific map, or even global-map will work.

Upvotes: 0

hd1
hd1

Reputation: 34657

Going to the source and scrolling down to line 235 shows that if you set the variable ac-trigger-key you can change the key that's used to trigger completion. You should set this variable in your custom-set-variables block in your .emacs file.

Upvotes: 1

Related Questions