3

It annoys, when autocompletion & indentation both gets called on TAB press. So, i configured to use TAB key only for indentation as,

(setq tab-always-indent t)

Now, when i enable yas-minor-mode to place code snippets, it doesn't work since i have bound TAB key only for indentation. Is there any other key binding (or) yasnippet function that can i use/call to get this feature?

2

From the yas-snippet manual:

Trigger key

yas-expand tries to expand a snippet abbrev (also known as snippet key) before point.

When yas-minor-mode is enabled, it binds yas-expand to TAB and by default, however, you can freely set it to some other key:

(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
(define-key yas-minor-mode-map (kbd "<the new key>") 'yas-expand)
| improve this answer | |

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.