Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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?

like image 624
evolute Avatar asked Nov 26 '14 03:11

evolute


1 Answers

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

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

to the header.

like image 195
Kyle Meyer Avatar answered Nov 01 '22 19:11

Kyle Meyer