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

1

6

I would like to close my if statements with a comment indicating the condition checked in the if statement. I am using yasnippet with emacs and the snippet I use 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 gets aligned with $0. Is there a way to make it align with the if statement?

Writer answered 26/11, 2014 at 3:2 Comment(0)
D
11

The value of yas-indent-line controls this behavior. Try adding

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

to the header.

Doublet answered 26/11, 2014 at 7:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.