From e340ee2868fd70c549d7178889c9775cfb0536a3 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Wed, 1 Mar 2017 17:34:36 +0200 Subject: [PATCH] Fix some issues with hanging attribute indentation Seems like the "current line" doesn't really have any syntax when it's empty, so pressing doesn't work, even if a manual reindent does. Instead, we check the syntax of the line above. --- indent/handlebars.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indent/handlebars.vim b/indent/handlebars.vim index 4c5de2f..c07566d 100644 --- a/indent/handlebars.vim +++ b/indent/handlebars.vim @@ -80,7 +80,8 @@ function! GetHandlebarsIndent(...) " tag is on a separate line " check for a hanging attribute - if synIDattr(synID(v:lnum, 1, 1), "name") =~ 'mustache\%(Inside\|Section\)' + let last_plnum_col = col([plnum, '$']) - 1 + if synIDattr(synID(plnum, last_plnum_col, 1), "name") =~ '^mustache' let hanging_attribute_pattern = '{{\#\=\%(\k\|[/-]\)\+\s\+\zs\k\+=' let just_component_pattern = '^\s*{{\%(\k\|[/-]\)\+\s*$'