This question already has an answer here:

yasnippet does not respect spaces or tabs when they occur at the start a line.

In my snippet file I have


which executes as


Escaping with \ doesn't work.

How do I get leading spaces/tabs?

marked as duplicate by npostavs, Drew, Stefan, zck, JeanPierre Mar 22 '18 at 20:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Look for expand-env: ((yas-indent-line 'fixed)):

# -*- mode: snippet -*-
# name: Example for Indent
# key: example
# expand-env: ((yas-indent-line 'fixed))
# --

Not the answer you're looking for? Browse other questions tagged or ask your own question.