12

I just moved to spacemacs from vim and am a complete newbie with emacs.

I cannot figure out how to expand yasnippets while in evil-insert-mode. I know yasnippet is available because I can choose from the available snippets using Spc i s. However I'd like to be able to <Tab> expand them. What am I missing?

owise1
  • 351
  • 2
  • 7
  • Have you tried [company-mode](https://github.com/company-mode/company-mode)? I think it is very handy when dealing with auto completion---it has many different backends, and yasnippet is one of them. – xuhdev Apr 06 '16 at 20:15
  • yeah, spacemacs comes bundled with auto-complete and company-mode. I'm not sure which one is in effect and not really sure how to find out. – owise1 Apr 06 '16 at 21:31
  • Use `describe-mode` (it's on ` m` in default Emacs), and search in 1st paragraph (where it says "Enabled minor modes: ..."). – npostavs Apr 07 '16 at 14:46
  • thanks! it says company is enabled and yas. strangely I dont see company-mode's dropdown box with suggestions when I type and the yassnippets dont expand – owise1 Apr 07 '16 at 15:58

3 Answers3

13

M-/ is the default binding to expand snippets not TAB. You can find this out with Spc ? then searching for yas

owise1
  • 351
  • 2
  • 7
3

M-x yas-expand, you can C-h f yas-expand to check which hotkey is assigned.

company is an auto-completion framework which supports many backends. company-yasnippet could be its backend. If you use company-yasnippet, please check https://github.com/company-mode/company-mode/issues/492

I use yasnippets independently and assign global hotkey M-j to yas-expand

chen bin
  • 4,781
  • 18
  • 36
0

As I can see Spacemacs is not using the classic yas-expand but uses hippie expand which triggers yas-expand:

M-/ runs the command hippie-expand (found in global-map), which is an
interactive autoloaded compiled Lisp function in ‘hippie-exp.el’.

 is bound to M-/.

(hippie-expand ARG)

:around advice: ‘ad-Advice-hippie-expand’

Try to expand text before point, using multiple methods.
The expansion functions in ‘hippie-expand-try-functions-list’ are
tried in order, until a possible expansion is found.  Repeated
application of ‘hippie-expand’ inserts successively possible
expansions.
With a positive numeric argument, jumps directly to the ARG next
function in this list.  With a negative argument or just SPC u,
undoes the expansion.
dzeruel
  • 31
  • 2