How to remove indentation for a line in yasnippet for python-mode?

I would like to close my if statements with a comment indicating the condition specified in the if statement. I am using yasnippet with emacs and the snippet I am using is this:

# -*- mode: snippet -*-
# name: if
# key: if
# group : control structure
# --
if ${1:cond}:
    $0
# endif $1

      

My problem is that the final # endif comment aligns with $ 0 . Is there a way to make it consistent with the if statement?

+3


source to share


1 answer


The value yas-indent-line

controls this behavior. Try adding

# expand-env: ((yas-indent-line 'fixed))

      



in the title.

+7


source







All Articles