0

How to unset yasnippet's tab key default behaviour or even redefine it?

I am having issues getting yasnippet and auto-complete to play well together and, in particular, find the Tab key behaviour to be problematic at times as auto-complete tends to prevent yasnippet from expanding snippets.

migdsb
  • 677
  • 1
  • 8
  • 19

1 Answers1

1

Experimented a bit and finally found a solution that works.

;; It is crucial you first activate yasnippet's global mode.
(yas/global-mode 1)

;; This illustrates how to redefine yas-expand to S-TAB.
(define-key yas-minor-mode-map [backtab]     'yas-expand)

;; Strangely, just redefining one of the variations below won't work.
;; All rebinds seem to be needed.
(define-key yas-minor-mode-map [(tab)]        nil)
(define-key yas-minor-mode-map (kbd "TAB")    nil)
(define-key yas-minor-mode-map (kbd "<tab>")  nil)
migdsb
  • 677
  • 1
  • 8
  • 19