I have changed the keybindings for yasnippet and autocomplete so that I can use tab for indentation anywhere in a line without accidentally autocompleting or inserting a snippet.
I have this in my init.el
(package-initialize)
(require 'auto-complete-config)
(ac-config-default)
(define-key ac-mode-map (kbd "TAB") nil)
(define-key ac-completing-map (kbd "TAB") nil)
(define-key ac-completing-map [tab] nil)
(ac-set-trigger-key "`") ;; sets the auto-complete key
(require 'yasnippet)
(yas/initialize)
(yas/load-directory
(dot-emacs "elpa/yasnippet/snippets"))
;; Remove Yasnippet's default tab key binding
(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
;; Set Yasnippet's key binding to shift+tab
(define-key yas-minor-mode-map (kbd "§") 'yas-expand)
This works for most emacs modes, however when I use one particular mode (vhdl-mode) the yasnippet key bind §
works as expected but ` does not work for auto-complete and it resets to the default tab
key for autocomplete.
This means when I go through my code using tab to indent or un-indent parts of it random words are auto-completed.