2

In .emacs, I bound the key for yasnippet as,

(define-key yas-minor-mode-map (kbd "C-SPC") 'yas-expand)

In a buffer with python as major mode and yasnippet, autocomplete as minor mode, yasnippet doesn't expand on C-SPC.

Now, i started doubting if there are any snippets available. I did C-c & C-v (or) Visit Snippet File and it gives alarm, No snippet tables active.

How to add snippets to a major mode?

  • Have a look at "The Condition System" over here: capitaomorte.github.io/yasnippet/snippet-expansion.html Is that maybe what you need? – Brian Z Apr 21 '15 at 7:18
  • Using "C-SPC" works for me. Did you try expanding other snippets? Maybe type "fd" and see if it expands to a function with a docstring. I think a "class" snippet just doesn't exist, I think it's "cls" instead. – bmag Apr 21 '15 at 8:37
1

Looks like, yas-snippets doesn't get loaded by default. Calling yas-reload-all loaded the python snippets. I confirmed, the snippets are loaded by listing them with C-c & C-v. And it works now...

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.